summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/gnus/gnus-cus.el4
-rw-r--r--lisp/help.el5
-rw-r--r--lisp/outline.el82
-rw-r--r--lisp/simple.el11
4 files changed, 57 insertions, 45 deletions
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index ddd939794dd..32c475239e5 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -36,11 +36,11 @@
(define-derived-mode gnus-custom-mode fundamental-mode "Gnus Customize"
"Major mode for editing Gnus customization buffers.
-The following commands are available:
+The following commands are available:\\<widget-keymap>
\\[widget-forward] Move to next button or editable field.
\\[widget-backward] Move to previous button or editable field.
-\\[widget-button-click] Activate button under the mouse pointer.
+\\[widget-button-click] Activate button under the mouse pointer.
\\[widget-button-press] Activate button under point.
Entry to this mode calls the value of `gnus-custom-mode-hook'
diff --git a/lisp/help.el b/lisp/help.el
index 92b87cf7999..0ec5b9c85b8 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1204,7 +1204,10 @@ Otherwise, return a new string."
(delete-char 2)
(let* ((fun (intern (buffer-substring (point) (1- end-point))))
(key (with-current-buffer orig-buf
- (where-is-internal fun keymap t))))
+ (where-is-internal fun
+ (and keymap
+ (list keymap))
+ t))))
(if (not key)
;; Function is not on any key.
(let ((op (point)))
diff --git a/lisp/outline.el b/lisp/outline.el
index 3aebc25e130..3503ba2265e 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -490,6 +490,10 @@ 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
@@ -1051,9 +1055,10 @@ Note that this does not hide the lines preceding the first heading line."
"Hide everything after this heading at deeper levels.
If non-nil, EVENT should be a mouse event."
(interactive (list last-nonmenu-event))
- (when (mouse-event-p event)
- (mouse-set-point event))
- (outline-flag-subtree t))
+ (save-excursion
+ (when (mouse-event-p event)
+ (mouse-set-point event))
+ (outline-flag-subtree t)))
(defun outline--make-button-overlay (type)
(let ((o (seq-find (lambda (o)
@@ -1061,6 +1066,7 @@ If non-nil, EVENT should be a mouse event."
(overlays-at (point)))))
(unless o
(setq o (make-overlay (point) (1+ (point))))
+ (overlay-put o 'evaporate t)
(overlay-put o 'follow-link 'mouse-face)
(overlay-put o 'mouse-face 'highlight)
(overlay-put o 'outline-button t))
@@ -1088,8 +1094,7 @@ If non-nil, EVENT should be a mouse event."
(overlays-at (point)))))
(unless o
(setq o (make-overlay (point) (1+ (point))))
- (overlay-put o 'follow-link 'mouse-face)
- (overlay-put o 'mouse-face 'highlight)
+ (overlay-put o 'evaporate t)
(overlay-put o 'outline-margin t))
(let ((icon (icon-elements (if (eq type 'close)
(if outline--use-rtl
@@ -1111,11 +1116,7 @@ If non-nil, EVENT should be a mouse event."
(save-excursion
(beginning-of-line)
(if use-margins
- (let ((o (outline--make-margin-overlay 'open)))
- (overlay-put o 'help-echo "Click to hide")
- (overlay-put o 'keymap
- (define-keymap
- "<mouse-2>" #'outline-hide-subtree)))
+ (outline--make-margin-overlay 'open)
(when (derived-mode-p 'special-mode)
(let ((inhibit-read-only t))
(insert " ")
@@ -1125,19 +1126,14 @@ If non-nil, EVENT should be a mouse event."
(overlay-put o 'keymap
(define-keymap
"RET" #'outline-hide-subtree
- "<mouse-2>" #'outline-hide-subtree
- "<left-margin> <mouse-1>" #'outline-hide-subtree)))))))
+ "<mouse-2>" #'outline-hide-subtree)))))))
(defun outline--insert-close-button (&optional use-margins)
(with-silent-modifications
(save-excursion
(beginning-of-line)
(if use-margins
- (let ((o (outline--make-margin-overlay 'close)))
- (overlay-put o 'help-echo "Click to show")
- (overlay-put o 'keymap
- (define-keymap
- "<mouse-2>" #'outline-show-subtree)))
+ (outline--make-margin-overlay 'close)
(when (derived-mode-p 'special-mode)
(let ((inhibit-read-only t))
(insert " ")
@@ -1147,8 +1143,7 @@ If non-nil, EVENT should be a mouse event."
(overlay-put o 'keymap
(define-keymap
"RET" #'outline-show-subtree
- "<mouse-2>" #'outline-show-subtree
- "<left-margin> <mouse-1>" #'outline-show-subtree)))))))
+ "<mouse-2>" #'outline-show-subtree)))))))
(defun outline--fix-up-all-buttons (&optional from to)
(when (or outline--use-buttons outline--use-margins)
@@ -1182,11 +1177,13 @@ If non-nil, EVENT should be a mouse event."
(define-obsolete-function-alias 'hide-leaves #'outline-hide-leaves "25.1")
(defun outline-show-subtree (&optional event)
- "Show everything after this heading at deeper levels."
+ "Show everything after this heading at deeper levels.
+If non-nil, EVENT should be a mouse event."
(interactive (list last-nonmenu-event))
- (when (mouse-event-p event)
- (mouse-set-point event))
- (outline-flag-subtree nil))
+ (save-excursion
+ (when (mouse-event-p event)
+ (mouse-set-point event))
+ (outline-flag-subtree nil)))
(define-obsolete-function-alias 'show-subtree #'outline-show-subtree "25.1")
@@ -1661,7 +1658,7 @@ Return either `hide-all', `headings-only', or `show-all'."
(< (save-excursion (outline-next-heading) (point))
(save-excursion (outline-end-of-subtree) (point)))))
-(defun outline-cycle ()
+(defun outline-cycle (&optional event)
"Cycle visibility state of the current heading line's body.
This cycles the visibility of the current heading line's subheadings
@@ -1669,23 +1666,28 @@ and body between `hide all', `headings only' and `show all'.
`Hide all' means hide all the subheadings and their bodies.
`Headings only' means show the subheadings, but not their bodies.
-`Show all' means show all the subheadings and their bodies."
- (interactive)
- (condition-case nil
- (pcase (outline--cycle-state)
- ('hide-all
- (if (outline-has-subheading-p)
- (progn (outline-show-children)
- (message "Only headings"))
+`Show all' means show all the subheadings and their bodies.
+
+If non-nil, EVENT should be a mouse event."
+ (interactive (list last-nonmenu-event))
+ (save-excursion
+ (when (mouse-event-p event)
+ (mouse-set-point event))
+ (condition-case nil
+ (pcase (outline--cycle-state)
+ ('hide-all
+ (if (outline-has-subheading-p)
+ (progn (outline-show-children)
+ (message "Only headings"))
+ (outline-show-subtree)
+ (message "Show all")))
+ ('headings-only
(outline-show-subtree)
- (message "Show all")))
- ('headings-only
- (outline-show-subtree)
- (message "Show all"))
- ('show-all
- (outline-hide-subtree)
- (message "Hide all")))
- (outline-before-first-heading nil)))
+ (message "Show all"))
+ ('show-all
+ (outline-hide-subtree)
+ (message "Hide all")))
+ (outline-before-first-heading nil))))
(defvar-local outline--cycle-buffer-state 'show-all
"Internal variable used for tracking buffer cycle state.")
diff --git a/lisp/simple.el b/lisp/simple.el
index 1b9bf9fa6d8..aed1547b15b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6887,6 +6887,11 @@ The return value is t if Transient Mark mode is enabled and the
mark is active; furthermore, if `use-empty-active-region' is nil,
the region must not be empty. Otherwise, the return value is nil.
+If `use-empty-active-region' is non-nil, there is one further
+caveat: If the user has used `mouse-1' to set point, but used the
+mouse to move point to a different character yet, this function
+returns nil.
+
For some commands, it may be appropriate to ignore the value of
`use-empty-active-region'; in that case, use `region-active-p'.
@@ -6894,8 +6899,10 @@ Also see the convenience functions `use-region-beginning' and
`use-region-end', which may be handy when writing `interactive'
specs."
(and (region-active-p)
- (or use-empty-active-region (> (region-end) (region-beginning)))
- t))
+ (or (> (region-end) (region-beginning))
+ (and use-empty-active-region
+ (not (eq (car-safe last-input-event) 'down-mouse-1))
+ (not (mouse-movement-p last-input-event))))))
(defun region-active-p ()
"Return t if Transient Mark mode is enabled and the mark is active.