* bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings
@ 2010-07-14 15:58 Teemu Likonen
2010-07-22 11:57 ` Juanma Barranquero
0 siblings, 1 reply; 2+ messages in thread
From: Teemu Likonen @ 2010-07-14 15:58 UTC (permalink / raw)
To: 6632
[-- Attachment #1: Type: text/plain, Size: 593 bytes --]
dired-mode uses hard-coding when it rebinds some global key bindings.
For example, there is the following line in dired.el file:
(define-key map "\C-n" 'dired-next-line)
Therefore it overrides the global C-n key, whatever its command is in
user's keymap. The command should be bound like this:
(define-key map [remap next-line] 'dired-next-line)
Using [remap ...] is preferred because it makes it possible for user to
redefine the global keymap they way she wishes and keys will still
automatically get their mode-specific behaviour. The attached patch
fixes this for dired-mode.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-mode-remap.diff --]
[-- Type: text/x-diff, Size: 1257 bytes --]
diff --git a/lisp/dired.el b/lisp/dired.el
index c3d1435..0e5cc22 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1380,10 +1380,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map ">" 'dired-next-dirline)
(define-key map "^" 'dired-up-directory)
(define-key map " " 'dired-next-line)
- (define-key map "\C-n" 'dired-next-line)
- (define-key map "\C-p" 'dired-previous-line)
- (define-key map [down] 'dired-next-line)
- (define-key map [up] 'dired-previous-line)
+ (define-key map [remap next-line] 'dired-next-line)
+ (define-key map [remap previous-line] 'dired-previous-line)
;; hiding
(define-key map "$" 'dired-hide-subdir)
(define-key map "\M-$" 'dired-hide-all)
@@ -1393,7 +1391,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map (kbd "M-s f C-s") 'dired-isearch-filenames)
(define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp)
;; misc
- (define-key map "\C-x\C-q" 'dired-toggle-read-only)
+ (define-key map [remap toggle-read-only] 'dired-toggle-read-only)
(define-key map "?" 'dired-summary)
(define-key map "\177" 'dired-unmark-backward)
(define-key map [remap undo] 'dired-undo)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings
2010-07-14 15:58 bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings Teemu Likonen
@ 2010-07-22 11:57 ` Juanma Barranquero
0 siblings, 0 replies; 2+ messages in thread
From: Juanma Barranquero @ 2010-07-22 11:57 UTC (permalink / raw)
To: Teemu Likonen; +Cc: 6632-done
On Wed, Jul 14, 2010 at 17:58, Teemu Likonen <tlikonen@iki.fi> wrote:
> The attached patch fixes this for dired-mode.
Committed, thanks.
Juanma
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-22 11:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-14 15:58 bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings Teemu Likonen
2010-07-22 11:57 ` Juanma Barranquero
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).