emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: [patch] factor out comment-or-uncomment feature from


From: Kim F. Storm
Subject: Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim]
Date: 10 Apr 2002 23:25:44 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

"Stefan Monnier" <monnier+gnu/address@hidden> writes:

> >     On a related note:
> >     how about a transient form of transient-mark-mode ?
> >     We agreed that it would be desirable a while back, but the concrete 
> > details
> >     weren't clear at the time.  I have a more concrete proposal now:
> > 
> > How would you use this?
> 
> With transient-mark-mode, you can do
> 
>       C-SPC ...move... M-;
> 
> With the code I sent, people who don't have transient-mark-mode turned on
> can still use the comment-region behavior of M-; by doing:
> 
>       M-x mark-and-highlight RET ...move... M-;
> or
>       C-SPC ...move... M-x activate-and-highlight-region RET M-;
> 
> This could also be used with other functions who operate on the
> region only when transient-mark-mode is turned ON.
> 
> Both mark-and-highlight and activate-and-highlight-region are useful and
> they should both be provided.  The question is mostly where to bind those
> two commands.  I wish mark-and-highlight could be bound to something
> similar to C-u SPC and I think that activate-and-highlight-region could
> be bound to C-u C-x C-x.
> 

I don't see why both functions are necessary!

What about this modification to set-mark-command which simply turns on
transient-mark-command (temporarily) if you repeat C-SPC immediately.
If you move the mark with another C-SPC, transient-mark-mode is
turned off again (enter another C-SPC to reenable it):

(defun set-mark-command (arg)
  (interactive "P")
  (if (null arg)
      (if (eq this-command last-command)
          (setq transient-mark-mode 'lambda)
        (setq transient-mark-mode nil)
        (push-mark nil nil t))
    (if (null (mark t))
        (error "No mark set in this buffer")
      (goto-char (mark t))
      (pop-mark))))

I.e. you can use

        C-SPC C-SPC .....  M-;


-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

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