(define-key dired-mode-map [yourkey] 'dired-up-directory)
Instead of [yourkey], you can put names like [up], or "b" or "r", and this would only be in dired, note.
(define-key dired-mode-map "b" 'dired-up-directory)
You could also do for instance Control up. Mind that in some situations it's easier to use []
, so you'd replace [yourkey]
with [C-up]
(literally)
The idea is: define the key for the specific map, and bind it to your desired function.
EDIT: Just so you know how to do this kind of things yourself next time, know that for any mode you have the ending (-mode-map), so LaTeX-mode-map, emacs-lisp-mode-map, etc.
Those you use with define-key
.
If you want to know what function is attached to a binding, use C-h k
(Control + h, then k)
followed by your key, and it will show you what the function is called that can be bound to something else (make sure you'd call it when dired-mode is active though!).