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

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

Re: How run a command JUST on region highlighted by MOUSE?!?!


From: Oliver Scholz
Subject: Re: How run a command JUST on region highlighted by MOUSE?!?!
Date: Fri, 29 Aug 2003 20:34:16 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt)

seberino@spawar.navy.mil (Christian Seberino) writes:

> Andrew
>
> Thanks for the help.  Can I please ask you a related question on usage
> of narrow-to-region?
>
> I set .emacs up to run this function when I highlight a region with
> mouse
> and type C-ac.....
>
>  (defun cs-py-comment-region() (interactive)
>       (narrow-to-region)
                        ^^^
>       (py-comment-region)
>       (delete-trailing-whitespace)
>       (widen))
         ^^^^

[untested]

(defun cs-py-comment-region (beg end)
  (interactive "r")
  (save-restriction
    (narrow-to-region beg end)
    (py-comment-region)
    (delete-trailing-whitespace)))

    Oliver
-- 
12 Fructidor an 211 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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