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: Christian Seberino
Subject: Re: How run a command JUST on region highlighted by MOUSE?!?!
Date: 2 Sep 2003 17:19:36 -0700

Oliver 

OK, I got your version to work after replacing (py-comment-region)
with  (py-comment-region beg end).  Can you please
explain the (interactive "r") and why you needed to add 2 args to
function at top?..--> (defun cs-py-comment-region(beg end) ..)

It all works but it would be nice to understand it too! 


Thanks again,

Chris

Oliver Scholz <address@hidden> wrote in message news:<address@hidden>...
> address@hidden (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


reply via email to

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