[Top][All Lists]

[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:03:16 -0700


Thanks for the help.  I like your version and would very much like to
use it.
The "save-restriction" is a nice touch too.

I copied your version essentially verbatim into my .emacs....

   (defun cs-py-comment-region(beg end) (interactive "r")
      (narrow-to-region beg end)

It give me the following error message when I hightlight a region with
and then type C-ac which is setup to call this function....

save-restriction: Wrong number of arguments: (lambda (beg end
&optional arg) "Like `comment-region' but uses double hash (`#')
comment starter." (interactive "r
P") (let ((comment-start py-block-comment-prefix)) (comment-region beg
end arg))), 0

Do you know what this error means and how to fix?

Thanks again,


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]