help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: copy-word-from-line-above


From: Markus Triska
Subject: Re: copy-word-from-line-above
Date: Thu, 25 Jan 2007 21:13:25 +0100

"HS" <hugows@gmail.com> wrote:

> Hello!
> Thanks Triska!
> But your function would not copy symbols like '(' so I tried something,
> and think I just wrote my first defun :)

Cool; I changed "copy-region-as-kill-nomark" to "copy-region-as-kill"
to get it working. To preserve the kill ring, you can use: 

(defun insert-word-above ()
  (interactive)
  (let (string beg end)
    (save-excursion
      (let ((col (current-column)))
        (forward-line -1)
        (move-to-column col))
      (setq beg (point))
      (forward-word)
      (setq end (point)))
    (insert (buffer-substring beg end))))

All the best,
Markus Triska


reply via email to

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