unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13223: 24.2; comint history rendered useless by messages
@ 2012-12-19  6:39 Tim Daly Jr.
  2013-04-28 22:27 ` bug#13223: patch to fix this bug Tim Daly Jr.
  2013-04-28 23:13 ` bug#13223: resending the patch as text/plain Tim Daly Jr.
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Daly Jr. @ 2012-12-19  6:39 UTC (permalink / raw)
  To: 13223


I always have to comment out the line (1194 in my copy) in comint.el
that does this:

(message "History item: %d" (1+ pos))

because it makes M-r in shell mode too slow to use.  You hit M-r and
type something and it just spams the heck out of you and goes nowhere.


In GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2012-08-27 on bob.porkrind.org
Windowing system distributor `Apple', version 10.3.1138
Configured using:
 `configure '--host=x86_64-apple-darwin' '--build=i686-apple-darwin'
 '--with-ns' 'build_alias=i686-apple-darwin'
 'host_alias=x86_64-apple-darwin' 'CC=gcc -mmacosx-version-min=10.5''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
T h e SPC i n d e <backspace> <backspace> t e n d e 
d SPC e f f e c t SPC i s SPC j u s t SPC t o SPC k 
i l l SPC t h e SPC f o r e g r o u n d SPC p r o c 
e s s SPC o n SPC t h e SPC r e o <backspace> m o <backspace> 
o t e SPC h o s t . C-n C-p C-f C-SPC C-M-f C-M-f M-f 
M-f M-f C-f C-f C-w C-p M-b M-b C-y SPC M-q C-n C-n 
C-e C-n M-< C-e M-b M-b M-b M-b M-b C-SPC C-e C-b C-w 
y a h o o - M-b M-b C-SPC C-e C-b C-w t i m @ t e n 
k a n . o r g C-n C-a C-n C-n C-v C-v M-> M-< C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-p C-c C-c y e s <return> 
m a i l SPC c l i e n t <return> C-SPC M-< C-x C-n 
C-n C-n C-g C-x 1 C-n C-n C-n C-n C-g C-SPC C-n C-p 
C-n C-n C-p C-p C-n C-w <return> C-n C-n C-n C-n C-n 
C-SPC C-p C-w C-p C-p C-p C-p C-p C-SPC M-> M-w M-< 
C-n M-f C-f C-f C-SPC C-e M-w C-n C-a M-f M-b C-SPC 
C-e M-w C-x k <return> y e s <return> C-x b c <backspace> 
c o m <tab> i <tab> <return> C-p C-p C-a M-f M-b C-b 
C-b C-f C-SPC C-e M-w M-x r e p o <tab> r <tab> C-g 
M-x r e p r o t - b u <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> o r t - b u g <tab> 
<return>

Recent messages:
Quit [2 times]
Mark set [3 times]
Saved text from "
If you ssh someplace in shell mode and "
Mark set [2 times]
Auto-saving...done
Mark set
Making completion list...
Mark set
Making completion list...
Quit

Load-path shadows:
None found.

Features:
(novice cus-edit cus-start cus-load wid-edit shadow sort gnus-util
mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
mule-util rect nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph
nxml-enc xmltok conf-mode newcomment derived cl byte-opt bytecomp
byte-compile cconv macroexp vc-dispatcher vc-svn jka-compr tabify man
assoc make-mode cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs vc-git help-mode view pcmpl-unix
dired-aux misearch multi-isearch sh-script executable dired shell
pcomplete warnings iswitchb compile comint regexp-opt ansi-color advice
help-fns advice-preload xcscope ring easymenu slime-autoloads edmacro
kmacro time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process ns multi-tty emacs)






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13223: patch to fix this bug
  2012-12-19  6:39 bug#13223: 24.2; comint history rendered useless by messages Tim Daly Jr.
@ 2013-04-28 22:27 ` Tim Daly Jr.
  2013-04-29  6:45   ` Juri Linkov
  2013-04-28 23:13 ` bug#13223: resending the patch as text/plain Tim Daly Jr.
  1 sibling, 1 reply; 5+ messages in thread
From: Tim Daly Jr. @ 2013-04-28 22:27 UTC (permalink / raw)
  To: 13223

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

This patch keeps emacs from printing the history messages when performing a history search in a comint buffer.  (For example, M-x shell RET M-r o).

Changelog:

2013-04-28  Tim Daly Jr.  <tim@tenkan.org>

	* comint.el (comint-history-isearch-in-progress): new variable
	that lets us detect that an isearch is running over command
	history
	(comint-previous-matching-input): don't print "History item: N"
	messages when called as part of an isearch over history, because
	it's too slow and spammy.
	(comint-history-isearch-setup, comint-history-isearch-end): toggle
	comint-history-isearch-in-progress to indicate search start and
	stop

Patch:


[-- Attachment #2: skip-isearch-history-msgs.patch --]
[-- Type: application/octet-stream, Size: 3496 bytes --]

=== modified file 'ChangeLog'
*** ChangeLog	2013-04-27 19:30:33 +0000
--- ChangeLog	2013-04-28 22:22:55 +0000
***************
*** 1,3 ****
--- 1,15 ----
+ 2013-04-28  Tim Daly Jr.  <tim@tenkan.org>
+ 
+ 	* comint.el (comint-history-isearch-in-progress): new variable
+ 	that lets us detect that an isearch is running over command
+ 	history
+ 	(comint-previous-matching-input): don't print "History item: N"
+ 	messages when called as part of an isearch over history, because
+ 	it's too slow and spammy.
+ 	(comint-history-isearch-setup, comint-history-isearch-end): toggle
+ 	comint-history-isearch-in-progress to indicate search start and
+ 	stop
+ 
  2013-04-27  Paul Eggert  <eggert@cs.ucla.edu>
  
  	Merge from gnulib, incorporating:

=== modified file 'lisp/comint.el'
*** lisp/comint.el	2013-04-21 03:13:04 +0000
--- lisp/comint.el	2013-04-28 22:01:31 +0000
*************** Moves relative to START, or `comint-inpu
*** 1175,1180 ****
--- 1175,1183 ----
  	(process-mark (get-buffer-process (current-buffer))))
     (point-max)))
  
+ (defvar comint-history-isearch-in-progress nil
+   "Indicates that a comint history search is currently running.")
+ 
  (defun comint-previous-matching-input (regexp n)
    "Search backwards through input history for match for REGEXP.
  \(Previous history elements are earlier commands.)
*************** If N is negative, find the next or Nth n
*** 1191,1197 ****
  	  (setq comint-stored-incomplete-input
  		(funcall comint-get-old-input)))
        (setq comint-input-ring-index pos)
!       (message "History item: %d" (1+ pos))
        (comint-delete-input)
        (insert (ring-ref comint-input-ring pos)))))
  
--- 1194,1201 ----
  	  (setq comint-stored-incomplete-input
  		(funcall comint-get-old-input)))
        (setq comint-input-ring-index pos)
!       (unless comint-history-isearch-in-progress
! 	(message "History item: %d" (1+ pos)))
        (comint-delete-input)
        (insert (ring-ref comint-input-ring pos)))))
  
*************** Intended to be added to `isearch-mode-ho
*** 1433,1439 ****
  	 'comint-history-isearch-wrap)
      (set (make-local-variable 'isearch-push-state-function)
  	 'comint-history-isearch-push-state)
!     (add-hook 'isearch-mode-end-hook 'comint-history-isearch-end nil t)))
  
  (defun comint-history-isearch-end ()
    "Clean up the comint after terminating Isearch in comint."
--- 1437,1444 ----
  	 'comint-history-isearch-wrap)
      (set (make-local-variable 'isearch-push-state-function)
  	 'comint-history-isearch-push-state)
!     (add-hook 'isearch-mode-end-hook 'comint-history-isearch-end nil t)
!     (setq comint-history-isearch-in-progress t)))
  
  (defun comint-history-isearch-end ()
    "Clean up the comint after terminating Isearch in comint."
*************** Intended to be added to `isearch-mode-ho
*** 1444,1450 ****
    (setq isearch-message-function nil)
    (setq isearch-wrap-function nil)
    (setq isearch-push-state-function nil)
!   (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t))
  
  (defun comint-goto-input (pos)
    "Put input history item of the absolute history position POS."
--- 1449,1456 ----
    (setq isearch-message-function nil)
    (setq isearch-wrap-function nil)
    (setq isearch-push-state-function nil)
!   (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t)
!   (setq comint-history-isearch-in-progress nil))
  
  (defun comint-goto-input (pos)
    "Put input history item of the absolute history position POS."


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13223: resending the patch as text/plain...
  2012-12-19  6:39 bug#13223: 24.2; comint history rendered useless by messages Tim Daly Jr.
  2013-04-28 22:27 ` bug#13223: patch to fix this bug Tim Daly Jr.
@ 2013-04-28 23:13 ` Tim Daly Jr.
  1 sibling, 0 replies; 5+ messages in thread
From: Tim Daly Jr. @ 2013-04-28 23:13 UTC (permalink / raw)
  To: 13223

[-- Attachment #1: skip-isearch-history-msgs.patch.txt --]
[-- Type: text/plain, Size: 3496 bytes --]

=== modified file 'ChangeLog'
*** ChangeLog	2013-04-27 19:30:33 +0000
--- ChangeLog	2013-04-28 22:22:55 +0000
***************
*** 1,3 ****
--- 1,15 ----
+ 2013-04-28  Tim Daly Jr.  <tim@tenkan.org>
+ 
+ 	* comint.el (comint-history-isearch-in-progress): new variable
+ 	that lets us detect that an isearch is running over command
+ 	history
+ 	(comint-previous-matching-input): don't print "History item: N"
+ 	messages when called as part of an isearch over history, because
+ 	it's too slow and spammy.
+ 	(comint-history-isearch-setup, comint-history-isearch-end): toggle
+ 	comint-history-isearch-in-progress to indicate search start and
+ 	stop
+ 
  2013-04-27  Paul Eggert  <eggert@cs.ucla.edu>
  
  	Merge from gnulib, incorporating:

=== modified file 'lisp/comint.el'
*** lisp/comint.el	2013-04-21 03:13:04 +0000
--- lisp/comint.el	2013-04-28 22:01:31 +0000
*************** Moves relative to START, or `comint-inpu
*** 1175,1180 ****
--- 1175,1183 ----
  	(process-mark (get-buffer-process (current-buffer))))
     (point-max)))
  
+ (defvar comint-history-isearch-in-progress nil
+   "Indicates that a comint history search is currently running.")
+ 
  (defun comint-previous-matching-input (regexp n)
    "Search backwards through input history for match for REGEXP.
  \(Previous history elements are earlier commands.)
*************** If N is negative, find the next or Nth n
*** 1191,1197 ****
  	  (setq comint-stored-incomplete-input
  		(funcall comint-get-old-input)))
        (setq comint-input-ring-index pos)
!       (message "History item: %d" (1+ pos))
        (comint-delete-input)
        (insert (ring-ref comint-input-ring pos)))))
  
--- 1194,1201 ----
  	  (setq comint-stored-incomplete-input
  		(funcall comint-get-old-input)))
        (setq comint-input-ring-index pos)
!       (unless comint-history-isearch-in-progress
! 	(message "History item: %d" (1+ pos)))
        (comint-delete-input)
        (insert (ring-ref comint-input-ring pos)))))
  
*************** Intended to be added to `isearch-mode-ho
*** 1433,1439 ****
  	 'comint-history-isearch-wrap)
      (set (make-local-variable 'isearch-push-state-function)
  	 'comint-history-isearch-push-state)
!     (add-hook 'isearch-mode-end-hook 'comint-history-isearch-end nil t)))
  
  (defun comint-history-isearch-end ()
    "Clean up the comint after terminating Isearch in comint."
--- 1437,1444 ----
  	 'comint-history-isearch-wrap)
      (set (make-local-variable 'isearch-push-state-function)
  	 'comint-history-isearch-push-state)
!     (add-hook 'isearch-mode-end-hook 'comint-history-isearch-end nil t)
!     (setq comint-history-isearch-in-progress t)))
  
  (defun comint-history-isearch-end ()
    "Clean up the comint after terminating Isearch in comint."
*************** Intended to be added to `isearch-mode-ho
*** 1444,1450 ****
    (setq isearch-message-function nil)
    (setq isearch-wrap-function nil)
    (setq isearch-push-state-function nil)
!   (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t))
  
  (defun comint-goto-input (pos)
    "Put input history item of the absolute history position POS."
--- 1449,1456 ----
    (setq isearch-message-function nil)
    (setq isearch-wrap-function nil)
    (setq isearch-push-state-function nil)
!   (remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t)
!   (setq comint-history-isearch-in-progress nil))
  
  (defun comint-goto-input (pos)
    "Put input history item of the absolute history position POS."


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13223: patch to fix this bug
  2013-04-28 22:27 ` bug#13223: patch to fix this bug Tim Daly Jr.
@ 2013-04-29  6:45   ` Juri Linkov
  2013-05-01  1:35     ` Tim Daly Jr.
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2013-04-29  6:45 UTC (permalink / raw)
  To: Tim Daly Jr.; +Cc: 13223

> 	* 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)))
       (comint-delete-input)
       (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.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13223: patch to fix this bug
  2013-04-29  6:45   ` Juri Linkov
@ 2013-05-01  1:35     ` Tim Daly Jr.
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Daly Jr. @ 2013-05-01  1:35 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 13223


On Apr 28, 2013, at 11:45 PM, Juri Linkov wrote:

>> 	* 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:

quite right, your patch looks much better. :)


-tim






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-01  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19  6:39 bug#13223: 24.2; comint history rendered useless by messages Tim Daly Jr.
2013-04-28 22:27 ` bug#13223: patch to fix this bug Tim Daly Jr.
2013-04-29  6:45   ` Juri Linkov
2013-05-01  1:35     ` Tim Daly Jr.
2013-04-28 23:13 ` bug#13223: resending the patch as text/plain Tim Daly Jr.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).