all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: "Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu>,
	Richard Stallman <rms@gnu.org>,
	emacs-devel@gnu.org, rutt+news@cis.ohio-state.edu
Subject: Re: [rutt+news@cis.ohio-state.edu: [patch] factor out comment-or-uncomment feature from comment-dwim]
Date: 11 Apr 2002 11:37:05 +0200	[thread overview]
Message-ID: <5xg02260fy.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <vaf8z7vtfpq.fsf@INBOX.auto.emacs.devel.tok.lucy.cs.uni-dortmund.de>

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> storm@cua.dk (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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2002-04-11  9:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200204072343.g37NhcO20159@aztec.santafe.edu>
2002-04-08 22:13 ` [rutt+news@cis.ohio-state.edu: [patch] factor out comment-or-uncomment feature from comment-dwim] Stefan Monnier
2002-04-09  0:18   ` Benjamin Rutt
2002-04-09  9:33   ` Kai Großjohann
2002-04-10 14:23   ` Richard Stallman
2002-04-10 16:36     ` Stefan Monnier
2002-04-10 21:25       ` Kim F. Storm
2002-04-10 20:39         ` Stefan Monnier
2002-04-10 21:18         ` Kai Großjohann
2002-04-11  9:37           ` Kim F. Storm [this message]
2002-04-11  9:48             ` Francesco Potorti`
2002-04-11 11:49               ` Kim F. Storm
2002-04-11 13:05             ` Stefan Monnier
2002-04-12  3:12             ` Richard Stallman
2002-04-12  9:45               ` Kim F. Storm
2002-04-12 18:46                 ` Stefan Monnier
2002-04-13 19:06                 ` Richard Stallman
2002-04-14 21:32                   ` Kim F. Storm
2002-04-16 20:18                     ` Richard Stallman
2002-04-10 21:39         ` Kim F. Storm

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

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

  git send-email \
    --in-reply-to=5xg02260fy.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=monnier+gnu/emacs@RUM.cs.yale.edu \
    --cc=rms@gnu.org \
    --cc=rutt+news@cis.ohio-state.edu \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.