GNU bug report logs -
#12311
24.1.50; z in special-mode-map
Previous Next
Reported by: rms <at> gnu.org
Date: Thu, 30 Aug 2012 14:43:02 UTC
Severity: normal
Found in version 24.1.50
Fixed in version 24.3
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> I just discovered why some of the Dired buffers I always keep
> occasionally disappear. It is because the binding of z in
> special-mode-map makes it so easy to kill them.
>
> I just got rid of that binding in my .emacs, but I think that binding
> is a bad idea. Not all the buffers in special modes are things people
> don't mind deleting, and this key can cause annoyance if typed by
> accident.
+1
---
FWIW, I have long bound `z' to `diredp-compress-this-file', which is just a
this-file version of `Z' (`dired-do-compress').
(defun diredp-compress-this-file ()
"In Dired, compress or uncompress the file on the cursor line."
(interactive) (dired-do-compress 1))
---
Why do we even bother to have `dired-mode-map' inherit from `special-mode-map'?
These are the only keys from `special-mode-map' that Dired does not already
override:
- and 0-9 negative-argument and digit-argument
? and h describe-mode
g revert-buffer
q quit-window
z kill-this-buffer
(That and the fact that `s-m-m' uses `suppress-keymap'.) And when you consider
that for `g' Dired defines its own `revert-function', there is not a lot that is
really taken from `s-m-m'.
Dired overrides `SPC', `DEL', `>', and `<'. And `h' could also be overridden to
serve a Dired purpose in the future (`h' just duplicates `?').
We might as well just define the keys we want directly in `dired-mode-map' and
call `suppress-keymap' there.
Inheritance is useful if it really saves (factors out) something significant, or
if we want to be able to change something in one place and have that affect
other places. The tradeoff is the extra coupling/dependency - someone changing
`s-m-m' needs to think carefully about how that change might affect each mode
that inherits from it.
In the case of Dired, inheritance of `s-m-m' doesn't offer much, IMHO.
This bug report was last modified 12 years and 259 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.