Article View: gnu.emacs.bug
Article #8767919.26 shell.el BUG (running comint-mode-hook much too late) + PATCH
From: Martin Maechler
Date: Fri, 09 Sep 1994 12:01
Date: Fri, 09 Sep 1994 12:01
95 lines
4414 bytes
4414 bytes
In 19.26 [probably earlier too], there is a BUG in shell.el
which makes that comint-mode-hook is run too late for
keymap definitions.
Here is what happens when a user uses "M-x shell <RET>":
M-x shell
--> autoload shell.el
--> require comint ; NOT running comint-mode,
i.e., NOT running comint-mode-hooks !
but defining comint-mode-map
--> defining shell-mode-map (cond "not defined already")
--> by making a copy of comint-mode-map
BEFORE comint-mode-hooks have been run !
--> executing (shell)
--> executing (shell-mode)
--> executing (comint-mode)
--> running 'comint-mode-hooks [only now !]
The following PATCH just moves the definition of the shell-mode-map
variable from outside to inside the function (shell-mode).
Note that the following 4 files contain a (require 'shell):
kermit.el
rlogin.el
telnet.el
tex-mode.el
I did not test if these modes are happy with shell-mode-map
only being defined when (shell-mode) is run,
but this way, it is ensured that comint-mode-map is only used
after comint-mode-hook has been run.
IF there is a better patch to this problem, PLEASE LET ME KNOW !
--
Martin Maechler <maechler@stat.math.ethz.ch> <>< _
Seminar fuer Statistik, SOL F5 _| |_
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND |_ _|
phone: x-41-1-632-3408 fax: ...-1086 |_|
*** shell.el.~1~ Sun Sep 4 01:04:13 1994
--- shell.el Fri Sep 9 13:38:19 1994
***************
*** 251,271 ****
"Command used by `shell-resync-dir' to query the shell.")
(defvar shell-mode-map nil)
- (cond ((not shell-mode-map)
- (setq shell-mode-map (copy-keymap comint-mode-map))
- (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command)
- (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command)
- (define-key shell-mode-map "\t" 'comint-dynamic-complete)
- (define-key shell-mode-map "\M-?"
- 'comint-dynamic-list-filename-completions)
- (define-key-after (lookup-key shell-mode-map [menu-bar completion])
- [complete-env-variable] '("Complete Env. Variable Name" .
- shell-dynamic-complete-environment-variable)
- 'complete-file)
- (define-key-after (lookup-key shell-mode-map [menu-bar completion])
- [expand-directory] '("Expand Directory Reference" .
- shell-replace-by-expanded-directory)
- 'complete-expand)))
(defvar shell-mode-hook '()
"*Hook for customising Shell mode.")
--- 251,256 ----
***************
*** 323,328 ****
--- 308,329 ----
(comint-mode)
(setq major-mode 'shell-mode)
(setq mode-name "Shell")
+ (cond ((not shell-mode-map)
+ (setq shell-mode-map (copy-keymap comint-mode-map))
+ (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command)
+ (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command)
+ (define-key shell-mode-map "\t" 'comint-dynamic-complete)
+ (define-key shell-mode-map "\M-?"
+ 'comint-dynamic-list-filename-completions)
+ (define-key-after (lookup-key shell-mode-map [menu-bar completion])
+ [complete-env-variable]
+ '("Complete Env. Variable Name" .
+ shell-dynamic-complete-environment-variable)
+ 'complete-file)
+ (define-key-after (lookup-key shell-mode-map [menu-bar completion])
+ [expand-directory] '("Expand Directory Reference" .
+ shell-replace-by-expanded-directory)
+ 'complete-expand)))
(use-local-map shell-mode-map)
(setq comint-prompt-regexp shell-prompt-pattern)
(setq comint-completion-fignore shell-completion-fignore)
Technical Details
Message-ID:
<199409091159.NAA12367@ingrid.ethz.ch>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!stat.math.ethz.CH!maechlerShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,22bf1b991d21c3dc,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-09-10 02:42:33 PST Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!stat.math.ethz.CH!maechler From: maechler@stat.math.ethz.CH (Martin Maechler) Newsgroups: gnu.emacs.bug Subject: 19.26 shell.el BUG (running comint-mode-hook much too late) + PATCH Date: 9 Sep 1994 08:01:22 -0400 Organization: GNUs Not Usenet Lines: 95 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <199409091159.NAA12367@ingrid.ethz.ch> Reply-To: Martin Maechler <maechler@stat.math.ethz.ch>