emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f745cf8: * lisp/isearch.el (isearch-yank-on-move):


From: Juri Linkov
Subject: [Emacs-diffs] master f745cf8: * lisp/isearch.el (isearch-yank-on-move): New defcustom
Date: Mon, 3 Dec 2018 19:42:02 -0500 (EST)

branch: master
commit f745cf8c438cdb258bc1a37b617749d1c84e688e
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/isearch.el (isearch-yank-on-move): New defcustom
    
    with shift-move related options extracted from `search-exit-option'.
    (isearch-pre-command-hook): Rename search-exit-option to
    isearch-yank-on-move in shift-move related places.
    (isearch-post-command-hook): Check for isearch-pre-move-point
    instead of search-exit-option.  (Bug#15839)
    
    * doc/emacs/search.texi (Not Exiting Isearch): Rename
    search-exit-option to isearch-yank-on-move.
    
    * lisp/menu-bar.el (menu-bar-i-search-menu): Add more isearch commands.
---
 doc/emacs/search.texi |  4 ++--
 etc/NEWS              |  7 +++----
 lisp/isearch.el       | 46 +++++++++++++++++++++++++---------------------
 lisp/menu-bar.el      |  9 +++++++++
 4 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 35e2bfb..8ea80cb 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -548,12 +548,12 @@ an incremental search.  This feature is disabled if
 
 @item Motion Commands
 @cindex motion commands, during incremental search
-When @code{search-exit-option} is customized to @code{shift-move},
+When @code{isearch-yank-on-move} is customized to @code{shift},
 you can extend the search string by holding down the shift key while
 typing cursor motion commands.  It will yank text that ends at the new
 position after moving point in the current buffer.
 
-When @code{search-exit-option} is @code{move}, you can extend the
+When @code{isearch-yank-on-move} is @code{t}, you can extend the
 search string without using the shift key for cursor motion commands,
 but it applies only for certain motion command that have the
 @code{isearch-move} property on their symbols.
diff --git a/etc/NEWS b/etc/NEWS
index 042a4b5..206f0fc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -691,11 +691,10 @@ highlight in one iteration while processing the full 
buffer.
 'C-M-d'.
 
 +++
-*** 'search-exit-option' provides new options 'move' and 'shift-move'
+*** New variable 'isearch-yank-on-move' provides options 't' and 'shift'
 to extend the search string by yanking text that ends at the new
-position after moving point in the current buffer.  'shift-move'
-extends the search string by motion commands while holding down
-the shift key.
+position after moving point in the current buffer.  'shift' extends
+the search string by motion commands while holding down the shift key.
 
 *** 'isearch-allow-scroll' provides new option 'unlimited' to allow
 scrolling any distance off screen.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index cc199b1..dcd119a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -72,21 +72,11 @@
 If t, random control and meta characters terminate the search
 and are then executed normally.
 If `edit', edit the search string instead of exiting.
-If `move', extend the search string by motion commands
-that have the `isearch-move' property on their symbols
-equal to `enabled', or the shift-translated command is
-not disabled by the value `disabled' of the same property.
-If `shift-move', extend the search string by motion commands
-while holding down the shift key.
-Both `move' and `shift-move' extend the search string by yanking text
-that ends at the new position after moving point in the current buffer.
 If `append', the characters which you type that are not interpreted by
 the incremental search are simply appended to the search string.
 If nil, run the command without exiting Isearch."
   :type '(choice (const :tag "Terminate incremental search" t)
                  (const :tag "Edit the search string" edit)
-                 (const :tag "Extend the search string by motion commands" 
move)
-                 (const :tag "Extend the search string by shifted motion keys" 
shift-move)
                  (const :tag "Append control characters to the search string" 
append)
                  (const :tag "Don't terminate incremental search" nil))
   :version "27.1")
@@ -2816,6 +2806,21 @@ the bottom."
 (defvar isearch-pre-scroll-point nil)
 (defvar isearch-pre-move-point nil)
 
+(defcustom isearch-yank-on-move nil
+  "Motion keys yank text to the search string while you move the cursor.
+If `shift', extend the search string by motion commands while holding down
+the shift key.  The search string is extended by yanking text that
+ends at the new position after moving point in the current buffer.
+If t, extend the search string without the shift key pressed
+by motion commands that have the `isearch-move' property on their
+symbols equal to `enabled', or for which the shift-translated command
+is not disabled by the value `disabled' of property `isearch-move'."
+  :type '(choice (const :tag "Motion keys exit Isearch" nil)
+                 (const :tag "Motion keys extend the search string" t)
+                 (const :tag "Shifted motion keys extend the search string" 
shift))
+  :group 'isearch
+  :version "27.1")
+
 (defun isearch-pre-command-hook ()
   "Decide whether to exit Isearch mode before executing the command.
 Don't exit Isearch if the key sequence that invoked this command
@@ -2859,13 +2864,13 @@ See more for options in `search-exit-option'."
       (read-event)
       (setq this-command 'isearch-edit-string))
      ;; Don't terminate the search for motion commands.
-     ((or (and (eq search-exit-option 'move)
+     ((or (and (eq isearch-yank-on-move t)
                (symbolp this-command)
                (or (eq (get this-command 'isearch-move) 'enabled)
                    (and (not (eq (get this-command 'isearch-move) 'disabled))
                         (stringp (nth 1 (interactive-form this-command)))
                         (string-match-p "^^" (nth 1 (interactive-form 
this-command))))))
-          (and (eq search-exit-option 'shift-move)
+          (and (eq isearch-yank-on-move 'shift)
                this-command-keys-shift-translated))
       (setq this-command-keys-shift-translated nil)
       (setq isearch-pre-move-point (point)))
@@ -2890,9 +2895,8 @@ See more for options in `search-exit-option'."
    (when (eq isearch-allow-scroll 'unlimited)
      (when isearch-lazy-highlight
        (isearch-lazy-highlight-new-loop)))
-   (when (memq search-exit-option '(move shift-move))
-     (when (and isearch-pre-move-point
-                (not (eq isearch-pre-move-point (point))))
+   (when isearch-pre-move-point
+     (when (not (eq isearch-pre-move-point (point)))
        (let ((string (buffer-substring-no-properties
                       (or isearch-other-end isearch-opoint) (point))))
          (if isearch-regexp (setq string (regexp-quote string)))
@@ -3188,12 +3192,12 @@ the word mode."
 
 (defun isearch-message-suffix (&optional c-q-hack)
   (propertize (concat (if c-q-hack "^Q" "")
-                     (if isearch-error
-                         (concat " [" isearch-error "]")
-                       "")
-                      (isearch-lazy-count-format 'suffix)
-                     (or isearch-message-suffix-add ""))
-              'face 'minibuffer-prompt))
+                     (isearch-lazy-count-format 'suffix)
+                     (if isearch-error
+                         (concat " [" isearch-error "]")
+                       "")
+                     (or isearch-message-suffix-add ""))
+             'face 'minibuffer-prompt))
 
 (defun isearch-lazy-count-format (&optional suffix-p)
   "Format the current match number and the total number of matches.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 6de0a62..1081fb4 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -277,6 +277,15 @@
 ;; The Edit->Search->Incremental Search menu
 (defvar menu-bar-i-search-menu
   (let ((menu (make-sparse-keymap "Incremental Search")))
+    (bindings--define-key menu [isearch-forward-symbol-at-point]
+      '(menu-item "Forward Symbol at Point..." isearch-forward-symbol-at-point
+        :help "Search forward for a symbol found at point"))
+    (bindings--define-key menu [isearch-forward-symbol]
+      '(menu-item "Forward Symbol..." isearch-forward-symbol
+        :help "Search forward for a symbol as you type it"))
+    (bindings--define-key menu [isearch-forward-word]
+      '(menu-item "Forward Word..." isearch-forward-word
+        :help "Search forward for a word as you type it"))
     (bindings--define-key menu [isearch-backward-regexp]
       '(menu-item "Backward Regexp..." isearch-backward-regexp
         :help "Search backwards for a regular expression as you type it"))



reply via email to

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