diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-12-25 05:02:59 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-12-25 05:04:33 +0100 |
commit | 1faa1726f093886446879180997d8bd7426b30eb (patch) | |
tree | 726b693e8b91348ebe8a87eeabd6b5a86781bdcb /lisp/play | |
parent | 71eb1aac54e2143d40c16a9f67e76200f63e6561 (diff) | |
download | emacs-1faa1726f093886446879180997d8bd7426b30eb.tar.gz |
Move mouse key bindings to gametree-mode-map
* lisp/play/gametree.el (gametree-mode-map): Move mouse key
bindings here.
Diffstat (limited to 'lisp/play')
-rw-r--r-- | lisp/play/gametree.el | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el index cc9a6b7a4f0..ff4b97d884c 100644 --- a/lisp/play/gametree.el +++ b/lisp/play/gametree.el @@ -554,7 +554,32 @@ buffer, it is replaced by the new value. See the documentation for (gametree-hack-file-layout)) nil) + +;;;; Mouse commands + +(defun gametree-mouse-break-line-here (event) + (interactive "e") + (mouse-set-point event) + (gametree-break-line-here)) + +(defun gametree-mouse-show-children-and-entry (event) + (interactive "e") + (mouse-set-point event) + (gametree-show-children-and-entry)) + +(defun gametree-mouse-show-subtree (event) + (interactive "e") + (mouse-set-point event) + (outline-show-subtree)) + +(defun gametree-mouse-hide-subtree (event) + (interactive "e") + (mouse-set-point event) + (outline-hide-subtree)) + + ;;;; Key bindings + (defvar gametree-mode-map (let ((map (make-sparse-keymap))) (define-key map "\C-c\C-j" 'gametree-break-line-here) @@ -566,6 +591,14 @@ buffer, it is replaced by the new value. See the documentation for (define-key map "\C-c\C-y" 'gametree-save-and-hack-layout) (define-key map "\C-c;" 'gametree-insert-score) (define-key map "\C-c^" 'gametree-compute-and-insert-score) + (define-key map [M-down-mouse-2 M-mouse-2] + #'gametree-mouse-break-line-here) + (define-key map [S-down-mouse-1 S-mouse-1] + #'gametree-mouse-show-children-and-entry) + (define-key map [S-down-mouse-2 S-mouse-2] + #'gametree-mouse-show-subtree) + (define-key map [S-down-mouse-3 S-mouse-3] + #'gametree-mouse-hide-subtree) map)) (define-derived-mode gametree-mode outline-mode "GameTree" @@ -577,32 +610,6 @@ shogi, etc.) players, it is a slightly modified version of Outline mode. (auto-fill-mode 0) (add-hook 'write-contents-functions 'gametree-save-and-hack-layout nil t)) -;;;; Goodies for mousing users -(defun gametree-mouse-break-line-here (event) - (interactive "e") - (mouse-set-point event) - (gametree-break-line-here)) -(defun gametree-mouse-show-children-and-entry (event) - (interactive "e") - (mouse-set-point event) - (gametree-show-children-and-entry)) -(defun gametree-mouse-show-subtree (event) - (interactive "e") - (mouse-set-point event) - (outline-show-subtree)) -(defun gametree-mouse-hide-subtree (event) - (interactive "e") - (mouse-set-point event) - (outline-hide-subtree)) -(define-key gametree-mode-map [M-down-mouse-2 M-mouse-2] - 'gametree-mouse-break-line-here) -(define-key gametree-mode-map [S-down-mouse-1 S-mouse-1] - 'gametree-mouse-show-children-and-entry) -(define-key gametree-mode-map [S-down-mouse-2 S-mouse-2] - 'gametree-mouse-show-subtree) -(define-key gametree-mode-map [S-down-mouse-3 S-mouse-3] - 'gametree-mouse-hide-subtree) - (provide 'gametree) ;;; gametree.el ends here |