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)))
(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
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.