emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 96d2fb8d79 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/


From: Michael Albinus
Subject: master 96d2fb8d79 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Tue, 20 Sep 2022 12:36:38 -0400 (EDT)

branch: master
commit 96d2fb8d798fd8a3a7b34ccf46ed584384c7a9fe
Merge: 814fd3057f cefda4a6c5
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 Makefile.in             | 54 ++++++++++++++++----------------
 doc/lispref/frames.texi | 30 +++++++++++-------
 lisp/gnus/gnus-cus.el   |  4 +--
 lisp/help.el            |  5 ++-
 lisp/outline.el         | 82 +++++++++++++++++++++++++------------------------
 lisp/simple.el          | 11 +++++--
 6 files changed, 103 insertions(+), 83 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index c841804757..79a1d4204c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -380,37 +380,37 @@ bootstrap-all:
 actual-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) 
src-depending-on-lisp
 
 # ADVICE-ON-FAILURE-BEGIN:all
-#   You might try to:
-#   - run "make bootstrap", which might fix the problem
-#   - run "make V=1", which displays the full commands invoked by make,
-#   ​  to further investigate the problem
+# You might try to:
+# - run "make bootstrap", which might fix the problem
+# - run "make V=1", which displays the full commands invoked by make,
+#   to further investigate the problem
 # ADVICE-ON-FAILURE-END:all
 
 # ADVICE-ON-FAILURE-BEGIN:bootstrap
-#   You might try to:
-#   - run "make extraclean" and run "make" again (or, equivalently, run
-#   ​  "make bootstrap configure=default"), to rebuild Emacs with the
-#   ​  default configuration options, which might fix the problem
-#   - run "git clean -fdx" and run "make bootstrap" again, which might
-#   ​  fix the problem if "make bootstrap configure=default" did not
-#   ​  !BEWARE! "git clean -fdx" deletes all files that are not under
-#   ​  !BEWARE! version control, which means that all changes to such
-#   ​  !BEWARE! files will be lost and cannot be restored later
-#   - run "make V=1", which displays the full commands invoked by make,
-#   ​  to further investigate the problem
-#   - report the problem and ask for help by sending an email to
-#   ​  bug-gnu-emacs@gnu.org, mentioning at least the build error
-#   ​  message, the platform, and the repository revision displayed by
-#   ​  "git rev-parse HEAD"
+# You might try to:
+# - run "make extraclean" and run "make" again (or, equivalently, run
+#   "make bootstrap configure=default"), to rebuild Emacs with the
+#   default configuration options, which might fix the problem
+# - run "git clean -fdx" and run "make bootstrap" again, which might
+#   fix the problem if "make bootstrap configure=default" did not
+#   !BEWARE! "git clean -fdx" deletes all files that are not under
+#   !BEWARE! version control, which means that all changes to such
+#   !BEWARE! files will be lost and cannot be restored later
+# - run "make V=1", which displays the full commands invoked by make,
+#   to further investigate the problem
+# - report the problem and ask for help by sending an email to
+#   bug-gnu-emacs@gnu.org, mentioning at least the build error
+#   message, the platform, and the repository revision displayed by
+#   "git rev-parse HEAD"
 # ADVICE-ON-FAILURE-END:bootstrap
 
 advice-on-failure:
-       @echo
-       @echo "  \"make ${make-target}\" failed with exit status 
${exit-status}."
+       @echo >&2 '***'
+       @echo >&2 '*** '"\"make ${make-target}\" failed with exit status 
${exit-status}."
        @cat Makefile | \
          sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# 
ADVICE-ON-FAILURE-END:${make-target}/q};' | \
-         sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-'
-       @echo
+         sed 's/^# /*** /' | grep -v '^*** ADVICE-ON-FAILURE-' >&2
+       @echo >&2 '***'
        @exit ${exit-status}
 
 sanity-check:
@@ -418,12 +418,12 @@ sanity-check:
          '(progn (defun f (n) (if (= 0 n) 1 (* n (f (- n 1))))) (princ (f 
10)))' \
          2> /dev/null); \
        [ "X$$v" = "X3628800" ] && exit 0; \
-       echo; \
-       echo "  \"make ${make-target}\" succeeded, but Emacs is not 
functional."; \
+       echo >&2 '***'; \
+       echo >&2 '*** '"\"make ${make-target}\" succeeded, but Emacs is not 
functional."; \
        cat Makefile | \
          sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# 
ADVICE-ON-FAILURE-END:${make-target}/q};' | \
-         sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-'; \
-       echo; \
+         sed 's/^# /*** /' | grep -v '^*** ADVICE-ON-FAILURE-' >&2; \
+       echo >&2 '***'; \
        exit 1
 
 .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 
epaths-force-ns-self-contained etc-emacsver
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 262b86672d..e38a81d3e7 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2997,17 +2997,25 @@ explicit focus notifications.)
 @end defun
 
 @defvar after-focus-change-function
-This function is an extension point that code can use to receive a
-notification that focus has changed.
-
-This function is called with no arguments when Emacs notices that the
-set of focused frames may have changed.  Code wanting to do something
-when frame focus changes should use @code{add-function} to add a
-function to this one, and in this added function, re-scan the set of
-focused frames, calling @code{frame-focus-state} to retrieve the last
-known focus state of each frame.  Focus events are delivered
-asynchronously, and frame input focus according to an external system
-may not correspond to the notion of the Emacs selected frame.
+This function is called with no arguments when Emacs notices that a
+frame may have gotten or lost focus.  Focus events are delivered
+asynchronously, and may not be delivered in the expected order, so
+code that wants to do something depending on the state of focused
+frames have go through all the frames and check.
+
+For instance, here's a simple example function that sets the
+background color based on whether the frame has focus or not:
+
+@lisp
+(add-function :after after-focus-change-function
+              #'my-change-background)
+(defun my-change-background ()
+  (dolist (frame (frame-list))
+    (pcase (frame-focus-state frame)
+      (`t (set-face-background 'default "black" frame))
+      (`nil (set-face-background 'default "#404040" frame)))))
+@end lisp
+
 Multiple frames may appear to have input focus simultaneously due to
 focus event delivery differences, the presence of multiple Emacs
 terminals, and other factors, and code should be robust in the face of
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index ddd939794d..32c475239e 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 92b87cf799..0ec5b9c85b 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 3aebc25e13..3503ba2265 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 1b9bf9fa6d..aed1547b15 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]