emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to copy a column of a table (with content)


From: Uwe Brauer
Subject: Re: how to copy a column of a table (with content)
Date: Thu, 20 Jan 2022 17:22:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hi Marco
> Uwe Brauer <oub@mat.ucm.es> writes:

> I use the following function occasionally.  Possibly it helps in your case.

> (defun mw-org-table-mark-column ()
>   "Mark the column containing point."
>   (interactive)
>   (unless (org-at-table-p) (user-error "Not at a table"))
>   (org-table-find-dataline)
>   (org-table-check-inside-data-field)
>   (let* ((col (org-table-current-column))
>          (beg (org-table-begin))
>        (end (org-table-end)))
>     (goto-char beg)
>     (org-table-goto-column col)
>     (re-search-backward "|" nil t)
>     (push-mark)
>     (goto-char (1- end))
>     (org-table-goto-column (1+ col))
>     (re-search-backward "|" nil t)
>     (exchange-point-and-mark)
>     (forward-char)))
very nice, !!!

> Copy a column would be:

> 1. Put the cursor into that column.
> 2. M-x mw-org-table-mark-column
> 3. Move the cursor onto the |.  E.g. { C-b }.
> 4. M-x copy-rectangle-as-kill
> 5. Move the cursor to a suitable position in the first line of the table.
> 6. M-x yank-rectangle

> BTW rectangle-mark-mode -- possibly activated with { C-x SPC } -- can
> help with the copy and yank in this case.
Right, I completely forgot that mode! Thanks



> HTH,
very much so. Why not include the code into master?

Uwe 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]