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

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

Re: copy paragraph


From: Nikos Apostolakis
Subject: Re: copy paragraph
Date: Fri, 14 Apr 2006 07:03:13 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Gary Wessle <address@hidden> writes:

> Hi
>
> I am trying to copy paragraph under point and by binding C-cp like this
> (global-set-key "\C-cp" "address@hidden")
> not working, could some one check it.
>

With "global-set-key" you can bind *commands* to a key, not key
sequences.  One way to do what you were trying to, is to record a
keyboard macro, give it a name and then to save it in your .emacs
see (info "(emacs) Save Keyboard Macro").

Or you could do something like

(global-set-key "\C-cp" 
                '(lambda () (interactive)
                   (save-excursion
                     (copy-region-as-kill 
                      (or (search-backward-regexp "^\n") (beginning-of-buffer))
                      (or (search-forward-regexp "^\n" nil t 2) 
(end-of-buffer))))))


assuming that your paragraphs are seperated by blank lines (not
thoroughly tested).

HTH,
Nikos

> thank you





reply via email to

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