emacs-devel
[Top][All Lists]
Advanced

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

Permanent shift-select-mode (was: delete-selection-mode)


From: Juri Linkov
Subject: Permanent shift-select-mode (was: delete-selection-mode)
Date: Sun, 21 Mar 2010 01:51:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> There is also lisp/s-region.el that could be marked obsolete.

s-region.el is now obsolete.  But unfortunately, `shift-select-mode'
is not an exact replacement.  There is an significant difference:
`shift-select-mode' deactivates the mark when a next key is not
shift-translated.

The following patch adds a new option `permanent' to
`shift-select-mode' that doesn't deactivate the mark:

=== modified file 'lisp/simple.el'
--- lisp/simple.el      2010-03-05 12:01:10 +0000
+++ lisp/simple.el      2010-03-20 23:47:55 +0000
@@ -3956,9 +3956,15 @@ (defcustom shift-select-mode t
 by any subsequent point motion key that was not shift-translated, or
 by any action that normally deactivates the mark in Transient Mark mode.
 
+When the value is `permanent', the mark will not be deactivated
+by any subsequent point motion key that was not shift-translated.
+
 See `this-command-keys-shift-translated' for the meaning of
 shift-translation."
-  :type 'boolean
+  :type '(choice (const :tag "Off" nil)
+                (const :tag "Permanent" permanent)
+                (other :tag "On" t))
+  :version "23.1"
   :group 'editing-basics)
 
 (defun handle-shift-selection ()
@@ -3978,11 +3984,15 @@ (defun handle-shift-selection ()
 its earlier value."
   (cond ((and shift-select-mode this-command-keys-shift-translated)
          (unless (and mark-active
-                      (eq (car-safe transient-mark-mode) 'only))
-           (setq transient-mark-mode
-                 (cons 'only
-                       (unless (eq transient-mark-mode 'lambda)
-                         transient-mark-mode)))
+                      (or (eq (car-safe transient-mark-mode) 'only)
+                         (eq shift-select-mode 'permanent)))
+          (setq transient-mark-mode
+                 (if (eq shift-select-mode 'permanent)
+                    (unless (eq transient-mark-mode 'lambda)
+                      transient-mark-mode)
+                  (cons 'only
+                        (unless (eq transient-mark-mode 'lambda)
+                          transient-mark-mode))))
            (push-mark nil nil t)))
         ((eq (car-safe transient-mark-mode) 'only)
          (setq transient-mark-mode (cdr transient-mark-mode))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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