summaryrefslogtreecommitdiff
path: root/lisp/mpc.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-17 12:56:38 +0200
committerStefan Kangas <stefan@marxist.se>2022-07-17 12:56:38 +0200
commit5c7d1024c438106ef0f706d9c8eadced947d82a2 (patch)
tree0263ee7cd488911c0c28d9336f3da7e13d284a82 /lisp/mpc.el
parent2500ab089423df818557c5e9426e334dfbec0dbf (diff)
downloademacs-5c7d1024c438106ef0f706d9c8eadced947d82a2.tar.gz
Prefer defvar-keymap in mpc.el
* lisp/mpc.el (mpc-mode-map, mpc-tagbrowser-dir-mode-map) (mpc-volume-map, mpc-songs-mode-map): Prefer defvar-keymap.
Diffstat (limited to 'lisp/mpc.el')
-rw-r--r--lisp/mpc.el84
1 files changed, 38 insertions, 46 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el
index dc61ce78bda..1464c36a916 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1126,32 +1126,30 @@ If PLAYLIST is t or nil or missing, use the main playlist."
;;; The actual UI code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar mpc-mode-map
- (let ((map (make-sparse-keymap)))
- ;; (define-key map "\e" #'mpc-stop)
- (define-key map "q" #'mpc-quit)
- (define-key map "\r" #'mpc-select)
- (define-key map [(shift return)] #'mpc-select-toggle)
- (define-key map [mouse-2] #'mpc-select)
- (define-key map [S-mouse-2] #'mpc-select-extend)
- (define-key map [C-mouse-2] #'mpc-select-toggle)
- (define-key map [drag-mouse-2] #'mpc-drag-n-drop)
- ;; We use `always' because a binding to t is like a binding to nil.
- (define-key map [follow-link] :always)
- ;; But follow-link doesn't apply blindly to header-line and
- ;; mode-line clicks.
- (define-key map [header-line follow-link] #'ignore)
- (define-key map [mode-line follow-link] #'ignore)
- ;; Doesn't work because the first click changes the buffer, so the second
- ;; is applied elsewhere :-(
- ;; (define-key map [(double mouse-2)] #'mpc-play-at-point)
- (define-key map "p" #'mpc-pause)
- (define-key map "s" #'mpc-toggle-play)
- (define-key map ">" #'mpc-next)
- (define-key map "<" #'mpc-prev)
- (define-key map "g" #'mpc-seek-current)
- (define-key map "o" #'mpc-goto-playing-song)
- map))
+(defvar-keymap mpc-mode-map
+ ;; "ESC" #'mpc-stop
+ "q" #'mpc-quit
+ "RET" #'mpc-select
+ "S-<return>" #'mpc-select-toggle
+ "<mouse-2>" #'mpc-select
+ "S-<mouse-2>" #'mpc-select-extend
+ "C-<mouse-2>" #'mpc-select-toggle
+ "<drag-mouse-2>" #'mpc-drag-n-drop
+ ;; We use `always' because a binding to t is like a binding to nil.
+ "<follow-link>" :always
+ ;; But follow-link doesn't apply blindly to header-line and
+ ;; mode-line clicks.
+ "<header-line> <follow-link>" #'ignore
+ "<mode-line> <follow-link>" #'ignore
+ ;; Doesn't work because the first click changes the buffer, so the second
+ ;; is applied elsewhere :-(
+ ;; "<double-mouse-2>" #'mpc-play-at-point
+ "p" #'mpc-pause
+ "s" #'mpc-toggle-play
+ ">" #'mpc-next
+ "<" #'mpc-prev
+ "g" #'mpc-seek-current
+ "o" #'mpc-goto-playing-song)
(easy-menu-define mpc-mode-menu mpc-mode-map
"Menu for MPC mode."
@@ -1748,11 +1746,9 @@ Return non-nil if a selection was deactivated."
;; present (because we're in the non-selected part and the parent is
;; in the selected part).
-(defvar mpc-tagbrowser-dir-mode-map
- (let ((map (make-sparse-keymap)))
- (set-keymap-parent map mpc-tagbrowser-mode-map)
- (define-key map [?\M-\C-m] #'mpc-tagbrowser-dir-toggle)
- map))
+(defvar-keymap mpc-tagbrowser-dir-mode-map
+ :parent mpc-tagbrowser-mode-map
+ "M-RET" #'mpc-tagbrowser-dir-toggle)
;; (defvar mpc-tagbrowser-dir-keywords
;; '(mpc-tagbrowser-dir-hide-prefix))
@@ -1859,17 +1855,15 @@ A value of t means the main playlist.")
;;; Volume management ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar mpc-volume-map
- (let ((map (make-sparse-keymap)))
- ;; Bind the up-events rather than the down-event, so the
- ;; `message' isn't canceled by the subsequent up-event binding.
- (define-key map [down-mouse-1] #'ignore)
- (define-key map [mouse-1] #'mpc-volume-mouse-set)
- (define-key map [header-line mouse-1] #'mpc-volume-mouse-set)
- (define-key map [header-line down-mouse-1] #'ignore)
- (define-key map [mode-line mouse-1] #'mpc-volume-mouse-set)
- (define-key map [mode-line down-mouse-1] #'ignore)
- map))
+(defvar-keymap mpc-volume-map
+ ;; Bind the up-events rather than the down-event, so the
+ ;; `message' isn't canceled by the subsequent up-event binding.
+ "<down-mouse-1>" #'ignore
+ "<mouse-1>" #'mpc-volume-mouse-set
+ "<header-line> <mouse-1>" #'mpc-volume-mouse-set
+ "<header-line> <down-mouse-1>" #'ignore
+ "<mode-line> <mouse-1>" #'mpc-volume-mouse-set
+ "<mode-line> <down-mouse-1>" #'ignore)
(defvar mpc-volume nil) (put 'mpc-volume 'risky-local-variable t)
@@ -1937,10 +1931,8 @@ A value of t means the main playlist.")
(defvar mpc-previous-window-config nil)
-(defvar mpc-songs-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [remap mpc-select] #'mpc-songs-jump-to)
- map))
+(defvar-keymap mpc-songs-mode-map
+ "<remap> <mpc-select>" #'mpc-songs-jump-to)
(defvar mpc-songpointer-set-visible nil)