🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87952

completing program name in M-x gdb puts spurious messages in minibuffer

#87952
From: Jonathan I. Kamens
Date: Wed, 17 Aug 1994 15:37
163 lines
7932 bytes
In GNU Emacs 19.25.3 of Sun Aug 14 1994 on gza-client1 (sparc-sun-sunos4.1.3)

	When you run M-x gdb and try to complete the program name, it
puts "Completed" and "Partially completed" messages in the minibuffer
for a few seconds every time you hit tab.

	These messages should go away.  Completing in the minibuffer
should not cause other messages in the minibuffer.

	It appears that these messages are caused by the fact that M-x
gdb was converted to use comint, and the comint file-completion
function is being used to do the completion on the program name;
unfortunately, it isn't smart enough to realize that it's completing a
file name in the minibuffer and therefore shouldn't display messages
in the minibuffer.

	I came up with a fix that appears to work, but I'm not
convinced it's the correct one.  If it is, take it and run with it
:-).  Here's a ChangeLog entry and a patch:

Wed Aug 17 11:34:11 1994  Jonathan I. Kamens  (jik@cam.ov.com)

	* comint.el (comint-message-inactive-minibuffer): new function to
	display a message in the minibuffer only if the minibuffer is
	currently inactive.

	(comint-dynamic-complete-filename,
	comint-dynamic-complete-as-filename,
	comint-dynamic-list-filename-completions,
	comint-dynamic-list-completions): Use
	coming-message-inactive-minibuffer to display messages.

*** comint.el	1994/08/17 15:27:29	1.1
--- comint.el	1994/08/17 15:30:04
***************
*** 1820,1825 ****
--- 1820,1828 ----
      (while (and functions (null (funcall (car functions))))
        (setq functions (cdr functions)))))
  
+ (defun comint-message-inactive-minibuffer (&rest args)
+   (if (not (minibuffer-window-active-p (minibuffer-window)))
+       (apply 'message args)))
  
  (defun comint-dynamic-complete-filename ()
    "Dynamically complete the filename at point.
***************
*** 1837,1843 ****
  Returns t if successful."
    (interactive)
    (if (comint-match-partial-filename)
!       (prog2 (message "Completing file name...")
  	  (comint-dynamic-complete-as-filename))))
  
  
--- 1840,1846 ----
  Returns t if successful."
    (interactive)
    (if (comint-match-partial-filename)
!       (prog2 (comint-message-inactive-minibuffer "Completing file name...")
  	  (comint-dynamic-complete-as-filename))))
  
  
***************
*** 1853,1863 ****
  	 (directory (if pathdir (comint-directory pathdir) default-directory))
  	 (completion (file-name-completion pathnondir directory)))
      (cond ((null completion)
!            (message "No completions of %s" filename)
  	   (setq success nil))
            ((eq completion t)            ; Means already completed "file".
             (if comint-completion-addsuffix (insert " "))
!            (message "Sole completion"))
            ((string-equal completion "") ; Means completion on "directory/".
             (comint-dynamic-list-filename-completions))
            (t                            ; Completion string returned.
--- 1856,1866 ----
  	 (directory (if pathdir (comint-directory pathdir) default-directory))
  	 (completion (file-name-completion pathnondir directory)))
      (cond ((null completion)
!            (comint-message-inactive-minibuffer "No completions of %s" filename)
  	   (setq success nil))
            ((eq completion t)            ; Means already completed "file".
             (if comint-completion-addsuffix (insert " "))
!            (comint-message-inactive-minibuffer "Sole completion"))
            ((string-equal completion "") ; Means completion on "directory/".
             (comint-dynamic-list-filename-completions))
            (t                            ; Completion string returned.
***************
*** 1868,1886 ****
                      ;; We inserted a unique completion.
                      (if comint-completion-addsuffix
                          (insert (if (file-directory-p file) "/" " ")))
!                     (message "Completed"))
                     ((and comint-completion-recexact comint-completion-addsuffix
                           (string-equal pathnondir completion)
                           (file-exists-p file))
                      ;; It's not unique, but user wants shortest match.
                      (insert (if (file-directory-p file) "/" " "))
!                     (message "Completed shortest"))
                     ((or comint-completion-autolist
                          (string-equal pathnondir completion))
                      ;; It's not unique, list possible completions.
                      (comint-dynamic-list-filename-completions))
                     (t
!                     (message "Partially completed"))))))
      success))
  
  
--- 1871,1889 ----
                      ;; We inserted a unique completion.
                      (if comint-completion-addsuffix
                          (insert (if (file-directory-p file) "/" " ")))
!                     (comint-message-inactive-minibuffer "Completed"))
                     ((and comint-completion-recexact comint-completion-addsuffix
                           (string-equal pathnondir completion)
                           (file-exists-p file))
                      ;; It's not unique, but user wants shortest match.
                      (insert (if (file-directory-p file) "/" " "))
!                     (comint-message-inactive-minibuffer "Completed shortest"))
                     ((or comint-completion-autolist
                          (string-equal pathnondir completion))
                      ;; It's not unique, list possible completions.
                      (comint-dynamic-list-filename-completions))
                     (t
!                     (comint-message-inactive-minibuffer "Partially completed"))))))
      success))
  
  
***************
*** 1956,1962 ****
  	 (completions (file-name-all-completions pathnondir directory)))
      (if completions
  	(comint-dynamic-list-completions completions)
!       (message "No completions of %s" filename))))
  
  
  (defun comint-dynamic-list-completions (completions)
--- 1959,1965 ----
  	 (completions (file-name-all-completions pathnondir directory)))
      (if completions
  	(comint-dynamic-list-completions completions)
!       (comint-message-inactive-minibuffer "No completions of %s" filename))))
  
  
  (defun comint-dynamic-list-completions (completions)
***************
*** 1965,1971 ****
    (let ((conf (current-window-configuration)))
      (with-output-to-temp-buffer " *Completions*"
        (display-completion-list (sort completions 'string-lessp)))
!     (message "Hit space to flush")
      (let (key first)
        (if (save-excursion
  	    (set-buffer (get-buffer " *Completions*"))
--- 1968,1974 ----
    (let ((conf (current-window-configuration)))
      (with-output-to-temp-buffer " *Completions*"
        (display-completion-list (sort completions 'string-lessp)))
!     (comint-message-inactive-minibuffer "Hit space to flush")
      (let (key first)
        (if (save-excursion
  	    (set-buffer (get-buffer " *Completions*"))
Technical Details
Message-ID: <199408171536.LAA15501@gza-client1.aktis.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!CS.Arizona.EDU!math.arizona.edu!news.Arizona.EDU!news.Cerritos.edu!nic-nac.CSU.net!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cam.ov.COM!jik

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,3ffd6e2dcd3e4916,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-08-17 10:37:33 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!CS.Arizona.EDU!math.arizona.edu!news.Arizona.EDU!news.Cerritos.edu!nic-nac.CSU.net!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cam.ov.COM!jik
From: jik@cam.ov.COM (Jonathan I. Kamens)
Newsgroups: gnu.emacs.bug
Subject: completing program name in M-x gdb puts spurious messages in minibuffer
Date: 17 Aug 1994 11:37:11 -0400
Organization: GNUs Not Usenet
Lines: 163
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <199408171536.LAA15501@gza-client1.aktis.com>