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

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

Re: Tip of the day: buffer navigation with global mark


From: John Russell
Subject: Re: Tip of the day: buffer navigation with global mark
Date: 07 Apr 2003 13:17:19 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:

> Here are some other suggestions:
> You might consider beginner & expert levels of Tip of the Day.
> For example, I do
> C-u 3 C-k
> C-y
> C-y
> all the time to copy 3 lines, but you'd be surprised at how many, even long
> term Emacs users, don't know this one.

How about this: 

(defun duplicate-line (&optional where)
  "Duplicate the line containing point."
  (interactive "d")
  (save-excursion
    (beginning-of-line)
    (let ((beg (point)))
      (end-of-line)
      (copy-region-as-kill beg (point)))
    (end-of-line)
    (if (eobp)
        (insert ?\n)
      (forward-line))
    (open-line 1)
    (yank)))

(define-key global-map [?whatever] 'duplicate-line)

John

PS Lifted this from some unknown .emacs file on the web, 
but I use it constantly.


reply via email to

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