[Top][All Lists]

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

bug#13223: patch to fix this bug

From: Juri Linkov
Subject: bug#13223: patch to fix this bug
Date: Mon, 29 Apr 2013 09:45:34 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>       * comint.el (comint-history-isearch-in-progress): new variable
>       that lets us detect that an isearch is running over command
>       history

I wonder why you didn't use the existing variable `isearch-mode'
to detect that an isearch is running?  There should be no problem
using `isearch-mode' as you can see in the patch below.

Additionally it will display only the current history item where
isearch actually matches, i.e. to display just one "History item"
message per one M-r isearch match.  This is necessary to inform the user
about the current history index as the commands `M-p' (comint-previous-input)
and `M-n' (comint-next-input) already do:

=== modified file 'lisp/comint.el'
--- lisp/comint.el      2013-04-27 23:07:46 +0000
+++ lisp/comint.el      2013-04-29 06:44:43 +0000
@@ -1191,7 +1191,8 @@ (defun comint-previous-matching-input (r
          (setq comint-stored-incomplete-input
                (funcall comint-get-old-input)))
       (setq comint-input-ring-index pos)
-      (message "History item: %d" (1+ pos))
+      (unless isearch-mode
+       (message "History item: %d" (1+ pos)))
       (insert (ring-ref comint-input-ring pos)))))
@@ -1540,8 +1541,11 @@ (defun comint-history-isearch-message (&
       (overlay-put comint-history-isearch-message-overlay 'evaporate t))
     (overlay-put comint-history-isearch-message-overlay
                 'display (isearch-message-prefix c-q-hack ellipsis))
-    ;; And clear any previous isearch message.
-    (message "")))
+    (if (and comint-input-ring-index (not ellipsis))
+       ;; Display the current history index.
+       (message "History item: %d" (1+ comint-input-ring-index))
+      ;; Or clear a previous isearch message.
+      (message ""))))
 (defun comint-history-isearch-wrap ()
   "Wrap the input history search when search fails.

reply via email to

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