unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Shukaev <emacs@Alexander.Shukaev.name>
To: 25187@debbugs.gnu.org
Subject: bug#25187: Initialization of `shell-mode-map' is not safe
Date: Tue, 13 Dec 2016 00:08:07 +0100	[thread overview]
Message-ID: <49c53840-659f-5e60-a1d9-161a7e1d8004@Alexander.Shukaev.name> (raw)

Hi,

consider

(defvar shell-mode-map
   (let ((map (nconc (make-sparse-keymap) comint-mode-map)))
     (define-key map "\C-c\C-f" 'shell-forward-command)
     (define-key map "\C-c\C-b" 'shell-backward-command)
     (define-key map "\t" 'completion-at-point)
     (define-key map (kbd "M-RET") 'shell-resync-dirs)
     (define-key map "\M-?" 'comint-dynamic-list-filename-completions)
     (define-key map [menu-bar completion]
       (cons "Complete"
	    (copy-keymap (lookup-key comint-mode-map [menu-bar completion]))))
     (define-key-after (lookup-key map [menu-bar completion])
       [complete-env-variable] '("Complete Env. Variable Name" .
				shell-dynamic-complete-environment-variable)
       'complete-file)
     (define-key-after (lookup-key map [menu-bar completion])
       [expand-directory] '("Expand Directory Reference" .
			   shell-replace-by-expanded-directory)
       'complete-expand)
     map))

from 'shell.el'.  When somebody decides to customize `comint-mode-map' 
by, for example, first wiping it out and then filling it again,

(with-eval-after-load 'comint	
   ;; Wipe `comint-mode-map':
   (setcdr comint-mode-map nil)
   ;; Fill `comint-mode-map':
   ...)

then when the `shell' feature is loaded, it will inevitably fail because 
`(lookup-key comint-mode-map [menu-bar completion])' may no longer 
return a keymap but rather nil or a number.

Looking forward for fix.

Regards,
Alexander





             reply	other threads:[~2016-12-12 23:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 23:08 Alexander Shukaev [this message]
2019-10-09  7:24 ` bug#25187: Initialization of `shell-mode-map' is not safe Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49c53840-659f-5e60-a1d9-161a7e1d8004@Alexander.Shukaev.name \
    --to=emacs@alexander.shukaev.name \
    --cc=25187@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).