GNU bug report logs - #22792
25.0.91; eshell-mode-map declaration

Previous Next

Package: emacs;

Reported by: Manuel Uberti - Boccaperta <manuel <at> boccaperta.com>

Date: Wed, 24 Feb 2016 15:07:01 UTC

Severity: minor

Tags: fixed, patch

Merged with 33808

Found in version 25.0.91

Fixed in version 28.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22792 in the body.
You can then email your comments to 22792 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Wed, 24 Feb 2016 15:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Manuel Uberti - Boccaperta <manuel <at> boccaperta.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 24 Feb 2016 15:07:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Manuel Uberti - Boccaperta <manuel <at> boccaperta.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.91; eshell-mode-map declaration
Date: Wed, 24 Feb 2016 16:05:55 +0100
As of now, `eshell-mode-map' in esh-mode.el is declared as:

(defvar eshell-mode-map nil)

As indicated here:
https://github.com/manuel-uberti/.emacs.d/commit/d44051ef417aee2086ba05e5a514e0ce6c401ca7#commitcomment-16298777,
this makes it impossibile to define a keybinding for eshell-mode-map
before eshell is loaded.

A solution could be:

(defvar eshell-mode-map (make-sparse-keymap))

Kind regards,
Manuel Uberti



In GNU Emacs 25.0.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
 of 2016-02-24 built on snoop
Repository revision: cab3f0a222412b1fd592b1c2f1e305fa245f9279
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.3 (jessie)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: en_GB.utf8
  value of $LC_NUMERIC: en_GB.utf8
  value of $LC_TIME: en_GB.utf8
  value of $LANG: en_GB.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  async-bytecomp-package-mode: t
  company-quickhelp-mode: t
  company-statistics-mode: t
  global-company-mode: t
  company-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  imagex-auto-adjust-mode: t
  imagex-global-sticky-mode: t
  imagex-sticky-mode: t
  pdf-occur-global-minor-mode: t
  recentf-mode: t
  auto-insert-mode: t
  highlight-symbol-nav-mode: t
  highlight-symbol-mode: t
  highlight-numbers-mode: t
  rainbow-delimiters-mode: t
  whitespace-cleanup-mode: t
  outline-minor-mode: t
  goto-address-prog-mode: t
  bug-reference-prog-mode: t
  projectile-global-mode: t
  projectile-mode: t
  tdd-mode: t
  shell-dirtrack-mode: t
  TeX-PDF-mode: t
  TeX-source-correlate-mode: t
  elisp-slime-nav-mode: t
  winner-mode: t
  global-hungry-delete-mode: t
  hungry-delete-mode: t
  typo-global-mode: t
  global-auto-revert-mode: t
  super-save-mode: t
  save-place-mode: t
  global-aggressive-indent-mode: t
  aggressive-indent-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  ivy-mode: t
  delete-selection-mode: t
  eldoc-in-minibuffer-mode: t
  beacon-mode: t
  whitespace-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  diff-auto-refine-mode: t
  show-paren-mode: t
  which-key-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-global-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Tramp: Found remote shell prompt on ‘localhost’
Tramp: Opening connection for root <at> localhost using sudo...done
Copying
/sudo:root <at> localhost:/usr/local/share/emacs/25.0.91/lisp/eshell/esh-mode.el.gz
to /tmp/tramp.78547fW.gz...done
uncompressing esh-mode.el.gz...done

Tramp: Checking ‘vc-registered’ for
/sudo:root <at> localhost:/usr/local/share/emacs/25.0.91/lisp/eshell/esh-mode.el.gz...done
uncompressing esh-mode.el.gz...done

Tramp: Checking ‘vc-registered’ for
/sudo:root <at> localhost:/usr/local/share/emacs/25.0.91/lisp/eshell/esh-mode.el.gz...done
uncompressing esh-mode.el.gz...done

Load-path shadows:
/home/manuel/.emacs.d/elpa/org-20160222/org-mobile hides
/usr/local/share/emacs/25.0.91/lisp/org/org-mobile
/home/manuel/.emacs.d/elpa/org-20160222/ob-calc hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-calc
/home/manuel/.emacs.d/elpa/org-20160222/org-table hides
/usr/local/share/emacs/25.0.91/lisp/org/org-table
/home/manuel/.emacs.d/elpa/org-20160222/ob-java hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-java
/home/manuel/.emacs.d/elpa/org-20160222/org-crypt hides
/usr/local/share/emacs/25.0.91/lisp/org/org-crypt
/home/manuel/.emacs.d/elpa/org-20160222/org-archive hides
/usr/local/share/emacs/25.0.91/lisp/org/org-archive
/home/manuel/.emacs.d/elpa/org-20160222/org-macro hides
/usr/local/share/emacs/25.0.91/lisp/org/org-macro
/home/manuel/.emacs.d/elpa/org-20160222/ob-lisp hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-lisp
/home/manuel/.emacs.d/elpa/org-20160222/org-pcomplete hides
/usr/local/share/emacs/25.0.91/lisp/org/org-pcomplete
/home/manuel/.emacs.d/elpa/org-20160222/ob-comint hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-comint
/home/manuel/.emacs.d/elpa/org-20160222/org-mhe hides
/usr/local/share/emacs/25.0.91/lisp/org/org-mhe
/home/manuel/.emacs.d/elpa/org-20160222/ob-maxima hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-maxima
/home/manuel/.emacs.d/elpa/org-20160222/org-irc hides
/usr/local/share/emacs/25.0.91/lisp/org/org-irc
/home/manuel/.emacs.d/elpa/org-20160222/ox-md hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-md
/home/manuel/.emacs.d/elpa/org-20160222/ob-eval hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-eval
/home/manuel/.emacs.d/elpa/org-20160222/ob-lilypond hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-lilypond
/home/manuel/.emacs.d/elpa/org-20160222/ob-matlab hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-matlab
/home/manuel/.emacs.d/elpa/org-20160222/org-inlinetask hides
/usr/local/share/emacs/25.0.91/lisp/org/org-inlinetask
/home/manuel/.emacs.d/elpa/org-20160222/ob-asymptote hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-asymptote
/home/manuel/.emacs.d/elpa/org-20160222/org-habit hides
/usr/local/share/emacs/25.0.91/lisp/org/org-habit
/home/manuel/.emacs.d/elpa/org-20160222/org-agenda hides
/usr/local/share/emacs/25.0.91/lisp/org/org-agenda
/home/manuel/.emacs.d/elpa/org-20160222/ox-beamer hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-beamer
/home/manuel/.emacs.d/elpa/org-20160222/ob-latex hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-latex
/home/manuel/.emacs.d/elpa/org-20160222/ox-texinfo hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-texinfo
/home/manuel/.emacs.d/elpa/org-20160222/org-mouse hides
/usr/local/share/emacs/25.0.91/lisp/org/org-mouse
/home/manuel/.emacs.d/elpa/org-20160222/ob-lob hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-lob
/home/manuel/.emacs.d/elpa/org-20160222/ox hides
/usr/local/share/emacs/25.0.91/lisp/org/ox
/home/manuel/.emacs.d/elpa/org-20160222/ob-keys hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-keys
/home/manuel/.emacs.d/elpa/org-20160222/ob-gnuplot hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-gnuplot
/home/manuel/.emacs.d/elpa/org-20160222/ob-makefile hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-makefile
/home/manuel/.emacs.d/elpa/org-20160222/ob-table hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-table
/home/manuel/.emacs.d/elpa/org-20160222/ob-io hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-io
/home/manuel/.emacs.d/elpa/org-20160222/org-bibtex hides
/usr/local/share/emacs/25.0.91/lisp/org/org-bibtex
/home/manuel/.emacs.d/elpa/org-20160222/ob-fortran hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-fortran
/home/manuel/.emacs.d/elpa/org-20160222/org-entities hides
/usr/local/share/emacs/25.0.91/lisp/org/org-entities
/home/manuel/.emacs.d/elpa/org-20160222/ob-shen hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-shen
/home/manuel/.emacs.d/elpa/org-20160222/org-feed hides
/usr/local/share/emacs/25.0.91/lisp/org/org-feed
/home/manuel/.emacs.d/elpa/org-20160222/ob-R hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-R
/home/manuel/.emacs.d/elpa/org-20160222/org-colview hides
/usr/local/share/emacs/25.0.91/lisp/org/org-colview
/home/manuel/.emacs.d/elpa/org-20160222/ob hides
/usr/local/share/emacs/25.0.91/lisp/org/ob
/home/manuel/.emacs.d/elpa/org-20160222/org-plot hides
/usr/local/share/emacs/25.0.91/lisp/org/org-plot
/home/manuel/.emacs.d/elpa/org-20160222/ob-haskell hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-haskell
/home/manuel/.emacs.d/elpa/org-20160222/ob-mscgen hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-mscgen
/home/manuel/.emacs.d/elpa/org-20160222/ob-octave hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-octave
/home/manuel/.emacs.d/elpa/org-20160222/org-loaddefs hides
/usr/local/share/emacs/25.0.91/lisp/org/org-loaddefs
/home/manuel/.emacs.d/elpa/org-20160222/ob-emacs-lisp hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-emacs-lisp
/home/manuel/.emacs.d/elpa/org-20160222/ox-icalendar hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-icalendar
/home/manuel/.emacs.d/elpa/org-20160222/org-footnote hides
/usr/local/share/emacs/25.0.91/lisp/org/org-footnote
/home/manuel/.emacs.d/elpa/org-20160222/ob-ocaml hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-ocaml
/home/manuel/.emacs.d/elpa/org-20160222/org-compat hides
/usr/local/share/emacs/25.0.91/lisp/org/org-compat
/home/manuel/.emacs.d/elpa/org-20160222/ob-dot hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-dot
/home/manuel/.emacs.d/elpa/org-20160222/org-id hides
/usr/local/share/emacs/25.0.91/lisp/org/org-id
/home/manuel/.emacs.d/elpa/org-20160222/org-macs hides
/usr/local/share/emacs/25.0.91/lisp/org/org-macs
/home/manuel/.emacs.d/elpa/org-20160222/ob-awk hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-awk
/home/manuel/.emacs.d/elpa/org-20160222/ob-picolisp hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-picolisp
/home/manuel/.emacs.d/elpa/org-20160222/org-indent hides
/usr/local/share/emacs/25.0.91/lisp/org/org-indent
/home/manuel/.emacs.d/elpa/org-20160222/ox-publish hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-publish
/home/manuel/.emacs.d/elpa/org-20160222/org-protocol hides
/usr/local/share/emacs/25.0.91/lisp/org/org-protocol
/home/manuel/.emacs.d/elpa/org-20160222/ob-exp hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-exp
/home/manuel/.emacs.d/elpa/org-20160222/ox-ascii hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-ascii
/home/manuel/.emacs.d/elpa/org-20160222/ob-perl hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-perl
/home/manuel/.emacs.d/elpa/org-20160222/ob-plantuml hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-plantuml
/home/manuel/.emacs.d/elpa/org-20160222/ox-html hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-html
/home/manuel/.emacs.d/elpa/org-20160222/org-timer hides
/usr/local/share/emacs/25.0.91/lisp/org/org-timer
/home/manuel/.emacs.d/elpa/org-20160222/org-bbdb hides
/usr/local/share/emacs/25.0.91/lisp/org/org-bbdb
/home/manuel/.emacs.d/elpa/org-20160222/ob-clojure hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-clojure
/home/manuel/.emacs.d/elpa/org-20160222/org-faces hides
/usr/local/share/emacs/25.0.91/lisp/org/org-faces
/home/manuel/.emacs.d/elpa/org-20160222/org-list hides
/usr/local/share/emacs/25.0.91/lisp/org/org-list
/home/manuel/.emacs.d/elpa/org-20160222/org-src hides
/usr/local/share/emacs/25.0.91/lisp/org/org-src
/home/manuel/.emacs.d/elpa/org-20160222/ob-scheme hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-scheme
/home/manuel/.emacs.d/elpa/org-20160222/org-gnus hides
/usr/local/share/emacs/25.0.91/lisp/org/org-gnus
/home/manuel/.emacs.d/elpa/org-20160222/org-capture hides
/usr/local/share/emacs/25.0.91/lisp/org/org-capture
/home/manuel/.emacs.d/elpa/org-20160222/ob-css hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-css
/home/manuel/.emacs.d/elpa/org-20160222/ob-screen hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-screen
/home/manuel/.emacs.d/elpa/org-20160222/org-info hides
/usr/local/share/emacs/25.0.91/lisp/org/org-info
/home/manuel/.emacs.d/elpa/org-20160222/org-ctags hides
/usr/local/share/emacs/25.0.91/lisp/org/org-ctags
/home/manuel/.emacs.d/elpa/org-20160222/org-docview hides
/usr/local/share/emacs/25.0.91/lisp/org/org-docview
/home/manuel/.emacs.d/elpa/org-20160222/ob-sqlite hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-sqlite
/home/manuel/.emacs.d/elpa/org-20160222/org-datetree hides
/usr/local/share/emacs/25.0.91/lisp/org/org-datetree
/home/manuel/.emacs.d/elpa/org-20160222/ob-ref hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-ref
/home/manuel/.emacs.d/elpa/org-20160222/org-rmail hides
/usr/local/share/emacs/25.0.91/lisp/org/org-rmail
/home/manuel/.emacs.d/elpa/org-20160222/org-eshell hides
/usr/local/share/emacs/25.0.91/lisp/org/org-eshell
/home/manuel/.emacs.d/elpa/org-20160222/ox-man hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-man
/home/manuel/.emacs.d/elpa/org-20160222/ob-core hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-core
/home/manuel/.emacs.d/elpa/org-20160222/ob-ruby hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-ruby
/home/manuel/.emacs.d/elpa/org-20160222/org-attach hides
/usr/local/share/emacs/25.0.91/lisp/org/org-attach
/home/manuel/.emacs.d/elpa/org-20160222/ob-sass hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-sass
/home/manuel/.emacs.d/elpa/org-20160222/org-w3m hides
/usr/local/share/emacs/25.0.91/lisp/org/org-w3m
/home/manuel/.emacs.d/elpa/org-20160222/ob-org hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-org
/home/manuel/.emacs.d/elpa/org-20160222/ox-org hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-org
/home/manuel/.emacs.d/elpa/org-20160222/ob-ledger hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-ledger
/home/manuel/.emacs.d/elpa/org-20160222/org-version hides
/usr/local/share/emacs/25.0.91/lisp/org/org-version
/home/manuel/.emacs.d/elpa/org-20160222/ob-scala hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-scala
/home/manuel/.emacs.d/elpa/org-20160222/ob-python hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-python
/home/manuel/.emacs.d/elpa/org-20160222/org hides
/usr/local/share/emacs/25.0.91/lisp/org/org
/home/manuel/.emacs.d/elpa/org-20160222/ob-ditaa hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-ditaa
/home/manuel/.emacs.d/elpa/org-20160222/ox-odt hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-odt
/home/manuel/.emacs.d/elpa/org-20160222/ob-sql hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-sql
/home/manuel/.emacs.d/elpa/org-20160222/ox-latex hides
/usr/local/share/emacs/25.0.91/lisp/org/ox-latex
/home/manuel/.emacs.d/elpa/org-20160222/ob-C hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-C
/home/manuel/.emacs.d/elpa/org-20160222/org-element hides
/usr/local/share/emacs/25.0.91/lisp/org/org-element
/home/manuel/.emacs.d/elpa/org-20160222/org-clock hides
/usr/local/share/emacs/25.0.91/lisp/org/org-clock
/home/manuel/.emacs.d/elpa/org-20160222/org-install hides
/usr/local/share/emacs/25.0.91/lisp/org/org-install
/home/manuel/.emacs.d/elpa/org-20160222/ob-tangle hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-tangle
/home/manuel/.emacs.d/elpa/org-20160222/ob-js hides
/usr/local/share/emacs/25.0.91/lisp/org/ob-js

Features:
(shadow sort mail-extr emacsbug sendmail counsel swiper eieio-opt
speedbar sb-image ezimage dframe ace-window avy view cal-china lunar
solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs
diary-lib diary-loaddefs cal-iso org-agenda org-clock cal-move
parse-time descr-text vc-git linum org-indent adaptive-wrap org-rmail
org-mhe org-irc org-info org-gnus org-docview doc-view org-bibtex bibtex
org-bbdb org-w3m colir color company-web-html em-unix em-term term ehelp
em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl
em-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-ext
esh-proc esh-arg esh-groups pcomplete-extension pcmpl-unix pcmpl-gnu
eshell esh-module esh-mode esh-util mu-vers-control magit-rockstar
magit-blame magit-stash magit-bisect magit-remote magit-commit
magit-sequence magit magit-apply magit-wip magit-log magit-diff
smerge-mode git-commit log-edit message rfc822 mml mml-sec epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert magit-process with-editor server magit-popup
async-bytecomp async magit-mode magit-git magit-section magit-utils
mu-completion company-shell company-restclient restclient url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap know-your-http-well http-status-codes http-relations
http-methods http-headers sly-company company-auctex company-web
web-completion-data company-math math-symbol-lists company-quickhelp
pos-tip company-statistics company-oddmuse company-keywords
company-etags company-gtags company-dabbrev-code company-dabbrev
company-files company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-css company-nxml
company-bbdb company yasnippet mu-files image+ image-file pdf-occur
tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet find-dired dired
pdf-isearch let-alist pdf-misc tramp-cache tramp-sh recentf tree-widget
mu-dired mu-org ox-mediawiki s org-pdfview pdf-tools cus-edit cus-start
cus-load wid-edit pdf-view bookmark jka-compr pdf-cache pdf-info tq
pdf-util image-mode org-bullets ox-reveal ox-pandoc ht ox-org ox-latex
ox-icalendar ox-html ox-ascii ox-publish ox org-element avl-tree org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs autoinsert disp-table
highlight-symbol highlight-numbers parent-mode rainbow-delimiters
whitespace-cleanup-mode noutline outline goto-addr bug-reference
flycheck-cask mu-functions mu-shells mu-project projectile ibuf-ext
ibuffer mu-programming macrostep clojure-mode-extra-font-locking ert pp
debug flycheck-clojure json map cider-client cider-common cider-util
clojure-mode align imenu nrepl-client tramp tramp-compat tramp-loaddefs
trampver ucs-normalize shell pcomplete format-spec queue cider-compat
spinner flycheck-package lisp-mnt flycheck find-func subr-x mu-utilities
mu-net browse-url mu-latex auctex-latexmk smartparens-latex latex
tex-style tex-buf tex dbus xml crm mu-languages mu-search mu-navigation
elisp-slime-nav etags xref project winner mu-editing hungry-delete typo
dubcaps-mode autorevert filenotify super-save saveplace
aggressive-indent visual-fill-column undo-tree diff mu-ivy smex ido ivy
delsel ffap url-parse auth-source eieio eieio-core gnus-util mm-util
help-fns mail-prsvr password-cache url-vars mu-windows mu-buffers
eldoc-eval mu-highlight beacon seq whitespace hi-lock diff-hl vc-dir
ewoc vc vc-dispatcher diff-mode paren mu-keybindings which-key mu-pairs
smartparens-config smartparens thingatpt mu-style smart-mode-line
byte-opt rich-minority solarized-light-theme solarized page-break-lines
edmacro kmacro exec-path-from-shell rx grep compile comint ansi-color
ring dash use-package diminish bytecomp byte-compile cl-extra help-mode
cconv bind-key easy-mmode finder-inf tex-site cl-seq cl-macs cl gv
cl-loaddefs pcase cl-lib advice org2blog-autoloads
sly-macrostep-autoloads sly-autoloads info package easymenu epg-config
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 751091 66737)
 (symbols 48 72038 0)
 (miscs 40 513 1097)
 (strings 32 181314 56239)
 (string-bytes 1 5315387)
 (vectors 16 89058)
 (vector-slots 8 2003546 206844)
 (floats 8 1763 1321)
 (intervals 56 6925 636)
 (buffers 976 36)
 (heap 1024 90127 3866))

-- 
Manuel Uberti
http://informatica.boccaperta.com
P. IVA: 03841100245

I prefer to use encrypted email.
GPG fingerprint: 186F F867 975F B106 5EF3  1A58 D415 A33B 5D2D 5744




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Thu, 27 Jun 2019 15:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Alex Branham <alex.branham <at> gmail.com>
To: 22792 <at> debbugs.gnu.org
Subject: eshell-mode-map declaration
Date: Thu, 27 Jun 2019 10:45:14 -0500
I can work on this bug. Moving the (re)-definition of eshell-mode-map
out of eshell-mode is easy enough. The tricky part is that some of
eshell's modules (e.g. em-cmpl) use define-key in eshell-mode-map (or
eshell-command-map) too. This results in those keys getting redefined
each time eshell is invoked.

How do people want to handle that? We could create an em-cmpl minor mode
with its own keymap, I suppose. Would that be satisfactory?

Thanks,
Alex




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Thu, 27 Jun 2019 19:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: 22792 <at> debbugs.gnu.org
Subject: Re: bug#22792: eshell-mode-map declaration
Date: Thu, 27 Jun 2019 15:23:09 -0400
Alex Branham <alex.branham <at> gmail.com> writes:

> We could create an em-cmpl minor mode with its own keymap, I
> suppose. Would that be satisfactory?

Makes sense to me.




Merged 22792 33808. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 19:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Fri, 28 Jun 2019 18:15:02 GMT) Full text and rfc822 format available.

Message #16 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Alex Branham <alex.branham <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: control <at> debbugs.gnu.org, 22792 <at> debbugs.gnu.org
Subject: Re: bug#22792: eshell-mode-map declaration
Date: Fri, 28 Jun 2019 13:14:20 -0500
[Message part 1 (text/plain, inline)]
tags 22792 patch
quit

On Thu 27 Jun 2019 at 14:23, Noam Postavsky <npostavs <at> gmail.com> wrote:

> Alex Branham <alex.branham <at> gmail.com> writes:
>
>> We could create an em-cmpl minor mode with its own keymap, I
>> suppose. Would that be satisfactory?
>
> Makes sense to me.

OK, here's a patch that does so. The general idea is to make a minor
mode with its own keymap for each of eshell's modules that (previously)
assigned their keybindings into eshell-mode-map.

Alex

[0001-Fix-eshell-mode-map-initialization.patch (text/x-patch, inline)]
From 00e5ad69971e7f9abacf10d25325bdee6088f648 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham <at> gmail.com>
Date: Wed, 26 Jun 2019 13:59:06 -0500
Subject: [PATCH] Fix eshell-mode-map initialization

* lisp/eshell/esh-mode.el (eshell-mode-map):
(eshell-command-map): Set up normal keymaps and prefix commands rather
than re-initializing them in each eshell buffer

* lisp/eshell/em-cmpl.el (eshell-cmpl-mode-map):
(eshell-cmpl-mode):
(eshell-cmpl-initialize):
* lisp/eshell/em-hist.el (eshell-hist-mode-map):
(eshell-hist-mode):
(eshell-hist-initialize):
* lisp/eshell/em-pred.el (eshell-pred-mode-map):
(eshell-pred-mode):
(eshell-pred-initialize):
* lisp/eshell/em-prompt.el (eshell-prompt-mode-map):
(eshell-prompt-mode):
(eshell-prompt-initialize):
* lisp/eshell/em-rebind.el (eshell-rebind-mode-map):
(eshell-rebind-mode):
(eshell-rebind-initialize):
* lisp/eshell/esh-arg.el (eshell-arg-mode-map):
(eshell-arg-mode):
(eshell-arg-initialize):
* lisp/eshell/esh-proc.el (eshell-proc-mode-map):
(eshell-proc-mode):
(eshell-proc-initialize):
* lisp/eshell/esh-var.el (eshell-var-mode-map):
(eshell-var-mode):
(eshell-var-initialize): Create a new minor mode with a keymap and
call it in the module initialization function.

bug#33808
bug#22792
---
 etc/NEWS                 |  5 ++++
 lisp/eshell/em-cmpl.el   | 33 ++++++++++++----------
 lisp/eshell/em-hist.el   | 60 +++++++++++++++++++++-------------------
 lisp/eshell/em-pred.el   | 13 +++++++--
 lisp/eshell/em-prompt.el | 14 ++++++++--
 lisp/eshell/em-rebind.el | 11 +++++++-
 lisp/eshell/esh-arg.el   | 14 +++++++---
 lisp/eshell/esh-mode.el  | 58 +++++++++++++++++---------------------
 lisp/eshell/esh-proc.el  | 26 +++++++++--------
 lisp/eshell/esh-var.el   | 14 ++++++----
 10 files changed, 148 insertions(+), 100 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 864eb8c110..83fac26e3a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1237,6 +1237,11 @@ default, and not just the opening element.
 behave similarly, e.g. Pcomplete's default cycling can be obtained
 with '(setq completion-cycle-threshold 5)'.
 
+*** Eshell no longer re-initializes its keymap every call.
+This allows users to use (define-key eshell-mode-map ...) as usual.
+Some modules have their own minor mode now to account for these
+changes.
+
 ---
 *** Expansion of history event designators is disabled by default.
 To restore the old behavior, use
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 8f6c6781b9..952091a479 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -244,6 +244,24 @@ to writing a completion function."
   (let ((completion-at-point-functions '(lisp-completion-at-point)))
     (completion-at-point)))
 
+(defvar eshell-cmpl-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [(control ?i)] #'completion-at-point)
+    ;; jww (1999-10-19): Will this work on anything but X?
+    (define-key map [backtab] #'pcomplete-reverse)
+    (define-key map [(meta ??)] #'completion-help-at-point)
+    (define-key map [(meta control ?i)] #'eshell-complete-lisp-symbol)
+    ;; C-c prefix:
+    (define-key map (kbd "C-c M-h") #'eshell-completion-help)
+    (define-key map (kbd "C-c TAB") #'pcomplete-expand-and-complete)
+    (define-key map (kbd "C-c C-i") #'pcomplete-expand-and-complete)
+    (define-key map (kbd "C-c SPC") #'pcomplete-expand)
+    map))
+
+(define-minor-mode eshell-cmpl-mode
+  "Minor mode that provides a keymap when `eshell-cmpl' active."
+  :keymap eshell-cmpl-mode-map)
+
 (defun eshell-cmpl-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the completions module."
   (set (make-local-variable 'pcomplete-command-completion-function)
@@ -291,22 +309,9 @@ to writing a completion function."
 		    eshell-special-chars-outside-quoting)))
             nil t)
   (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t)
-  ;;(define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol) ; Redundant
-  (define-key eshell-mode-map [(meta control ?i)] 'eshell-complete-lisp-symbol)
-  (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help)
-  (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
-  (define-key eshell-command-map [(control ?i)]
-    'pcomplete-expand-and-complete)
-  (define-key eshell-command-map [space] 'pcomplete-expand)
-  (define-key eshell-command-map [? ] 'pcomplete-expand)
-  ;;(define-key eshell-mode-map [tab] 'completion-at-point) ;Redundant!
-  (define-key eshell-mode-map [(control ?i)] 'completion-at-point)
   (add-hook 'completion-at-point-functions
             #'pcomplete-completions-at-point nil t)
-  ;; jww (1999-10-19): Will this work on anything but X?
-  (define-key eshell-mode-map
-    (if (featurep 'xemacs) [iso-left-tab] [backtab]) 'pcomplete-reverse)
-  (define-key eshell-mode-map [(meta ??)] 'completion-help-at-point))
+  (eshell-cmpl-mode))
 
 (defun eshell-completion-command-name ()
   "Return the command name, possibly sans globbing."
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index adb028002b..19782e8d6c 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -202,6 +202,32 @@ element, regardless of any text on the command line.  In that case,
     map)
   "Keymap used in isearch in Eshell.")
 
+(defvar eshell-hist-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [up] #'eshell-previous-matching-input-from-input)
+    (define-key map [down] #'eshell-next-matching-input-from-input)
+    (define-key map [(control up)] #'eshell-previous-input)
+    (define-key map [(control down)] #'eshell-next-input)
+    (define-key map [(meta ?r)] #'eshell-previous-matching-input)
+    (define-key map [(meta ?s)] #'eshell-next-matching-input)
+    (define-key map (kbd "C-c M-r") #'eshell-previous-matching-input-from-input)
+    (define-key map (kbd "C-c M-s") #'eshell-next-matching-input-from-input)
+    ;; FIXME: Relies on `eshell-hist-match-partial' being set _before_
+    ;; em-hist is loaded and won't respect changes.
+    (if eshell-hist-match-partial
+	(progn
+	  (define-key map [(meta ?p)] 'eshell-previous-matching-input-from-input)
+	  (define-key map [(meta ?n)] 'eshell-next-matching-input-from-input)
+	  (define-key map (kbd "C-c M-p") #'eshell-previous-input)
+	  (define-key map (kbd "C-c M-n") #'eshell-next-input))
+      (define-key map [(meta ?p)] #'eshell-previous-input)
+      (define-key map [(meta ?n)] #'eshell-next-input)
+      (define-key map (kbd "C-c M-p") #'eshell-previous-matching-input-from-input)
+      (define-key map (kbd "C-c M-n") #'eshell-next-matching-input-from-input))
+    (define-key map (kbd "C-c C-l") #'eshell-list-history)
+    (define-key map (kbd "C-c C-x") #'eshell-get-next-from-history)
+    map))
+
 (defvar eshell-rebind-keys-alist)
 
 ;;; Functions:
@@ -216,6 +242,10 @@ Returns non-nil if INPUT is blank."
 Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (not (string-match-p "\\`\\s-+" input)))
 
+(define-minor-mode eshell-hist-mode
+  "Minor mode for the eshell-hist module."
+  :keymap eshell-hist-mode-map)
+
 (defun eshell-hist-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the history management code for one Eshell buffer."
   (when (eshell-using-module 'eshell-cmpl)
@@ -242,30 +272,7 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
 		   (lambda ()
 		     (setq overriding-terminal-local-map nil)))
                   nil t))
-    (define-key eshell-mode-map [up] 'eshell-previous-matching-input-from-input)
-    (define-key eshell-mode-map [down] 'eshell-next-matching-input-from-input)
-    (define-key eshell-mode-map [(control up)] 'eshell-previous-input)
-    (define-key eshell-mode-map [(control down)] 'eshell-next-input)
-    (define-key eshell-mode-map [(meta ?r)] 'eshell-previous-matching-input)
-    (define-key eshell-mode-map [(meta ?s)] 'eshell-next-matching-input)
-    (define-key eshell-command-map [(meta ?r)]
-      'eshell-previous-matching-input-from-input)
-    (define-key eshell-command-map [(meta ?s)]
-      'eshell-next-matching-input-from-input)
-    (if eshell-hist-match-partial
-	(progn
-	  (define-key eshell-mode-map [(meta ?p)]
-	    'eshell-previous-matching-input-from-input)
-	  (define-key eshell-mode-map [(meta ?n)]
-	    'eshell-next-matching-input-from-input)
-	  (define-key eshell-command-map [(meta ?p)] 'eshell-previous-input)
-	  (define-key eshell-command-map [(meta ?n)] 'eshell-next-input))
-      (define-key eshell-mode-map [(meta ?p)] 'eshell-previous-input)
-      (define-key eshell-mode-map [(meta ?n)] 'eshell-next-input)
-      (define-key eshell-command-map [(meta ?p)]
-	'eshell-previous-matching-input-from-input)
-      (define-key eshell-command-map [(meta ?n)]
-	'eshell-next-matching-input-from-input)))
+    (eshell-hist-mode))
 
   (make-local-variable 'eshell-history-size)
   (or eshell-history-size
@@ -300,10 +307,7 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (add-hook 'kill-emacs-hook #'eshell-save-some-history)
 
   (make-local-variable 'eshell-input-filter-functions)
-  (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t)
-
-  (define-key eshell-command-map [(control ?l)] 'eshell-list-history)
-  (define-key eshell-command-map [(control ?x)] 'eshell-get-next-from-history))
+  (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t))
 
 (defun eshell-save-some-history ()
   "Save the history for any open Eshell buffers."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 9bc856a296..1017e2b7c0 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -229,6 +229,12 @@ FOR LISTS OF ARGUMENTS:
 EXAMPLES:
   *.c(:o)  sorted list of .c files")
 
+(defvar eshell-pred-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-q") #'eshell-display-predicate-help)
+    (define-key map (kbd "C-c M-m") #'eshell-display-modifier-help)
+    map))
+
 ;;; Functions:
 
 (defun eshell-display-predicate-help ()
@@ -245,12 +251,15 @@ EXAMPLES:
     (lambda ()
       (insert eshell-modifier-help-string)))))
 
+(define-minor-mode eshell-pred-mode
+  "Minor mode for the eshell-pred module."
+  :keymap eshell-pred-mode-map)
+
 (defun eshell-pred-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the predicate/modifier code."
   (add-hook 'eshell-parse-argument-hook
 	    #'eshell-parse-arg-modifier t t)
-  (define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help)
-  (define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help))
+  (eshell-pred-mode))
 
 (defun eshell-apply-modifiers (lst predicates modifiers)
   "Apply to LIST a series of PREDICATES and MODIFIERS."
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index adc68b6c85..9c396ce627 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -97,8 +97,18 @@ arriving, or after."
   :options '(eshell-show-maximum-output)
   :group 'eshell-prompt)
 
+(defvar eshell-prompt-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c C-n") #'eshell-next-prompt)
+    (define-key map (kbd "C-c C-p") #'eshell-previous-prompt)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-prompt-mode
+  "Minor mode for eshell-prompt module."
+  :keymap eshell-prompt-mode-map)
+
 (defun eshell-prompt-initialize ()  ;Called from `eshell-mode' via intern-soft!
   "Initialize the prompting code."
   (unless eshell-non-interactive-p
@@ -110,9 +120,7 @@ arriving, or after."
 
     (set (make-local-variable 'eshell-skip-prompt-function)
 	 'eshell-skip-prompt)
-
-    (define-key eshell-command-map [(control ?n)] 'eshell-next-prompt)
-    (define-key eshell-command-map [(control ?p)] 'eshell-previous-prompt)))
+    (eshell-prompt-mode)))
 
 (defun eshell-emit-prompt ()
   "Emit a prompt if eshell is being used interactively."
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index a817edbcc9..318f13d244 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -137,6 +137,11 @@ This is default behavior of shells like bash."
   :type '(repeat function)
   :group 'eshell-rebind)
 
+(defvar eshell-rebind-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-l") #'eshell-lock-local-map)
+    map))
+
 ;; Internal Variables:
 
 (defvar eshell-input-keymap)
@@ -145,6 +150,10 @@ This is default behavior of shells like bash."
 
 ;;; Functions:
 
+(define-minor-mode eshell-rebind-mode
+  "Minor mode for the eshell-rebind module."
+  :keymap eshell-rebind-mode-map)
+
 (defun eshell-rebind-initialize ()  ;Called from `eshell-mode' via intern-soft!
   "Initialize the inputting code."
   (unless eshell-non-interactive-p
@@ -154,7 +163,7 @@ This is default behavior of shells like bash."
     (make-local-variable 'overriding-local-map)
     (add-hook 'post-command-hook 'eshell-rebind-input-map nil t)
     (set (make-local-variable 'eshell-lock-keymap) nil)
-    (define-key eshell-command-map [(meta ?l)] 'eshell-lock-local-map)))
+    (eshell-rebind-mode)))
 
 (defun eshell-lock-local-map (&optional arg)
   "Lock or unlock the current local keymap.
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 026edc5980..bd31703e0d 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -155,14 +155,20 @@ treated as a literal character."
   :type 'hook
   :group 'eshell-arg)
 
+(defvar eshell-arg-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-b") #'eshell-insert-buffer-name)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-arg-mode
+  "Minor mode for the arg eshell module."
+  :keymap eshell-arg-mode-map)
+
 (defun eshell-arg-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the argument parsing code."
-  ;; This is supposedly run after enabling esh-mode, when eshell-mode-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?b)] 'eshell-insert-buffer-name)
+  (eshell-arg-mode)
   (set (make-local-variable 'eshell-inside-quote-regexp) nil)
   (set (make-local-variable 'eshell-outside-quote-regexp) nil))
 
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 80844c3a64..91204877f5 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -213,10 +213,7 @@ This is used by `eshell-watch-for-password-prompt'."
 ;; these are only set to nil initially for the sake of the
 ;; byte-compiler, when compiling other files which `require' this one
 (defvar eshell-mode nil)
-(defvar eshell-mode-map nil)
 (defvar eshell-command-running-string "--")
-(defvar eshell-command-map nil)
-(defvar eshell-command-prefix nil)
 (defvar eshell-last-input-start nil)
 (defvar eshell-last-input-end nil)
 (defvar eshell-last-output-start nil)
@@ -286,6 +283,32 @@ This is used by `eshell-watch-for-password-prompt'."
      (standard-syntax-table))
     st))
 
+(defvar eshell-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [(control ?c)] 'eshell-command-map)
+    (define-key map "\r" #'eshell-send-input)
+    (define-key map "\M-\r" #'eshell-queue-input)
+    (define-key map [(meta control ?l)] #'eshell-show-output)
+    (define-key map [(control ?a)] #'eshell-bol)
+    map))
+
+(defvar eshell-command-map
+  (let ((map (define-prefix-command 'eshell-command-map)))
+    (define-key map [(meta ?o)] #'eshell-mark-output)
+    (define-key map [(meta ?d)] #'eshell-toggle-direct-send)
+    (define-key map [(control ?a)] #'eshell-bol)
+    (define-key map [(control ?b)] #'eshell-backward-argument)
+    (define-key map [(control ?e)] #'eshell-show-maximum-output)
+    (define-key map [(control ?f)] #'eshell-forward-argument)
+    (define-key map [(control ?m)] #'eshell-copy-old-input)
+    (define-key map [(control ?o)] #'eshell-kill-output)
+    (define-key map [(control ?r)] #'eshell-show-output)
+    (define-key map [(control ?t)] #'eshell-truncate-buffer)
+    (define-key map [(control ?u)] #'eshell-kill-input)
+    (define-key map [(control ?w)] #'backward-kill-word)
+    (define-key map [(control ?y)] #'eshell-repeat-argument)
+    map))
+
 ;;; User Functions:
 
 (defun eshell-kill-buffer-function ()
@@ -304,10 +327,6 @@ and the hook `eshell-exit-hook'."
   "Emacs shell interactive mode."
   (setq-local eshell-mode t)
 
-  ;; FIXME: What the hell!?
-  (setq-local eshell-mode-map (make-sparse-keymap))
-  (use-local-map eshell-mode-map)
-
   (when eshell-status-in-mode-line
     (make-local-variable 'eshell-command-running-string)
     (let ((fmt (copy-sequence mode-line-format)))
@@ -316,31 +335,6 @@ and the hook `eshell-exit-hook'."
       (if mode-line-elt
 	  (setcar mode-line-elt 'eshell-command-running-string))))
 
-  (define-key eshell-mode-map "\r" 'eshell-send-input)
-  (define-key eshell-mode-map "\M-\r" 'eshell-queue-input)
-  (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
-  (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
-
-  (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
-  (fset eshell-command-prefix (make-sparse-keymap))
-  (setq-local eshell-command-map (symbol-function eshell-command-prefix))
-  (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
-
-  (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output)
-  (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send)
-
-  (define-key eshell-command-map [(control ?a)] 'eshell-bol)
-  (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument)
-  (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output)
-  (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument)
-  (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input)
-  (define-key eshell-command-map [(control ?o)] 'eshell-kill-output)
-  (define-key eshell-command-map [(control ?r)] 'eshell-show-output)
-  (define-key eshell-command-map [(control ?t)] 'eshell-truncate-buffer)
-  (define-key eshell-command-map [(control ?u)] 'eshell-kill-input)
-  (define-key eshell-command-map [(control ?w)] 'backward-kill-word)
-  (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
-
   (setq local-abbrev-table eshell-mode-abbrev-table)
 
   (set (make-local-variable 'list-buffers-directory)
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 32a3eecb52..7825377e66 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -109,6 +109,16 @@ information, for example."
 (defvar eshell-process-list nil
   "A list of the current status of subprocesses.")
 
+(defvar eshell-proc-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-i") #'eshell-insert-process)
+    (define-key map (kbd "C-c C-c") #'eshell-interrupt-process)
+    (define-key map (kbd "C-c C-k") #'eshell-kill-process)
+    (define-key map (kbd "C-c C-d") #'eshell-send-eof-to-process)
+    (define-key map (kbd "C-c C-s") #'list-processes)
+    (define-key map (kbd "C-c C-\\") #'eshell-quit-process)
+    map))
+
 ;;; Functions:
 
 (defun eshell-kill-process-function (proc status)
@@ -121,20 +131,14 @@ PROC and STATUS to functions on the latter."
   (eshell-reset-after-proc status)
   (run-hook-with-args 'eshell-kill-hook proc status))
 
+(define-minor-mode eshell-proc-mode
+  "Minor mode for the proc eshell module."
+  :keymap eshell-proc-mode-map)
+
 (defun eshell-proc-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the process handling code."
   (make-local-variable 'eshell-process-list)
-  ;; This is supposedly run after enabling esh-mode, when eshell-command-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?i)] 'eshell-insert-process)
-  (define-key eshell-command-map [(control ?c)]  'eshell-interrupt-process)
-  (define-key eshell-command-map [(control ?k)]  'eshell-kill-process)
-  (define-key eshell-command-map [(control ?d)]  'eshell-send-eof-to-process)
-; (define-key eshell-command-map [(control ?q)]  'eshell-continue-process)
-  (define-key eshell-command-map [(control ?s)]  'list-processes)
-; (define-key eshell-command-map [(control ?z)]  'eshell-stop-process)
-  (define-key eshell-command-map [(control ?\\)] 'eshell-quit-process))
+  (eshell-proc-mode))
 
 (defun eshell-reset-after-proc (status)
   "Reset the command input location after a process terminates.
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index b08a5d242f..00bea09384 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -197,8 +197,17 @@ function), and the arguments passed to this function would be the list
 
 (put 'eshell-variable-aliases-list 'risky-local-variable t)
 
+(defvar eshell-var-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-v") #'eshell-insert-envvar)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-var-mode
+  "Minor mode for the esh-var module."
+  :keymap eshell-var-mode-map)
+
 (defun eshell-var-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the variable handle code."
   ;; Break the association with our parent's environment.  Otherwise,
@@ -207,11 +216,6 @@ function), and the arguments passed to this function would be the list
     (set (make-local-variable 'process-environment)
 	 (eshell-copy-environment)))
 
-  ;; This is supposedly run after enabling esh-mode, when eshell-command-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar)
-
   (set (make-local-variable 'eshell-special-chars-inside-quoting)
        (append eshell-special-chars-inside-quoting '(?$)))
   (set (make-local-variable 'eshell-special-chars-outside-quoting)
-- 
2.22.0


Added tag(s) patch. Request was from Alex Branham <alex.branham <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 28 Jun 2019 18:15:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Sat, 06 Jul 2019 03:18:02 GMT) Full text and rfc822 format available.

Message #21 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: 22792 <at> debbugs.gnu.org
Subject: Re: bug#22792: eshell-mode-map declaration
Date: Fri, 05 Jul 2019 23:17:23 -0400
Alex Branham <alex.branham <at> gmail.com> writes:

> OK, here's a patch that does so. The general idea is to make a minor
> mode with its own keymap for each of eshell's modules that (previously)
> assigned their keybindings into eshell-mode-map.

Looks like this loses the keybindings from C-h m.  Is it possible to
keep those?  Or failing that, add them to the new minor mode docs.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Tue, 13 Aug 2019 16:29:02 GMT) Full text and rfc822 format available.

Message #24 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Alex Branham <alex.branham <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 22792 <at> debbugs.gnu.org
Subject: Re: bug#22792: eshell-mode-map declaration
Date: Tue, 13 Aug 2019 11:28:29 -0500
[Message part 1 (text/plain, inline)]
On Fri 05 Jul 2019 at 23:17, Noam Postavsky <npostavs <at> gmail.com> wrote:

> Alex Branham <alex.branham <at> gmail.com> writes:
>
>> OK, here's a patch that does so. The general idea is to make a minor
>> mode with its own keymap for each of eshell's modules that (previously)
>> assigned their keybindings into eshell-mode-map.
>
> Looks like this loses the keybindings from C-h m.  Is it possible to
> keep those?  Or failing that, add them to the new minor mode docs.

Sorry for the delayed reply.

I don't know of a straightforward way to keep those in C-h m since this
uses minor modes, but it's easy enough to add those into the docstring
of the minor mode.

The more I think about this the more I wonder whether the whole
eshell-module framework should just be moved to minor modes, then we
could just call run-hooks on eshell-modules to set everything up. But
that's a question for a later day I suppose.

Thanks,
Alex

[0001-Fix-eshell-mode-map-initialization.patch (text/x-patch, inline)]
From 587f5e7226e69e221bf402eccf595bc78a4a5670 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham <at> gmail.com>
Date: Wed, 26 Jun 2019 13:59:06 -0500
Subject: [PATCH] Fix eshell-mode-map initialization

* lisp/eshell/esh-mode.el (eshell-mode-map):
(eshell-command-map): Set up normal keymaps and prefix commands rather
than re-initializing them in each eshell buffer

* lisp/eshell/em-cmpl.el (eshell-cmpl-mode-map):
(eshell-cmpl-mode):
(eshell-cmpl-initialize):
* lisp/eshell/em-hist.el (eshell-hist-mode-map):
(eshell-hist-mode):
(eshell-hist-initialize):
* lisp/eshell/em-pred.el (eshell-pred-mode-map):
(eshell-pred-mode):
(eshell-pred-initialize):
* lisp/eshell/em-prompt.el (eshell-prompt-mode-map):
(eshell-prompt-mode):
(eshell-prompt-initialize):
* lisp/eshell/em-rebind.el (eshell-rebind-mode-map):
(eshell-rebind-mode):
(eshell-rebind-initialize):
* lisp/eshell/esh-arg.el (eshell-arg-mode-map):
(eshell-arg-mode):
(eshell-arg-initialize):
* lisp/eshell/esh-proc.el (eshell-proc-mode-map):
(eshell-proc-mode):
(eshell-proc-initialize):
* lisp/eshell/esh-var.el (eshell-var-mode-map):
(eshell-var-mode):
(eshell-var-initialize): Create a new minor mode with a keymap and
call it in the module initialization function.

bug#33808
bug#22792
---
 etc/NEWS                 |  6 ++++
 lisp/eshell/em-cmpl.el   | 35 ++++++++++++++---------
 lisp/eshell/em-hist.el   | 62 ++++++++++++++++++++++------------------
 lisp/eshell/em-pred.el   | 15 ++++++++--
 lisp/eshell/em-prompt.el | 16 +++++++++--
 lisp/eshell/em-rebind.el | 13 ++++++++-
 lisp/eshell/esh-arg.el   | 16 ++++++++---
 lisp/eshell/esh-mode.el  | 58 +++++++++++++++++--------------------
 lisp/eshell/esh-proc.el  | 28 +++++++++++-------
 lisp/eshell/esh-var.el   | 16 +++++++----
 10 files changed, 165 insertions(+), 100 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b9e9e28db4..9f899a45bc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1352,6 +1352,12 @@ default, and not just the opening element.
 behave similarly, e.g. Pcomplete's default cycling can be obtained
 with '(setq completion-cycle-threshold 5)'.
 
+---
+*** Eshell no longer re-initializes its keymap every call.
+This allows users to use (define-key eshell-mode-map ...) as usual.
+Some modules have their own minor mode now to account for these
+changes.
+
 +++
 *** Expansion of history event designators is disabled by default.
 To restore the old behavior, use
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 8f6c6781b9..df4e24c88b 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -244,6 +244,26 @@ to writing a completion function."
   (let ((completion-at-point-functions '(lisp-completion-at-point)))
     (completion-at-point)))
 
+(defvar eshell-cmpl-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [(control ?i)] #'completion-at-point)
+    ;; jww (1999-10-19): Will this work on anything but X?
+    (define-key map [backtab] #'pcomplete-reverse)
+    (define-key map [(meta ??)] #'completion-help-at-point)
+    (define-key map [(meta control ?i)] #'eshell-complete-lisp-symbol)
+    ;; C-c prefix:
+    (define-key map (kbd "C-c M-h") #'eshell-completion-help)
+    (define-key map (kbd "C-c TAB") #'pcomplete-expand-and-complete)
+    (define-key map (kbd "C-c C-i") #'pcomplete-expand-and-complete)
+    (define-key map (kbd "C-c SPC") #'pcomplete-expand)
+    map))
+
+(define-minor-mode eshell-cmpl-mode
+  "Minor mode that provides a keymap when `eshell-cmpl' active.
+
+\\{eshell-cmpl-mode-map}"
+  :keymap eshell-cmpl-mode-map)
+
 (defun eshell-cmpl-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the completions module."
   (set (make-local-variable 'pcomplete-command-completion-function)
@@ -291,22 +311,9 @@ to writing a completion function."
 		    eshell-special-chars-outside-quoting)))
             nil t)
   (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t)
-  ;;(define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol) ; Redundant
-  (define-key eshell-mode-map [(meta control ?i)] 'eshell-complete-lisp-symbol)
-  (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help)
-  (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
-  (define-key eshell-command-map [(control ?i)]
-    'pcomplete-expand-and-complete)
-  (define-key eshell-command-map [space] 'pcomplete-expand)
-  (define-key eshell-command-map [? ] 'pcomplete-expand)
-  ;;(define-key eshell-mode-map [tab] 'completion-at-point) ;Redundant!
-  (define-key eshell-mode-map [(control ?i)] 'completion-at-point)
   (add-hook 'completion-at-point-functions
             #'pcomplete-completions-at-point nil t)
-  ;; jww (1999-10-19): Will this work on anything but X?
-  (define-key eshell-mode-map
-    (if (featurep 'xemacs) [iso-left-tab] [backtab]) 'pcomplete-reverse)
-  (define-key eshell-mode-map [(meta ??)] 'completion-help-at-point))
+  (eshell-cmpl-mode))
 
 (defun eshell-completion-command-name ()
   "Return the command name, possibly sans globbing."
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index adb028002b..9a9e6f0f39 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -202,6 +202,32 @@ element, regardless of any text on the command line.  In that case,
     map)
   "Keymap used in isearch in Eshell.")
 
+(defvar eshell-hist-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [up] #'eshell-previous-matching-input-from-input)
+    (define-key map [down] #'eshell-next-matching-input-from-input)
+    (define-key map [(control up)] #'eshell-previous-input)
+    (define-key map [(control down)] #'eshell-next-input)
+    (define-key map [(meta ?r)] #'eshell-previous-matching-input)
+    (define-key map [(meta ?s)] #'eshell-next-matching-input)
+    (define-key map (kbd "C-c M-r") #'eshell-previous-matching-input-from-input)
+    (define-key map (kbd "C-c M-s") #'eshell-next-matching-input-from-input)
+    ;; FIXME: Relies on `eshell-hist-match-partial' being set _before_
+    ;; em-hist is loaded and won't respect changes.
+    (if eshell-hist-match-partial
+	(progn
+	  (define-key map [(meta ?p)] 'eshell-previous-matching-input-from-input)
+	  (define-key map [(meta ?n)] 'eshell-next-matching-input-from-input)
+	  (define-key map (kbd "C-c M-p") #'eshell-previous-input)
+	  (define-key map (kbd "C-c M-n") #'eshell-next-input))
+      (define-key map [(meta ?p)] #'eshell-previous-input)
+      (define-key map [(meta ?n)] #'eshell-next-input)
+      (define-key map (kbd "C-c M-p") #'eshell-previous-matching-input-from-input)
+      (define-key map (kbd "C-c M-n") #'eshell-next-matching-input-from-input))
+    (define-key map (kbd "C-c C-l") #'eshell-list-history)
+    (define-key map (kbd "C-c C-x") #'eshell-get-next-from-history)
+    map))
+
 (defvar eshell-rebind-keys-alist)
 
 ;;; Functions:
@@ -216,6 +242,12 @@ Returns non-nil if INPUT is blank."
 Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (not (string-match-p "\\`\\s-+" input)))
 
+(define-minor-mode eshell-hist-mode
+  "Minor mode for the eshell-hist module.
+
+\\{eshell-hist-mode-map}"
+  :keymap eshell-hist-mode-map)
+
 (defun eshell-hist-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the history management code for one Eshell buffer."
   (when (eshell-using-module 'eshell-cmpl)
@@ -242,30 +274,7 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
 		   (lambda ()
 		     (setq overriding-terminal-local-map nil)))
                   nil t))
-    (define-key eshell-mode-map [up] 'eshell-previous-matching-input-from-input)
-    (define-key eshell-mode-map [down] 'eshell-next-matching-input-from-input)
-    (define-key eshell-mode-map [(control up)] 'eshell-previous-input)
-    (define-key eshell-mode-map [(control down)] 'eshell-next-input)
-    (define-key eshell-mode-map [(meta ?r)] 'eshell-previous-matching-input)
-    (define-key eshell-mode-map [(meta ?s)] 'eshell-next-matching-input)
-    (define-key eshell-command-map [(meta ?r)]
-      'eshell-previous-matching-input-from-input)
-    (define-key eshell-command-map [(meta ?s)]
-      'eshell-next-matching-input-from-input)
-    (if eshell-hist-match-partial
-	(progn
-	  (define-key eshell-mode-map [(meta ?p)]
-	    'eshell-previous-matching-input-from-input)
-	  (define-key eshell-mode-map [(meta ?n)]
-	    'eshell-next-matching-input-from-input)
-	  (define-key eshell-command-map [(meta ?p)] 'eshell-previous-input)
-	  (define-key eshell-command-map [(meta ?n)] 'eshell-next-input))
-      (define-key eshell-mode-map [(meta ?p)] 'eshell-previous-input)
-      (define-key eshell-mode-map [(meta ?n)] 'eshell-next-input)
-      (define-key eshell-command-map [(meta ?p)]
-	'eshell-previous-matching-input-from-input)
-      (define-key eshell-command-map [(meta ?n)]
-	'eshell-next-matching-input-from-input)))
+    (eshell-hist-mode))
 
   (make-local-variable 'eshell-history-size)
   (or eshell-history-size
@@ -300,10 +309,7 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (add-hook 'kill-emacs-hook #'eshell-save-some-history)
 
   (make-local-variable 'eshell-input-filter-functions)
-  (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t)
-
-  (define-key eshell-command-map [(control ?l)] 'eshell-list-history)
-  (define-key eshell-command-map [(control ?x)] 'eshell-get-next-from-history))
+  (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t))
 
 (defun eshell-save-some-history ()
   "Save the history for any open Eshell buffers."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 9bc856a296..cfef59f962 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -229,6 +229,12 @@ FOR LISTS OF ARGUMENTS:
 EXAMPLES:
   *.c(:o)  sorted list of .c files")
 
+(defvar eshell-pred-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-q") #'eshell-display-predicate-help)
+    (define-key map (kbd "C-c M-m") #'eshell-display-modifier-help)
+    map))
+
 ;;; Functions:
 
 (defun eshell-display-predicate-help ()
@@ -245,12 +251,17 @@ EXAMPLES:
     (lambda ()
       (insert eshell-modifier-help-string)))))
 
+(define-minor-mode eshell-pred-mode
+  "Minor mode for the eshell-pred module.
+
+\\{eshell-pred-mode-map}"
+  :keymap eshell-pred-mode-map)
+
 (defun eshell-pred-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the predicate/modifier code."
   (add-hook 'eshell-parse-argument-hook
 	    #'eshell-parse-arg-modifier t t)
-  (define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help)
-  (define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help))
+  (eshell-pred-mode))
 
 (defun eshell-apply-modifiers (lst predicates modifiers)
   "Apply to LIST a series of PREDICATES and MODIFIERS."
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index adc68b6c85..993a740b82 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -97,8 +97,20 @@ arriving, or after."
   :options '(eshell-show-maximum-output)
   :group 'eshell-prompt)
 
+(defvar eshell-prompt-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c C-n") #'eshell-next-prompt)
+    (define-key map (kbd "C-c C-p") #'eshell-previous-prompt)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-prompt-mode
+  "Minor mode for eshell-prompt module.
+
+\\{eshell-prompt-mode-map}"
+  :keymap eshell-prompt-mode-map)
+
 (defun eshell-prompt-initialize ()  ;Called from `eshell-mode' via intern-soft!
   "Initialize the prompting code."
   (unless eshell-non-interactive-p
@@ -110,9 +122,7 @@ arriving, or after."
 
     (set (make-local-variable 'eshell-skip-prompt-function)
 	 'eshell-skip-prompt)
-
-    (define-key eshell-command-map [(control ?n)] 'eshell-next-prompt)
-    (define-key eshell-command-map [(control ?p)] 'eshell-previous-prompt)))
+    (eshell-prompt-mode)))
 
 (defun eshell-emit-prompt ()
   "Emit a prompt if eshell is being used interactively."
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index a817edbcc9..5fb6677e18 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -137,6 +137,11 @@ This is default behavior of shells like bash."
   :type '(repeat function)
   :group 'eshell-rebind)
 
+(defvar eshell-rebind-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-l") #'eshell-lock-local-map)
+    map))
+
 ;; Internal Variables:
 
 (defvar eshell-input-keymap)
@@ -145,6 +150,12 @@ This is default behavior of shells like bash."
 
 ;;; Functions:
 
+(define-minor-mode eshell-rebind-mode
+  "Minor mode for the eshell-rebind module.
+
+\\{eshell-rebind-mode-map}"
+  :keymap eshell-rebind-mode-map)
+
 (defun eshell-rebind-initialize ()  ;Called from `eshell-mode' via intern-soft!
   "Initialize the inputting code."
   (unless eshell-non-interactive-p
@@ -154,7 +165,7 @@ This is default behavior of shells like bash."
     (make-local-variable 'overriding-local-map)
     (add-hook 'post-command-hook 'eshell-rebind-input-map nil t)
     (set (make-local-variable 'eshell-lock-keymap) nil)
-    (define-key eshell-command-map [(meta ?l)] 'eshell-lock-local-map)))
+    (eshell-rebind-mode)))
 
 (defun eshell-lock-local-map (&optional arg)
   "Lock or unlock the current local keymap.
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 026edc5980..4685095826 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -155,14 +155,22 @@ treated as a literal character."
   :type 'hook
   :group 'eshell-arg)
 
+(defvar eshell-arg-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-b") #'eshell-insert-buffer-name)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-arg-mode
+  "Minor mode for the arg eshell module.
+
+\\{eshell-arg-mode-map}"
+  :keymap eshell-arg-mode-map)
+
 (defun eshell-arg-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the argument parsing code."
-  ;; This is supposedly run after enabling esh-mode, when eshell-mode-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?b)] 'eshell-insert-buffer-name)
+  (eshell-arg-mode)
   (set (make-local-variable 'eshell-inside-quote-regexp) nil)
   (set (make-local-variable 'eshell-outside-quote-regexp) nil))
 
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 80844c3a64..91204877f5 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -213,10 +213,7 @@ This is used by `eshell-watch-for-password-prompt'."
 ;; these are only set to nil initially for the sake of the
 ;; byte-compiler, when compiling other files which `require' this one
 (defvar eshell-mode nil)
-(defvar eshell-mode-map nil)
 (defvar eshell-command-running-string "--")
-(defvar eshell-command-map nil)
-(defvar eshell-command-prefix nil)
 (defvar eshell-last-input-start nil)
 (defvar eshell-last-input-end nil)
 (defvar eshell-last-output-start nil)
@@ -286,6 +283,32 @@ This is used by `eshell-watch-for-password-prompt'."
      (standard-syntax-table))
     st))
 
+(defvar eshell-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [(control ?c)] 'eshell-command-map)
+    (define-key map "\r" #'eshell-send-input)
+    (define-key map "\M-\r" #'eshell-queue-input)
+    (define-key map [(meta control ?l)] #'eshell-show-output)
+    (define-key map [(control ?a)] #'eshell-bol)
+    map))
+
+(defvar eshell-command-map
+  (let ((map (define-prefix-command 'eshell-command-map)))
+    (define-key map [(meta ?o)] #'eshell-mark-output)
+    (define-key map [(meta ?d)] #'eshell-toggle-direct-send)
+    (define-key map [(control ?a)] #'eshell-bol)
+    (define-key map [(control ?b)] #'eshell-backward-argument)
+    (define-key map [(control ?e)] #'eshell-show-maximum-output)
+    (define-key map [(control ?f)] #'eshell-forward-argument)
+    (define-key map [(control ?m)] #'eshell-copy-old-input)
+    (define-key map [(control ?o)] #'eshell-kill-output)
+    (define-key map [(control ?r)] #'eshell-show-output)
+    (define-key map [(control ?t)] #'eshell-truncate-buffer)
+    (define-key map [(control ?u)] #'eshell-kill-input)
+    (define-key map [(control ?w)] #'backward-kill-word)
+    (define-key map [(control ?y)] #'eshell-repeat-argument)
+    map))
+
 ;;; User Functions:
 
 (defun eshell-kill-buffer-function ()
@@ -304,10 +327,6 @@ and the hook `eshell-exit-hook'."
   "Emacs shell interactive mode."
   (setq-local eshell-mode t)
 
-  ;; FIXME: What the hell!?
-  (setq-local eshell-mode-map (make-sparse-keymap))
-  (use-local-map eshell-mode-map)
-
   (when eshell-status-in-mode-line
     (make-local-variable 'eshell-command-running-string)
     (let ((fmt (copy-sequence mode-line-format)))
@@ -316,31 +335,6 @@ and the hook `eshell-exit-hook'."
       (if mode-line-elt
 	  (setcar mode-line-elt 'eshell-command-running-string))))
 
-  (define-key eshell-mode-map "\r" 'eshell-send-input)
-  (define-key eshell-mode-map "\M-\r" 'eshell-queue-input)
-  (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
-  (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
-
-  (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
-  (fset eshell-command-prefix (make-sparse-keymap))
-  (setq-local eshell-command-map (symbol-function eshell-command-prefix))
-  (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
-
-  (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output)
-  (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send)
-
-  (define-key eshell-command-map [(control ?a)] 'eshell-bol)
-  (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument)
-  (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output)
-  (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument)
-  (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input)
-  (define-key eshell-command-map [(control ?o)] 'eshell-kill-output)
-  (define-key eshell-command-map [(control ?r)] 'eshell-show-output)
-  (define-key eshell-command-map [(control ?t)] 'eshell-truncate-buffer)
-  (define-key eshell-command-map [(control ?u)] 'eshell-kill-input)
-  (define-key eshell-command-map [(control ?w)] 'backward-kill-word)
-  (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
-
   (setq local-abbrev-table eshell-mode-abbrev-table)
 
   (set (make-local-variable 'list-buffers-directory)
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 32a3eecb52..a6d6aae678 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -109,6 +109,16 @@ information, for example."
 (defvar eshell-process-list nil
   "A list of the current status of subprocesses.")
 
+(defvar eshell-proc-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-i") #'eshell-insert-process)
+    (define-key map (kbd "C-c C-c") #'eshell-interrupt-process)
+    (define-key map (kbd "C-c C-k") #'eshell-kill-process)
+    (define-key map (kbd "C-c C-d") #'eshell-send-eof-to-process)
+    (define-key map (kbd "C-c C-s") #'list-processes)
+    (define-key map (kbd "C-c C-\\") #'eshell-quit-process)
+    map))
+
 ;;; Functions:
 
 (defun eshell-kill-process-function (proc status)
@@ -121,20 +131,16 @@ PROC and STATUS to functions on the latter."
   (eshell-reset-after-proc status)
   (run-hook-with-args 'eshell-kill-hook proc status))
 
+(define-minor-mode eshell-proc-mode
+  "Minor mode for the proc eshell module.
+
+\\{eshell-proc-mode-map}"
+  :keymap eshell-proc-mode-map)
+
 (defun eshell-proc-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the process handling code."
   (make-local-variable 'eshell-process-list)
-  ;; This is supposedly run after enabling esh-mode, when eshell-command-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?i)] 'eshell-insert-process)
-  (define-key eshell-command-map [(control ?c)]  'eshell-interrupt-process)
-  (define-key eshell-command-map [(control ?k)]  'eshell-kill-process)
-  (define-key eshell-command-map [(control ?d)]  'eshell-send-eof-to-process)
-; (define-key eshell-command-map [(control ?q)]  'eshell-continue-process)
-  (define-key eshell-command-map [(control ?s)]  'list-processes)
-; (define-key eshell-command-map [(control ?z)]  'eshell-stop-process)
-  (define-key eshell-command-map [(control ?\\)] 'eshell-quit-process))
+  (eshell-proc-mode))
 
 (defun eshell-reset-after-proc (status)
   "Reset the command input location after a process terminates.
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index b08a5d242f..6ec58464c5 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -197,8 +197,19 @@ function), and the arguments passed to this function would be the list
 
 (put 'eshell-variable-aliases-list 'risky-local-variable t)
 
+(defvar eshell-var-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c M-v") #'eshell-insert-envvar)
+    map))
+
 ;;; Functions:
 
+(define-minor-mode eshell-var-mode
+  "Minor mode for the esh-var module.
+
+\\{eshell-var-mode-map}"
+  :keymap eshell-var-mode-map)
+
 (defun eshell-var-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the variable handle code."
   ;; Break the association with our parent's environment.  Otherwise,
@@ -207,11 +218,6 @@ function), and the arguments passed to this function would be the list
     (set (make-local-variable 'process-environment)
 	 (eshell-copy-environment)))
 
-  ;; This is supposedly run after enabling esh-mode, when eshell-command-map
-  ;; already exists.
-  (defvar eshell-command-map)
-  (define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar)
-
   (set (make-local-variable 'eshell-special-chars-inside-quoting)
        (append eshell-special-chars-inside-quoting '(?$)))
   (set (make-local-variable 'eshell-special-chars-outside-quoting)
-- 
2.22.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22792; Package emacs. (Fri, 16 Aug 2019 00:57:01 GMT) Full text and rfc822 format available.

Message #27 received at 22792 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: 22792 <at> debbugs.gnu.org
Subject: Re: bug#22792: eshell-mode-map declaration
Date: Thu, 15 Aug 2019 20:56:37 -0400
tags 22792 fixed
close 22792 27.1
quit

Alex Branham <alex.branham <at> gmail.com> writes:

> I don't know of a straightforward way to keep those in C-h m since this
> uses minor modes, but it's easy enough to add those into the docstring
> of the minor mode.

Alright, good enough for now, I think.  Pushed to master.

1ee0192b79 2019-08-15T20:49:15-04:00 "Fix eshell-mode-map initialization"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1ee0192b792124663a0a40a729dd83c047d21535

> The more I think about this the more I wonder whether the whole
> eshell-module framework should just be moved to minor modes, then we
> could just call run-hooks on eshell-modules to set everything up. But
> that's a question for a later day I suppose.

Agreed on both counts.

> * lisp/eshell/esh-mode.el (eshell-mode-map):
> (eshell-command-map): Set up normal keymaps and prefix commands rather
> than re-initializing them in each eshell buffer
>
> * lisp/eshell/em-cmpl.el (eshell-cmpl-mode-map):
> (eshell-cmpl-mode):
> (eshell-cmpl-initialize):
> * lisp/eshell/em-hist.el (eshell-hist-mode-map):
> (eshell-hist-mode):
> (eshell-hist-initialize):
> * lisp/eshell/em-pred.el (eshell-pred-mode-map):
> (eshell-pred-mode):
> (eshell-pred-initialize):
> * lisp/eshell/em-prompt.el (eshell-prompt-mode-map):
> (eshell-prompt-mode):
> (eshell-prompt-initialize):
> * lisp/eshell/em-rebind.el (eshell-rebind-mode-map):
> (eshell-rebind-mode):
> (eshell-rebind-initialize):
> * lisp/eshell/esh-arg.el (eshell-arg-mode-map):
> (eshell-arg-mode):
> (eshell-arg-initialize):
> * lisp/eshell/esh-proc.el (eshell-proc-mode-map):
> (eshell-proc-mode):
> (eshell-proc-initialize):
> * lisp/eshell/esh-var.el (eshell-var-mode-map):
> (eshell-var-mode):
> (eshell-var-initialize): Create a new minor mode with a keymap and
> call it in the module initialization function.

By the way, the formatting of the ChangeLog entries is bit off here
(there shouldn't be a colon between empty entries of the same file).
But it's a nice use-case for the new log-edit-fill-entry: I can fix it
with just two presses of M-q :)




Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 16 Aug 2019 00:57:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 22792 <at> debbugs.gnu.org and Manuel Uberti - Boccaperta <manuel <at> boccaperta.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 16 Aug 2019 00:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 27.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 28.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Jun 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.