3

I wanted an alternative to the awful C-^ shortcut for moving up one directory so I added the following to init file:

 (defun dc/dired-mode-keys () "User defined keys for dired mode." (interactive) (local-set-key (kbd "s-m" 'dired-up-directory))) (add-hook 'dired-mode-hook 'dc/dired-mode-keys) 

However, when I open Emacs with this code enabled (i.e., uncommented in the init file), I lose basic dired functionality. For example, when I press a to open a directory (in the same buffer), I get the following error in the mini-buffer.

Wrong number of arguments: (1 . 1), 2 

I've confirmed that s-m is not a native key-binding in dired-mode (I believe very few if any super key combos are natively bound), and I'm pretty sure my code doesn't unbind any of the native key-bindings in dired-mode.

What am I doing wrong in the function above?

1 Answer 1

6

The "wrong number of arguments" error comes from the kbd inside dc/dired-mode-keys. Your parentheses are nested incorrectly, so you pass 2 arguments to kbd, but it expects only 1.

Try this instead:

(local-set-key (kbd "s-m") 'dired-up-directory) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.