diff options
author | Juri Linkov <juri@linkov.net> | 2023-01-11 21:37:33 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2023-01-11 21:37:33 +0200 |
commit | 4a8891a462e41e81a5232810b67d9d85f79bc515 (patch) | |
tree | 06f679d855d08313e89979ae91f01eca514dc636 /lisp/outline.el | |
parent | 384504edf35751eec2be9b52be5d3b250217d68f (diff) | |
download | emacs-4a8891a462e41e81a5232810b67d9d85f79bc515.tar.gz emacs-4a8891a462e41e81a5232810b67d9d85f79bc515.tar.bz2 emacs-4a8891a462e41e81a5232810b67d9d85f79bc515.zip |
* etc/NEWS: Mention incompatible changes in 'outline-minor-mode-cycle-map'.
* lisp/outline.el (outline-minor-mode-cycle--bind):
Add docstring (bug#60426).
(outline-minor-mode-cycle--bind): Default 'map' to
'outline-minor-mode-cycle-map'.
(outline-minor-mode-cycle-map): Improve docstring.
(outline-minor-mode): Move margin-cycling keys to
'outline-minor-mode-cycle-map'.
Diffstat (limited to 'lisp/outline.el')
-rw-r--r-- | lisp/outline.el | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/outline.el b/lisp/outline.el index 91f6040687b..0bfda8388ed 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -209,8 +209,14 @@ This option is only in effect when `outline-minor-mode-cycle' is non-nil." :version "28.1") (defvar outline-minor-mode-cycle) +(defvar outline-minor-mode-cycle-map) (defun outline-minor-mode-cycle--bind (map key binding &optional filter) - (define-key map key + "Define KEY as BINDING in MAP using FILTER. +The key takes effect only on the following conditions: +`outline-minor-mode-cycle' is non-nil, point is located on the heading line, +FILTER or `outline-minor-mode-cycle-filter' is nil or returns non-nil. +The argument MAP is optional and defaults to `outline-minor-mode-cycle-map'." + (define-key (or map outline-minor-mode-cycle-map) key `(menu-item "" ,binding ;; Filter out specific positions on the heading. @@ -227,8 +233,16 @@ This option is only in effect when `outline-minor-mode-cycle' is non-nil." (let ((map (make-sparse-keymap))) (outline-minor-mode-cycle--bind map (kbd "TAB") #'outline-cycle) (outline-minor-mode-cycle--bind map (kbd "<backtab>") #'outline-cycle-buffer) + (keymap-set map "<left-margin> <mouse-1>" 'outline-cycle) + (keymap-set map "<right-margin> <mouse-1>" 'outline-cycle) + (keymap-set map "<left-margin> S-<mouse-1>" 'outline-cycle-buffer) + (keymap-set map "<right-margin> S-<mouse-1>" 'outline-cycle-buffer) map) - "Keymap used by `outline-minor-mode-cycle'.") + "Keymap used as a parent of the `outline-minor-mode' keymap. +It contains key bindings that can be used to cycle visibility. +The recommended way to bind keys is with `outline-minor-mode-cycle--bind' +when the key should be enabled only when `outline-minor-mode-cycle' is +non-nil and point is located on the heading line.") (defvar outline-mode-map (let ((map (make-sparse-keymap))) @@ -518,10 +532,6 @@ See the command `outline-mode' for more information on this mode." :keymap (define-keymap :parent outline-minor-mode-cycle-map "<menu-bar>" outline-minor-mode-menu-bar-map - "<left-margin> <mouse-1>" 'outline-cycle - "<right-margin> <mouse-1>" 'outline-cycle - "<left-margin> S-<mouse-1>" 'outline-cycle-buffer - "<right-margin> S-<mouse-1>" 'outline-cycle-buffer (key-description outline-minor-mode-prefix) outline-mode-prefix-map) (if outline-minor-mode (progn |