Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Remove local key binding in Dired

10 views
Skip to first unread message

Torben Knudsen

unread,
Jul 2, 2009, 2:54:24 AM7/2/09
to
I have the following which I find conveinent

;;; Window spliting
(global-set-key (kbd "M-3") 'split-window-horizontally) ; was digit-argument
(global-set-key (kbd "M-2") 'split-window-vertically) ; was digit-argument
(global-set-key (kbd "M-1") 'delete-other-windows) ; was digit-argument
(global-set-key (kbd "M-0") 'delete-window) ; was digit-argument
(global-set-key (kbd "M-o") 'other-window) ; was prefix

However, in dired

M-o runs the command dired-omit-mode

I can remove this "manually" by

local-unset-key M-o

in a dired buffer

but how can I do this in my .emacs?

--
Associate Prof. Ph.D Torben Knudsen Mobile : (+45) 2787 9826
Section of Automation and Control, Direct : 6 8694
Department of Electronic Systems, Email : t...@es.aau.dk
Aalborg University
Fredrik Bajersvej 7
DK-9220 Aalborg �
Denmark

Teemu Likonen

unread,
Jul 2, 2009, 3:06:14 AM7/2/09
to
On 2009-07-02 08:54 (+0200), Torben Knudsen wrote:

> However, in dired
>
> M-o runs the command dired-omit-mode
>
> I can remove this "manually" by
>
> local-unset-key M-o
>
> in a dired buffer
>
> but how can I do this in my .emacs?

Configure a Dired mode hook which sets M-o keybinding to nil in the
mode's local map:

(add-hook 'dired-mode-hook 'my-dired-mode-hook)

(defun my-dired-mode-hook ()
(define-key dired-mode-map (kbd "M-o") nil))

Xah Lee

unread,
Jul 2, 2009, 9:34:39 AM7/2/09
to
On Jul 1, 11:54 pm, Torben Knudsen <t...@es.aau.dk> wrote:
> I have the following which I find conveinent
>
> ;;; Window spliting
> (global-set-key (kbd "M-3") 'split-window-horizontally) ; was digit-argument
> (global-set-key (kbd "M-2") 'split-window-vertically) ; was digit-argument
> (global-set-key (kbd "M-1") 'delete-other-windows) ; was digit-argument
> (global-set-key (kbd "M-0") 'delete-window) ; was digit-argument
> (global-set-key (kbd "M-o") 'other-window) ; was prefix
>
> However, in dired
>
> M-o runs the command dired-omit-mode
>
> I can remove this "manually" by
>
> local-unset-key M-o
>
> in a dired buffer
>
> but how can I do this in my .emacs?


you might try the latest version of ergoemacs, which fixes this.
http://code.google.com/p/ergoemacs/

The code that fixes this is this:

(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map (kbd "C-n") 'new-empty-buffer) ; was
dired-next-line
(define-key dired-mode-map (kbd "M-o") 'other-window) ; was dired-
omit-mode
(define-key dired-mode-map (kbd "M-s") 'isearch-forward) ; was
prefix in emacs 23.
))

some explanation here:

• How To Reclaim Keybindings In Emacs
http://xahlee.org/emacs/reclaim_keybindings.html

Xah
http://xahlee.org/


Marc Tfardy

unread,
Jul 2, 2009, 11:41:56 AM7/2/09
to
Xah Lee schrieb:

> you might try the latest version of ergoemacs

WTF is ergoemacs??? :-o


> http://code.google.com/p/ergoemacs/

http://ergoemacs.googlecode.com/files/ergonomic_keybinding_qwerty_4.3.6.el:

Who really need this? And what is better in you own key bindings
compared to standard emacs? (except for your private preferences of
course.)

BTW:
- bad parens
- poor indent
- too long comments lines


regards
Marc

Xah Lee

unread,
Jul 2, 2009, 6:00:12 PM7/2/09
to
On Jul 2, 8:41 am, Marc Tfardy <b...@cyk.cyk> wrote:
> Xah Lee schrieb:
>
> > you might try the latest version of ergoemacs
>
> WTF is ergoemacs??? :-o
>
> >http://code.google.com/p/ergoemacs/

Hi Marc,

There were numerous huge flame wars in the past couple of years
regarding this. Perhaps you are a new comer. :D

> http://ergoemacs.googlecode.com/files/ergonomic_keybinding_qwerty_4.3...


>
> Who really need this? And what is better in you own key bindings
> compared to standard emacs? (except for your private preferences of
> course.)
>
> BTW:
> - bad parens
> - poor indent
> - too long comments lines

Here's some answer to your skeptism.

The Reason for ergoemacs is:

• Why Emacs's Keyboard Shortcuts Are Painful
http://xahlee.org/emacs/emacs_kb_shortcuts_pain.html

> - bad parens
> - poor indent
> - too long comments lines

The reason that my elisp source code's formatting not always being
have 100% lisp convention is because partly lazy and partly consider
this formatting issue is a major myth that causes major harm to the
industry. Here's some essays about it:

• Fundamental Problems of Lisp
(see the section “Automatic, Uniform, Universal, Source Code
Display”)
http://xahlee.org/UnixResource_dir/writ/lisp_problems.html

• The Harm of Hard-wrapping Lines
http://xahlee.org/UnixResource_dir/writ/hard-wrap.html

• Tabs versus Spaces in Source Code
http://xahlee.org/UnixResource_dir/writ/tabs_vs_spaces.html

The following essays are on some feature that could've been:

• A Simple Lisp Code Formatter
http://xahlee.org/emacs/lisp_formatter.html

• A Text Editor Feature: Extend Selection By Semantic Unit
http://xahlee.org/emacs/syntax_tree_walk.html

Xah
http://xahlee.org/


Torben Knudsen

unread,
Jul 3, 2009, 2:33:06 AM7/3/09
to
Thanks, this is exactly what I need. I have some small changes to
emacs key bindings. However I try to keep it at a minimum.

Teemu Likonen <tlik...@iki.fi> writes:

--

Torben Knudsen

unread,
Jul 3, 2009, 2:36:03 AM7/3/09
to
Xah Lee <xah...@gmail.com> writes:

> On Jul 1, 11:54 pm, Torben Knudsen <t...@es.aau.dk> wrote:
>> I have the following which I find conveinent
>>
>> ;;; Window spliting
>> (global-set-key (kbd "M-3") 'split-window-horizontally) ; was digit-argument
>> (global-set-key (kbd "M-2") 'split-window-vertically) ; was digit-argument
>> (global-set-key (kbd "M-1") 'delete-other-windows) ; was digit-argument
>> (global-set-key (kbd "M-0") 'delete-window) ; was digit-argument
>> (global-set-key (kbd "M-o") 'other-window) ; was prefix
>>
>> However, in dired
>>
>> M-o runs the command dired-omit-mode
>>
>> I can remove this "manually" by
>>
>> local-unset-key M-o
>>
>> in a dired buffer
>>
>> but how can I do this in my .emacs?
>
>
> you might try the latest version of ergoemacs, which fixes this.
> http://code.google.com/p/ergoemacs/

Thanks for the suggestion. I have some small changes to emacs key


bindings. However I try to keep it at a minimum.

--

0 new messages