LineCopyChar

This is a feature that I’ve missed in many text editors. – JukkaM

     (defun line-copy-char (&optional b)
      "Copy a character exactly below/above the point
       to the current point of the cursor (default is above)."
       (interactive "p")
         (let (p col s)
           (setq p (point))
           (setq col (current-column))
           (forward-line (if b -1 1))
           (move-to-column col)
           (setq s (buffer-substring (point) (+ (point) 1)))
           (goto-char p)
           (insert s)))
and the keybindings to go with it
     (define-key global-map [f12] 'line-copy-char)
     (define-key global-map [(shift f12)] '(lambda ()(interactive)(line-copy-char nil)))

This seems to be a rather esoteric function. Maybe I’m missing its utility? How do you get in a situation where you need to use this? – ErikBourget

I’m wondering the same thing. – EdwardOConnor
I have needed this a couple of times. I solved it back then by doing a keyboard macro. I cannot remember exactly what I wanted it for, but I know it was very handy back then. – MathiasDahl

It is similar to `<up> <C-k> <C-y> <down> <C-y>’, perhaps. – AlexSchroeder

There is the VcursorPackage which might be what you want. It is in GNU Emacs since version 21.2 and you can set a “virtual cursor” to somewhere in a buffer, then copy characters, words, and lines from the virtual cursor position to point. – MattHodges

This functionality is similar to that found in MS Excel, and many other Windows-based applications that deal with tabular data. It’s typically bound to C-’. – EricHanchrow

Vim has C-y and C-e for copying a character from above and below, respectively. – DanielBrockman

There is CopyFromAbove command in misc.el.


CategoryEditing