all messages for Emacs-related lists mirrored at yhetil.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

* bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2016-12-13  2:18 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25190

Alexander Shukaev wrote:

> P.S. Just a side question: why `dired-x' is not yet merged into
> dired'?

Since dired-x hasn't changed qualitatively in 5 years, neither has my
answer to this question. :)

http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00718.html

(Just IMO.)





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

* bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe
  2016-12-13  2:18 ` Glenn Morris
@ 2016-12-13  3:04   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2016-12-13  3:04 UTC (permalink / raw)
  To: Glenn Morris, Alexander Shukaev; +Cc: 25190

> > P.S. Just a side question: why `dired-x' is not yet merged into
> > dired'?
> 
> Since dired-x hasn't changed qualitatively in 5 years, neither has my
> answer to this question. :)
> 
> http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00718.html
> (Just IMO.)

Yes, well, those (such as Glenn and Stefan) in that thread who
claimed to want to keep only a bit of dired-x and toss the
rest, claiming that it is only "cruft" are also people who
have admitted that they hardly, if ever, use Dired.

There are plenty of other people, myself included, who use not
only dired.el but dired-x.el and dired-aux.el, all the time.

I don't think it's useful to rehash the previous thread,
which went nowhere, and certainly not here, in a bug thread
that is not related.

But we should not particularly be listening to non-users of
Dired about tossing parts of it out.  (Just IMO.)





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

* bug#25190: Initialization of `dired-mode-map' in by the `dired-x' feature is not safe
  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
@ 2019-10-09  7:41 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-09  7:41 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25190

Alexander Shukaev <emacs@Alexander.Shukaev.name> writes:

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

[...]

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

I've now added some checks to Emacs 27 to ensure that dired-x doesn't
try to define keys in sub-keymaps that doesn't exist.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ 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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.