Subject: bug#13348: 24.3.50; `C-s', `C-r', `RET' in `minibuffer-local-isearch-map'

From: Juri Linkov <[email-masked]>
Date: Thu, 09 May 2013 00:04:53 +0300

> Also I noticed that `isearch-nonincremental-exit-minibuffer'
> has no effect, so I removed it instead of adding a docstring
> to this unused function:

Better than removing is to mark it obsolete.

I propose also to rename the recently added function
`isearch-insert-char-by-name' to `isearch-char-by-name'
(using naming convention like in `isearch-other-meta-char'
and `isearch-printing-char') because it doesn't insert a character
to the buffer but adds a character to the search string:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-05-01 08:10:12 +0000
+++ lisp/isearch.el	2013-05-08 20:49:59 +0000
@@ -47,7 +47,7 @@
 ;; modify the search string before executing the search.  There are
 ;; three commands to terminate the editing: C-s and C-r exit the
 ;; minibuffer and search forward and reverse respectively, while C-m
-;; exits and does a nonincremental search.
+;; exits and searches in the last search direction.
 
 ;; Exiting immediately from isearch uses isearch-edit-string instead
 ;; of nonincremental-search, if search-nonincremental-instead is non-nil.
@@ -515,12 +515,12 @@ (defvar isearch-mode-map
     (define-key map "\M-so" 'isearch-occur)
     (define-key map "\M-shr" 'isearch-highlight-regexp)
 
-    ;; The key translations defined in the C-x 8 prefix should insert
-    ;; characters into the search string.  See iso-transl.el.
+    ;; The key translations defined in the C-x 8 prefix should add
+    ;; characters to the search string.  See iso-transl.el.
     (define-key map "\C-x" nil)
     (define-key map [?\C-x t] 'isearch-other-control-char)
     (define-key map "\C-x8" nil)
-    (define-key map "\C-x8\r" 'isearch-insert-char-by-name)
+    (define-key map "\C-x8\r" 'isearch-char-by-name)
 
     map)
   "Keymap for `isearch-mode'.")
@@ -528,7 +528,7 @@ (defvar isearch-mode-map
 (defvar minibuffer-local-isearch-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
-    (define-key map "\r"    'isearch-nonincremental-exit-minibuffer)
+    (define-key map "\r"    'exit-minibuffer)
     (define-key map "\M-\t" 'isearch-complete-edit)
     (define-key map "\C-s"  'isearch-forward-exit-minibuffer)
     (define-key map "\C-r"  'isearch-reverse-exit-minibuffer)
@@ -679,6 +679,8 @@ (defun isearch-forward (&optional regexp
 Type \\[isearch-yank-pop] to replace string just yanked into search prompt
  with string killed before it.
 Type \\[isearch-quote-char] to quote control character to search for it.
+Type \\[isearch-char-by-name] to add a character to search by Unicode name,\
+ with completion.
 \\[isearch-abort] while searching or when search has failed cancels input\
  back to what has
  been found successfully.
@@ -1273,7 +1275,6 @@ (defun isearch-edit-string ()
 The following additional command keys are active while editing.
 \\<minibuffer-local-isearch-map>
 \\[exit-minibuffer] to resume incremental searching with the edited string.
-\\[isearch-nonincremental-exit-minibuffer] to do one nonincremental search.
 \\[isearch-forward-exit-minibuffer] to resume isearching forward.
 \\[isearch-reverse-exit-minibuffer] to resume isearching backward.
 \\[isearch-complete-edit] to complete the search string using the search ring."
@@ -1307,13 +1308,18 @@ (defun isearch-nonincremental-exit-minib
   (interactive)
   (setq isearch-nonincremental t)
   (exit-minibuffer))
+;; Changing the value of `isearch-nonincremental' has no effect here,
+;; because `isearch-edit-string' ignores this change.  Thus marked as obsolete.
+(make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer "24.4")
 
 (defun isearch-forward-exit-minibuffer ()
+  "Resume isearching forward from the minibuffer that edits the search string."
   (interactive)
   (setq isearch-new-forward t)
   (exit-minibuffer))
 
 (defun isearch-reverse-exit-minibuffer ()
+  "Resume isearching backward from the minibuffer that edits the search string."
   (interactive)
   (setq isearch-new-forward nil)
   (exit-minibuffer))
@@ -1866,11 +1872,12 @@ (defun isearch-yank-line ()
    (lambda () (let ((inhibit-field-text-motion t))
 		(line-end-position (if (eolp) 2 1))))))
 
-(defun isearch-insert-char-by-name ()
-  "Read a character by its Unicode name and insert it into search string."
+(defun isearch-char-by-name ()
+  "Read a character by its Unicode name and add it to the search string.
+Completion is available like in `read-char-by-name' used by `insert-char'."
   (interactive)
   (with-isearch-suspended
-   (let ((char (read-char-by-name "Insert character (Unicode name or hex): ")))
+   (let ((char (read-char-by-name "Add character to search (Unicode name or hex): ")))
      (when char
        (setq isearch-new-string (concat isearch-string (string char))
 	     isearch-new-message (concat isearch-message

=== modified file 'doc/emacs/search.texi'
--- doc/emacs/search.texi	2013-01-01 09:11:05 +0000
+++ doc/emacs/search.texi	2013-05-08 20:52:42 +0000
@@ -175,7 +175,7 @@ (@pxref{Faces}).  The current search str
 
 @kindex M-e @r{(Incremental search)}
   To edit the current search string in the minibuffer without
-replacing it with items from the search ring, type @kbd{M-e}.  Type
+replacing it with items from the search ring, type @kbd{M-e}.  Type @key{RET},
 @kbd{C-s} or @kbd{C-r} to finish editing the string and search for it.
 
 @node Error in Isearch