From: Stefan Kangas Date: Sat, 25 Dec 2021 04:02:59 +0000 (+0100) Subject: Move mouse key bindings to gametree-mode-map X-Git-Tag: emacs-29.0.90~3463 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1faa1726f093886446879180997d8bd7426b30eb;p=emacs.git Move mouse key bindings to gametree-mode-map * lisp/play/gametree.el (gametree-mode-map): Move mouse key bindings here. --- 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