[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: 12 Apr 2002 11:45:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Richard Stallman <address@hidden> writes:

>     This is a significant deviation from the old behaviour of C-u C-SPC,
>     but the new functionality is much easier to use...!
> I think it is good, but I think we should also look at the idea
> of changing C-x C-x in a similar way:
> doing it twice would temporarily enable transient-mark-mode.

I don't see any problems doing that, and I think it is complements
the changes to C-SPC very well.  Here is a version which does that:

(defun exchange-point-and-mark ()
  "Put the mark where point is now, and point where the mark is now.
This command works even when the mark is not active,
and it reactivates the mark.
If the command is repeated immediately, `transient-mark-mode' is
enabled temporarily."
  (interactive nil)
  (let ((omark (mark t)))
    (if (null omark)
        (error "No mark set in this buffer"))
    (set-mark (point))
    (goto-char omark)
    (if (and (not transient-mark-mode)
             (eq this-command last-command))
        (setq transient-mark-mode 'lambda))

Should I install it (together with the new set-mark-command)?
This is still requires some of Stefan's original suggestion:

--- simple.el   7 Apr 2002 10:10:23 -0000       1.533
+++ simple.el   8 Apr 2002 22:06:00 -0000
@@ -2233,11 +2270,19 @@
   "Deactivate the mark by setting `mark-active' to nil.
 \(That makes a difference only in Transient Mark mode.)
 Also runs the hook `deactivate-mark-hook'."
-  (if transient-mark-mode
-      (progn
+  (cond
+   ((eq transient-mark-mode 'lambda)
+    (setq transient-mark-mode nil))
+   (transient-mark-mode
        (setq mark-active nil)
        (run-hooks 'deactivate-mark-hook))))
--- keyboard.c  3 Apr 2002 08:36:56 -0000       1.669
+++ keyboard.c  8 Apr 2002 22:05:22 -0000
@@ -1718,9 +1721,15 @@
          if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
+             /* We could also call `deactivate'mark'.  */
+             if (EQ (Vtransient_mark_mode, Qlambda))
+               Vtransient_mark_mode = Qnil;
+             else
+               {
              current_buffer->mark_active = Qnil;
              call1 (Vrun_hooks, intern ("deactivate-mark-hook"));
+           }
          else if (current_buffer != prev_buffer || MODIFF != prev_modiff)
            call1 (Vrun_hooks, intern ("activate-mark-hook"));

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

reply via email to

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