unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: seberino@spawar.navy.mil (Christian Seberino)
Subject: Re: How run a command JUST on region highlighted by MOUSE?!?!
Date: 2 Sep 2003 17:03:16 -0700	[thread overview]
Message-ID: <bf23f78f.0309021603.1b6750f0@posting.google.com> (raw)
In-Reply-To: uad9s9utz.fsf@ID-87814.user.dfncis.de

Oliver

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")
    (save-restriction
      (narrow-to-region beg end)
      (py-comment-region)
      (delete-trailing-whitespace)))

It give me the following error message when I hightlight a region with
mouse
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,

Chris

Oliver Scholz <alkibiades@gmx.de> wrote in message news:<uad9s9utz.fsf@ID-87814.user.dfncis.de>...
> 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

  reply	other threads:[~2003-09-03  0:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-28 21:24 How run a command JUST on region highlighted by MOUSE?!?! Christian Seberino
2003-08-28 21:32 ` Andrew Taylor
2003-08-29 18:22   ` Christian Seberino
2003-08-29 18:34     ` Oliver Scholz
2003-09-03  0:03       ` Christian Seberino [this message]
2003-09-03  0:19       ` Christian Seberino
2003-08-29 18:56     ` Johan Bockgård
2003-08-29 21:45     ` Kevin Rodgers
2003-09-03  0:16       ` Christian Seberino
2003-09-03 22:04         ` Jeffery B. Rancier
2003-09-03 23:13         ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf23f78f.0309021603.1b6750f0@posting.google.com \
    --to=seberino@spawar.navy.mil \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).