unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Shukaev <emacs@Alexander.Shukaev.name>
To: 25190@debbugs.gnu.org
Subject: bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe
Date: Tue, 13 Dec 2016 01:52:31 +0100	[thread overview]
Message-ID: <c96b480b-d44c-eb63-c8ff-572610ab3372@Alexander.Shukaev.name> (raw)

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





             reply	other threads:[~2016-12-13  0:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  0:52 Alexander Shukaev [this message]
2016-12-13  2:18 ` bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe Glenn Morris
2016-12-13  3:04   ` Drew Adams
2019-10-09  7:41 ` 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=c96b480b-d44c-eb63-c8ff-572610ab3372@Alexander.Shukaev.name \
    --to=emacs@alexander.shukaev.name \
    --cc=25190@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).