unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe
@ 2016-12-13  0:52 Alexander Shukaev
  2016-12-13  2:18 ` Glenn Morris
  2019-10-09  7:41 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Shukaev @ 2016-12-13  0:52 UTC (permalink / raw)
  To: 25190

Hi,

consider the two

;;; KEY BINDINGS.

(define-key dired-mode-map "\C-x\M-o" 'dired-omit-mode)
(define-key dired-mode-map "*O" 'dired-mark-omitted)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
(define-key dired-mode-map "\M-!" 'dired-smart-shell-command)
(define-key dired-mode-map "\M-G" 'dired-goto-subdir)
(define-key dired-mode-map "F" 'dired-do-find-marked-files)
(define-key dired-mode-map "Y"  'dired-do-relsymlink)
(define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)
(define-key dired-mode-map "V" 'dired-do-run-mail)

;;; MENU BINDINGS

(require 'easymenu)

(let ((menu (lookup-key dired-mode-map [menu-bar])))
   (easy-menu-add-item menu '("Operate")
                       ["Find Files" dired-do-find-marked-files
                        :help "Find current or marked files"]
                       "Shell Command...")
   (easy-menu-add-item menu '("Operate")
                       ["Relative Symlink to..." dired-do-relsymlink
                        :visible (fboundp 'make-symbolic-link)
                        :help "Make relative symbolic links for current or \
marked files"]
                       "Hardlink to...")
   (easy-menu-add-item menu '("Mark")
                       ["Flag Extension..." dired-flag-extension
                        :help "Flag files with a certain extension for 
deletion"]
                       "Mark Executables")
   (easy-menu-add-item menu '("Mark")
                       ["Mark Extension..." dired-mark-extension
                        :help "Mark files with a certain extension"]
                       "Unmark All")
   (easy-menu-add-item menu '("Mark")
                       ["Mark Omitted" dired-mark-omitted
                        :help "Mark files matching `dired-omit-files' \
and `dired-omit-extensions'"]
                       "Unmark All")
   (easy-menu-add-item menu '("Regexp")
                       ["Relative Symlink..." dired-do-relsymlink-regexp
                        :visible (fboundp 'make-symbolic-link)
                        :help "Make relative symbolic links for files \
matching regexp"]
                       "Hardlink...")
   (easy-menu-add-item menu '("Immediate")
                       ["Omit Mode" dired-omit-mode
                        :style toggle :selected dired-omit-mode
                        :help "Enable or disable omitting 
\"uninteresting\" \
files"]
                       "Refresh"))

sections.  Both can easily fail.  For instance,

(define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)

assumes that the "%" prefix command has been defined in `dired-mode-map' 
which is not at all true for any customization.  The 
`easy-menu-add-item' calls suffers from similar issue.  It should be 
possible to conditionally disable these code sections or even remove 
them altogether as they are maldesigned.

Looking forward to fix.

P.S. Just a side question: why `dired-x' is not yet merged into `dired'? 
  IMO, makes no sense to maintain separate extension packages of the 
main package when they are already built-in anyway.

Regards,
Alexander





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

end of thread, other threads:[~2019-10-09  7:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13  0:52 bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe Alexander Shukaev
2016-12-13  2:18 ` Glenn Morris
2016-12-13  3:04   ` Drew Adams
2019-10-09  7:41 ` Lars Ingebrigtsen

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).