[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: copy-word-from-line-above
From: |
HS |
Subject: |
Re: copy-word-from-line-above |
Date: |
25 Jan 2007 08:07:15 -0800 |
User-agent: |
G2/1.0 |
Hello!
Thanks Triska!
But your function would not copy symbols like '(' so I tried something,
and think I just wrote my first defun :)
Here it is:
(defun insert-word-above ()
(interactive)
(save-excursion
(let ((col (current-column)))
(forward-line -1)
(move-to-column col))
(let ((beg (point)))
(forward-word)
(copy-region-as-kill-nomark beg (point))))
(yank))
It seems to work!
Cheers,
HS
On 24 jan, 17:21, Markus Triska <markus.tri...@gmx.at> wrote:
> "HS" <hug...@gmail.com> writes:
> > insert-prior-line-wordWhat about:
>
> (defun insert-word-above ()
> (interactive)
> (let (word whitespace)
> (save-excursion
> (let ((col (current-column)))
> (forward-line -1)
> (move-to-column col))
> (setq word (or (thing-at-point 'word)
> (error "No word above")))
> (forward-word)
> (setq whitespace (or (thing-at-point 'whitespace) "")))
> (insert word whitespace)))
>
> (global-set-key [f2] 'insert-word-above)
>
> All the best,
> Markus Triska
- copy-word-from-line-above, HS, 2007/01/18
- Re: copy-word-from-line-above, Marc Tfardy, 2007/01/18
- Re: copy-word-from-line-above, rgb, 2007/01/19
- Re: copy-word-from-line-above, Greg Bognar, 2007/01/21
- Re: copy-word-from-line-above, rgb, 2007/01/21
- Re: copy-word-from-line-above, HS, 2007/01/22
- Re: copy-word-from-line-above, rgb, 2007/01/24
- Re: copy-word-from-line-above, HS, 2007/01/24
- Re: copy-word-from-line-above, Markus Triska, 2007/01/24
- Re: copy-word-from-line-above,
HS <=
- Re: copy-word-from-line-above, Markus Triska, 2007/01/25
- Re: copy-word-from-line-above, rgb, 2007/01/25