[Top][All Lists]
[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: |
11 Apr 2002 11:37:05 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 |
address@hidden (Kai Großjohann) writes:
> address@hidden (Kim F. Storm) writes:
>
> > What about this modification to set-mark-command which simply turns on
> > transient-mark-command (temporarily) if you repeat C-SPC immediately.
>
> It would also work the other way round: if transient-mark-mode is
> turned on, C-SPC once could do what it does now, but C-SPC twice
> could deactivate the highlighting.
>
> It appears that the problem with transient-mark-mode, for people who
> do not like it, is: if you use C-SPC so that you can later can come
> back to that spot with C-u C-SPC, then move the cursor, then there
> will be a useless and visually disturbing highlight.
>
> Myself, I use C-SPC C-g in such cases, but maybe C-SPC C-SPC is more
> intuitive?
What about this version:
(defun set-mark-command (arg)
(interactive "P")
(if arg (setq arg 1))
(if (eq this-command last-command)
(cond
(last-prefix-arg
(if arg
(setq current-prefix-arg nil
arg nil)
(setq current-prefix-arg last-prefix-arg)
(setq arg 1)))
(arg
(setq arg nil))
((eq transient-mark-mode 'lambda)
(setq transient-mark-mode nil))
(transient-mark-mode
(setq deactivate-mark t))
(t
(setq transient-mark-mode 'lambda)
(setq arg 0))))
(cond
((null arg)
(if (eq transient-mark-mode 'lambda)
(setq transient-mark-mode nil))
(push-mark nil nil t))
((= arg 0))
((null (mark t))
(error "No mark set in this buffer"))
(t
(goto-char (mark t))
(pop-mark))))
With transient-mark-mode off (nil), C-SPC C-SPC temporarily turns on
transient-mark-mode (lambda), and another C-SPC turns it off (and
moves the mark).
With transient-mark-mode on (t), C-SPC C-SPC sets and deactivates the mark.
As an added bonus, C-u C-SPC C-SPC C-SPC will pop back through the
mark stack, i.e. only the first command needs the C-u prefix.
To set (reactivate) the mark immedately following a series of
C-u C-SPC C-SPC C-SPC C-SPC C-SPC commands, use C-u C-SPC (or
C-u C-SPC C-SPC to toggle transient-mark-mode).
This is a significant deviation from the old behaviour of C-u C-SPC,
but the new functionality is much easier to use...!
Opinions?
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Stefan Monnier, 2002/04/08
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Benjamin Rutt, 2002/04/08
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kai Großjohann, 2002/04/09
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Richard Stallman, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Stefan Monnier, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kim F. Storm, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kim F. Storm, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Stefan Monnier, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kai Großjohann, 2002/04/10
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim],
Kim F. Storm <=
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Francesco Potorti`, 2002/04/11
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kim F. Storm, 2002/04/11
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Stefan Monnier, 2002/04/11
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Richard Stallman, 2002/04/11
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kim F. Storm, 2002/04/12
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Stefan Monnier, 2002/04/12
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Richard Stallman, 2002/04/13
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Kim F. Storm, 2002/04/14
- Re: address@hidden: [patch] factor out comment-or-uncomment feature from comment-dwim], Richard Stallman, 2002/04/16