all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <rms@gnu.org>, <12311@debbugs.gnu.org>
Subject: bug#12311: 24.1.50; z in special-mode-map
Date: Thu, 30 Aug 2012 08:40:36 -0700	[thread overview]
Message-ID: <D8721D4DCD7C4105AC914271D9C8C790@us.oracle.com> (raw)
In-Reply-To: <E1T75vu-00024G-En@fencepost.gnu.org>

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






  reply	other threads:[~2012-08-30 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 14:41 bug#12311: 24.1.50; z in special-mode-map Richard Stallman
2012-08-30 15:40 ` Drew Adams [this message]
2012-08-30 15:54 ` Stefan Monnier
2012-08-30 23:26   ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D8721D4DCD7C4105AC914271D9C8C790@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=12311@debbugs.gnu.org \
    --cc=rms@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 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.