emacs-diffs
[Top][All Lists]
Advanced

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

master edcf9ed: Merge from origin/emacs-28


From: Glenn Morris
Subject: master edcf9ed: Merge from origin/emacs-28
Date: Wed, 27 Oct 2021 10:59:32 -0400 (EDT)

branch: master
commit edcf9edc8c038dc501c9e7f30b41a4fa776d0503
Merge: 7c6f7dc 2bdd573
Author: Glenn Morris <rgm@gnu.org>
Commit: Glenn Morris <rgm@gnu.org>

    Merge from origin/emacs-28
    
    2bdd5732aa (origin/emacs-28) ; * etc/NEWS: Fix last change.
    492b927909 Fix help commands for menu-bar menus
    9589be772d ; * etc/NEWS: Fix typos.
    d353fc4a00 ; Explain why "kinds of atom" isn't a typo
    47a3750162 ; * etc/NEWS: Improve wording of the Emoji entry.
    b814712796 ; Checkdoc fixes in image-dired.el
    e45b3fc521 Improve function documentation with text from XDG BDS spec
    284c77eeb6 * lisp/transient.el: Update to package version 0.3.7.
    40400e6977 ; Revert parts of "Use string-replace instead of replace-r...
    214c2e268c ; Revert parts of "Use string-search instead of string-mat...
    
    # Conflicts:
    #   etc/NEWS
---
 doc/lispintro/emacs-lisp-intro.texi |   4 +
 etc/NEWS.28                         |  47 ++---
 lisp/help.el                        |   8 +-
 lisp/image-dired.el                 |  97 +++++-----
 lisp/transient.el                   | 354 ++++++++++++++++++++----------------
 lisp/xdg.el                         |  66 ++++++-
 6 files changed, 342 insertions(+), 234 deletions(-)

diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index fba1094..060e023 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -1162,6 +1162,10 @@ computer.  Often, people use the term @dfn{expression}
 indiscriminately.  (Also, in many texts, the word @dfn{form} is used
 as a synonym for expression.)
 
+@c This and the next paragraph say ``kinds of atom'', but that is not
+@c a typo, just slightly ``old-fashioned wording which adds a fillip
+@c of interest to it'', and ``is more elegant writing'', according to
+@c RMS.
 Incidentally, the atoms that make up our universe were named such when
 they were thought to be indivisible; but it has been found that physical
 atoms are not indivisible.  Parts can split off an atom or it can
diff --git a/etc/NEWS.28 b/etc/NEWS.28
index 7f9797e..96104ad 100644
--- a/etc/NEWS.28
+++ b/etc/NEWS.28
@@ -146,41 +146,34 @@ of files visited via 'C-x C-f' and other commands.
 ** Emacs now supports Unicode Standard version 14.0.
 
 +++
-** New character script 'emoji' has been created.
-Various blocks of codepoints have been split out of the 'symbol'
-script into their own 'emoji' script to allow easier specification of
-their treatment.  Which codepoints are treated as emoji is derived
-from the Unicode specifications.  Also, Emacs will now use "Noto Color
-Emoji" by default for that script.  Use:
+** Improved support for Emoji.
+On capable systems, Emacs now correctly displays Emoji and Emoji
+sequences by default, provided that a suitable font is available to
+Emacs.  With a few exceptions, all of the Emoji sequences specified by
+Unicode 14.0 are automatically composed and displayed as a single
+colorful glyph.  This is achieved by changes in the Emacs font
+configuration, and by additional character-composition rules for the
+Emoji codepoints that follow from the Unicode-defined sequences.
+
+If your system lacks a suitable font, we recommend to install "Noto
+Color Emoji"; Emacs will use it automatically if it's installed.  If
+you prefer to use another font for Emoji, customize your fontset like
+this:
 
     (set-fontset-font t 'emoji
                       '("My New Emoji Font" . "iso10646-1") nil 'prepend)
 
-to change the font used.
-
-+++
-** Zero Width Joiner (ZWJ) and emoji sequences are now composed.
-Emacs can now compose (almost) all the Unicode-14 ZWJ and emoji
-sequences (if a suitable font is installed) so that they are displayed
-as single glyphs instead of multiple ones.  "Noto Color Emoji" is one
-such suitable font.
-
-+++
-** Composition of emoji has been improved.
-If autocomposition is triggered by an emoji character, then the emoji
-font is now used to check if composition can be performed, rather than
-the font of the first character of the string being composed.  This
-allows e.g.
-
-    'Emoji codepoint' + VS-16
-
-to be displayed using the emoji font even if 'Emoji codepoint' does
-not have emoji presentation by default.
+The Emoji characters are now assigned to a special script, 'emoji', so
+as to make it easier to customize fontsets for Emoji display, as in
+the above example.  (Previously, the Emoji characters were assigned to
+the 'symbol' script, together with other symbol and punctuation
+characters.)
 
 +++
 ** 'glyphless-char-display-control' now applies to Variation Selectors.
 VS-1 through VS-16 are now displayed as 'thin-space' by default when
-not composed.
+not composed with previous characters (typically, as part of Emoji
+sequences).
 
 +++
 ** New command 'execute-extended-command-for-buffer'.
diff --git a/lisp/help.el b/lisp/help.el
index 510dee7..deeb892 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -701,7 +701,13 @@ in the selected window."
          ;; is selected from the context menu that should describe KEY
          ;; at the position of mouse click that opened the context menu.
          ;; When no mouse was involved, don't use `mouse-set-point'.
-         (defn (if buffer (key-binding key t)
+         (defn (if (or buffer
+                       ;; Clicks on the menu bar produce "event" that
+                       ;; is just '(menu-bar)', for which
+                       ;; `mouse-set-point' is not useful.
+                       (and (not (windowp (posn-window (event-start event))))
+                            (not (framep (posn-window (event-start event))))))
+                   (key-binding key t)
                  (save-excursion (mouse-set-point event) (key-binding key 
t)))))
     ;; Handle the case where we faked an entry in "Select and Paste" menu.
     (when (and (eq defn nil)
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index f6a2637..2eddf3c 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -45,7 +45,7 @@
 ;; currently keep all my 2000+ images in the same directory) and
 ;; browsing the thumbnail buffer was slow too.  image-dired.el will not
 ;; create thumbnails until they are needed and the browsing is done
-;; quickly and easily in dired.  I copied a great deal of ideas and
+;; quickly and easily in Dired.  I copied a great deal of ideas and
 ;; code from there though... :)
 ;;
 ;;  `image-dired' stores the thumbnail files in `image-dired-dir'
@@ -164,7 +164,7 @@
   (require 'wid-edit))
 
 (defgroup image-dired nil
-  "Use dired to browse your images as thumbnails, and more."
+  "Use Dired to browse your images as thumbnails, and more."
   :prefix "image-dired-"
   :link '(info-link "(emacs) Image-Dired")
   :group 'multimedia)
@@ -538,18 +538,18 @@ This value can be toggled using 
`image-dired-toggle-append-browsing'."
   :type 'boolean)
 
 (defcustom image-dired-dired-disp-props t
-  "If non-nil, display properties for dired file when browsing.
+  "If non-nil, display properties for Dired file when browsing.
 Used by `image-dired-next-line-and-display',
 `image-dired-previous-line-and-display' and 
`image-dired-mark-and-display-next'.
 If the database file is large, this can slow down image browsing in
-dired and you might want to turn it off."
+Dired and you might want to turn it off."
   :type 'boolean)
 
 (defcustom image-dired-display-properties-format "%b: %f (%t): %c"
   "Display format for thumbnail properties.
-%b is replaced with associated dired buffer name, %f with file name
-\(without path) of original image file, %t with the list of tags and %c
-with the comment."
+%b is replaced with associated Dired buffer name, %f with file
+name (without path) of original image file, %t with the list of
+tags and %c with the comment."
   :type 'string)
 
 (defcustom image-dired-external-viewer
@@ -880,7 +880,8 @@ Queued items live in `image-dired-queue'."
     (apply #'image-dired-create-thumb-1 (pop image-dired-queue))))
 
 (defun image-dired-create-thumb (original-file thumbnail-file)
-  "Add a job for generating thumbnail to `image-dired-queue'."
+  "Add a job for generating ORIGINAL-FILE thumbnail to `image-dired-queue'.
+The new file will be named THUMBNAIL-FILE."
   (setq image-dired-queue
         (nconc image-dired-queue
                (list (list original-file thumbnail-file))))
@@ -904,7 +905,7 @@ thumbnail."
 
 ;;;###autoload
 (defun image-dired-dired-toggle-marked-thumbs (&optional arg)
-  "Toggle thumbnails in front of file names in the dired buffer.
+  "Toggle thumbnails in front of file names in the Dired buffer.
 If no marked file could be found, insert or hide thumbnails on the
 current line.  ARG, if non-nil, specifies the files to use instead
 of the marked files.  If ARG is an integer, use the next ARG (or
@@ -935,7 +936,7 @@ previous -ARG, if ARG<0) files."
             'image-dired-dired-after-readin-hook nil t))
 
 (defun image-dired-dired-after-readin-hook ()
-  "Relocate existing thumbnail overlays in dired buffer after reverting.
+  "Relocate existing thumbnail overlays in Dired buffer after reverting.
 Move them to their corresponding files if they still exist.
 Otherwise, delete overlays."
   (mapc (lambda (overlay)
@@ -948,7 +949,7 @@ Otherwise, delete overlays."
         (overlays-in (point-min) (point-max))))
 
 (defun image-dired-next-line-and-display ()
-  "Move to next dired line and display thumbnail image."
+  "Move to next Dired line and display thumbnail image."
   (interactive)
   (dired-next-line 1)
   (image-dired-display-thumbs
@@ -957,7 +958,7 @@ Otherwise, delete overlays."
       (image-dired-dired-display-properties)))
 
 (defun image-dired-previous-line-and-display ()
-  "Move to previous dired line and display thumbnail image."
+  "Move to previous Dired line and display thumbnail image."
   (interactive)
   (dired-previous-line 1)
   (image-dired-display-thumbs
@@ -976,7 +977,7 @@ Otherwise, delete overlays."
              "off")))
 
 (defun image-dired-mark-and-display-next ()
-  "Mark current file in dired and display next thumbnail image."
+  "Mark current file in Dired and display next thumbnail image."
   (interactive)
   (dired-mark 1)
   (image-dired-display-thumbs
@@ -1027,12 +1028,12 @@ Otherwise, delete overlays."
 
 Convenience command that:
 
- - Opens dired in folder DIR
+ - Opens Dired in folder DIR
  - Splits windows in most useful (?) way
- - Set `truncate-lines' to t
+ - Sets `truncate-lines' to t
 
 After the command has finished, you would typically mark some
-image files in dired and type
+image files in Dired and type
 \\[image-dired-display-thumbs] (`image-dired-display-thumbs').
 
 If called with prefix argument ARG, skip splitting of windows.
@@ -1087,7 +1088,7 @@ point (this is useful if you have marked some files but 
want to show
 another one).
 
 Recommended usage is to split the current frame horizontally so that
-you have the dired buffer in the left window and the
+you have the Dired buffer in the left window and the
 `image-dired-thumbnail-buffer' buffer in the right window.
 
 With optional argument APPEND, append thumbnail to thumbnail buffer
@@ -1234,7 +1235,7 @@ FILE-TAGS is an alist in the following form:
 
 ;;;###autoload
 (defun image-dired-tag-files (arg)
-  "Tag marked file(s) in dired.  With prefix ARG, tag file at point."
+  "Tag marked file(s) in Dired.  With prefix ARG, tag file at point."
   (interactive "P")
   (let ((tag (completing-read
               "Tags to add (separate tags with a semicolon): "
@@ -1295,7 +1296,7 @@ With prefix argument ARG, remove tag from file at point."
       (abbreviate-file-name f))))
 
 (defun image-dired-associated-dired-buffer ()
-  "Get associated dired buffer at point."
+  "Get associated Dired buffer at point."
   (get-text-property (point) 'associated-dired-buffer))
 
 (defun image-dired-get-buffer-window (buf)
@@ -1306,7 +1307,7 @@ With prefix argument ARG, remove tag from file at point."
    nil t))
 
 (defun image-dired-track-original-file ()
-  "Track the original file in the associated dired buffer.
+  "Track the original file in the associated Dired buffer.
 See documentation for `image-dired-toggle-movement-tracking'.
 Interactive use only useful if `image-dired-track-movement' is nil."
   (interactive)
@@ -1321,7 +1322,7 @@ Interactive use only useful if 
`image-dired-track-movement' is nil."
 
 (defun image-dired-toggle-movement-tracking ()
   "Turn on and off `image-dired-track-movement'.
-Tracking of the movements between thumbnail and dired buffer so that
+Tracking of the movements between thumbnail and Dired buffer so that
 they are \"mirrored\" in the dired buffer.  When this is on, moving
 around in the thumbnail or dired buffer will find the matching
 position in the other buffer."
@@ -1330,7 +1331,7 @@ position in the other buffer."
   (message "Tracking %s" (if image-dired-track-movement "on" "off")))
 
 (defun image-dired-track-thumbnail ()
-  "Track current dired file's thumb in `image-dired-thumbnail-buffer'.
+  "Track current Dired file's thumb in `image-dired-thumbnail-buffer'.
 This is almost the same as what `image-dired-track-original-file' does,
 but the other way around."
   (let ((file (dired-get-filename))
@@ -1476,7 +1477,7 @@ image."
 
 (defun image-dired-format-properties-string (buf file props comment)
   "Format display properties.
-BUF is the associated dired buffer, FILE is the original image file
+BUF is the associated Dired buffer, FILE is the original image file
 name, PROPS is a stringified list of tags and COMMENT is the image file's
 comment."
   (format-spec
@@ -1510,10 +1511,10 @@ comment."
     (looking-at-p dired-re-mark)))
 
 (defun image-dired-modify-mark-on-thumb-original-file (command)
-  "Modify mark in dired buffer.
-COMMAND is one of `mark' for marking file in dired, `unmark' for
-unmarking file in dired or `flag' for flagging file for delete in
-dired."
+  "Modify mark in Dired buffer.
+COMMAND is one of `mark' for marking file in Dired, `unmark' for
+unmarking file in Dired or `flag' for flagging file for delete in
+Dired."
   (let ((file-name (image-dired-original-file-name))
         (dired-buf (image-dired-associated-dired-buffer)))
     (if (not (and dired-buf file-name))
@@ -1531,25 +1532,25 @@ dired."
           (image-dired-thumb-update-marks))))))
 
 (defun image-dired-mark-thumb-original-file ()
-  "Mark original image file in associated dired buffer."
+  "Mark original image file in associated Dired buffer."
   (interactive)
   (image-dired-modify-mark-on-thumb-original-file 'mark)
   (image-dired-forward-image))
 
 (defun image-dired-unmark-thumb-original-file ()
-  "Unmark original image file in associated dired buffer."
+  "Unmark original image file in associated Dired buffer."
   (interactive)
   (image-dired-modify-mark-on-thumb-original-file 'unmark)
   (image-dired-forward-image))
 
 (defun image-dired-flag-thumb-original-file ()
-  "Flag original image file for deletion in associated dired buffer."
+  "Flag original image file for deletion in associated Dired buffer."
   (interactive)
   (image-dired-modify-mark-on-thumb-original-file 'flag)
   (image-dired-forward-image))
 
 (defun image-dired-toggle-mark-thumb-original-file ()
-  "Toggle mark on original image file in associated dired buffer."
+  "Toggle mark on original image file in associated Dired buffer."
   (interactive)
   (image-dired-modify-mark-on-thumb-original-file 'toggle))
 
@@ -1562,7 +1563,7 @@ Do this in the Dired buffer and update this thumbnail 
buffer."
   (image-dired-thumb-update-marks))
 
 (defun image-dired-jump-original-dired-buffer ()
-  "Jump to the dired buffer associated with the current image file.
+  "Jump to the Dired buffer associated with the current image file.
 You probably want to use this together with
 `image-dired-track-original-file'."
   (interactive)
@@ -1763,7 +1764,7 @@ You probably want to use this together with
 
 (define-derived-mode image-dired-thumbnail-mode
   special-mode "image-dired-thumbnail"
-  "Browse and manipulate thumbnail images using dired.
+  "Browse and manipulate thumbnail images using Dired.
 Use `image-dired-minor-mode' to get a nice setup."
   (buffer-disable-undo)
   (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil 
t)
@@ -1831,7 +1832,7 @@ Resized or in full-size."
 
 ;;;###autoload
 (define-minor-mode image-dired-minor-mode
-  "Setup easy-to-use keybindings for the commands to be used in dired mode.
+  "Setup easy-to-use keybindings for the commands to be used in Dired mode.
 Note that n, p and <down> and <up> will be hijacked and bound to
 `image-dired-dired-x-line'."
   :keymap image-dired-minor-mode-map)
@@ -1839,7 +1840,7 @@ Note that n, p and <down> and <up> will be hijacked and 
bound to
 (declare-function clear-image-cache "image.c" (&optional filter))
 
 (defun image-dired-create-thumbs (&optional arg)
-  "Create thumbnail images for all marked files in dired.
+  "Create thumbnail images for all marked files in Dired.
 With prefix argument ARG, create thumbnails even if they already exist
 \(i.e. use this to refresh your thumbnails)."
   (interactive "P")
@@ -2016,7 +2017,7 @@ Ask user how many thumbnails should be displayed per row."
    nil t))
 
 (defun image-dired-associated-dired-buffer-window ()
-  "Return window where associated dired buffer is visible."
+  "Return window where associated Dired buffer is visible."
   (let (buf)
     (if (image-dired-image-at-point-p)
         (progn
@@ -2329,7 +2330,7 @@ FILE-COMMENTS is an alist on the following form:
 
 ;;;###autoload
 (defun image-dired-dired-comment-files ()
-  "Add comment to current or marked files in dired."
+  "Add comment to current or marked files in Dired."
   (interactive)
   (let ((comment (image-dired-read-comment)))
     (image-dired-write-comments
@@ -2381,7 +2382,7 @@ A `tag' is a keyword, a piece of meta data, associated 
with an
 image file and stored in image-dired's database file.  This command
 lets you input a regexp and this will be matched against all tags
 on all image files in the database file.  The files that have a
-matching tag will be marked in the dired buffer."
+matching tag will be marked in the Dired buffer."
   (interactive)
   (image-dired-sane-db-file)
   (let ((tag (read-string "Mark tagged files (regexp): "))
@@ -2410,7 +2411,7 @@ matching tag will be marked in the dired buffer."
 
 (defun image-dired-mouse-display-image (event)
   "Use mouse EVENT, call `image-dired-display-image' to display image.
-Track this in associated dired buffer if `image-dired-track-movement' is
+Track this in associated Dired buffer if `image-dired-track-movement' is
 non-nil."
   (interactive "e")
   (mouse-set-point event)
@@ -2427,7 +2428,7 @@ non-nil."
 
 (defun image-dired-mouse-select-thumbnail (event)
   "Use mouse EVENT to select thumbnail image.
-Track this in associated dired buffer if `image-dired-track-movement' is
+Track this in associated Dired buffer if `image-dired-track-movement' is
 non-nil."
   (interactive "e")
   (mouse-set-point event)
@@ -2439,7 +2440,7 @@ non-nil."
   (image-dired-display-thumb-properties))
 
 (defun image-dired-thumb-file-marked-p ()
-  "Check if file is marked in associated dired buffer."
+  "Check if file is marked in associated Dired buffer."
   (let ((file-name (image-dired-original-file-name))
         (dired-buf (image-dired-associated-dired-buffer)))
     (when (and dired-buf file-name)
@@ -2475,18 +2476,18 @@ non-nil."
             (forward-char)))))))
 
 (defun image-dired-mouse-toggle-mark-1 ()
-  "Toggle dired mark for current thumbnail.
-Track this in associated dired buffer if `image-dired-track-movement' is
-non-nil."
+  "Toggle Dired mark for current thumbnail.
+Track this in associated Dired buffer if
+`image-dired-track-movement' is non-nil."
   (when image-dired-track-movement
     (image-dired-track-original-file))
   (image-dired-toggle-mark-thumb-original-file))
 
 (defun image-dired-mouse-toggle-mark (event)
-  "Use mouse EVENT to toggle dired mark for thumbnail.
+  "Use mouse EVENT to toggle Dired mark for thumbnail.
 Toggle marks of all thumbnails in region, if it's active.
-Track this in associated dired buffer if `image-dired-track-movement' is
-non-nil."
+Track this in associated Dired buffer if
+`image-dired-track-movement' is non-nil."
   (interactive "e")
   (if (use-region-p)
       (let ((end (region-end)))
@@ -2502,7 +2503,7 @@ non-nil."
   (image-dired-thumb-update-marks))
 
 (defun image-dired-dired-display-properties ()
-  "Display properties for dired file in the echo area."
+  "Display properties for Dired file in the echo area."
   (interactive)
   (let* ((file (dired-get-filename))
          (file-name (file-name-nondirectory file))
diff --git a/lisp/transient.el b/lisp/transient.el
index 77bf41d..d0ba854 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -7,7 +7,7 @@
 ;; Keywords: bindings
 
 ;; Package-Requires: ((emacs "25.1"))
-;; Package-Version: 0.3.6
+;; Package-Version: 0.3.7
 
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 
@@ -54,6 +54,7 @@
 
 (require 'cl-lib)
 (require 'eieio)
+(require 'edmacro)
 (require 'format-spec)
 (require 'seq)
 
@@ -74,7 +75,7 @@
 (define-obsolete-function-alias 'define-infix-command
   'transient-define-infix "Transient 0.3.0")
 (define-obsolete-function-alias 'define-infix-argument
-  'transient-define-argument "Transient 0.3.0")
+  #'transient-define-argument "Transient 0.3.0")
 
 (define-obsolete-variable-alias 'current-transient-prefix
   'transient-current-prefix "Transient 0.3.0")
@@ -148,34 +149,46 @@ features are available:
 (defcustom transient-display-buffer-action
   '(display-buffer-in-side-window
     (side . bottom)
-    (inhibit-same-window . t))
+    (dedicated . t)
+    (inhibit-same-window . t)
+    (window-parameters (no-other-window . t)))
   "The action used to display the transient popup buffer.
 
 The transient popup buffer is displayed in a window using
 
-  \(display-buffer buf transient-display-buffer-action)
+  (display-buffer BUFFER transient-display-buffer-action)
 
 The value of this option has the form (FUNCTION . ALIST),
 where FUNCTION is a function or a list of functions.  Each such
-function should accept two arguments: a buffer to display and
-an alist of the same form as ALIST.  See `display-buffer' for
-details.
+function should accept two arguments: a buffer to display and an
+alist of the same form as ALIST.  See info node `(elisp)Choosing
+Window' for details.
 
 The default is:
 
   (display-buffer-in-side-window
     (side . bottom)
-    (inhibit-same-window . t))
+    (dedicated . t)
+    (inhibit-same-window . t)
+    (window-parameters (no-other-window . t)))
 
 This displays the window at the bottom of the selected frame.
-Another useful value is (display-buffer-below-selected).  This
-is what `magit-popup' used by default.  For more alternatives
-see info node `(elisp)Display Action Functions'.
+Another useful FUNCTION is `display-buffer-below-selected', which
+is what `magit-popup' used by default.  For more alternatives see
+info node `(elisp)Display Action Functions' and info node
+`(elisp)Buffer Display Action Alists'.
+
+Note that the buffer that was current before the transient buffer
+is shown should remain the current buffer.  Many suffix commands
+act on the thing at point, if appropriate, and if the transient
+buffer became the current buffer, then that would change what is
+at point.  To that effect `inhibit-same-window' ensures that the
+selected window is not used to show the transient buffer.
 
 It may be possible to display the window in another frame, but
 whether that works in practice depends on the window-manager.
 If the window manager selects the new window (Emacs frame),
-then it doesn't work.
+then that unfortunately changes which buffer is current.
 
 If you change the value of this option, then you might also
 want to change the value of `transient-mode-line-format'."
@@ -569,7 +582,7 @@ If `transient-save-history' is nil, then do nothing."
     (transient-save-history)))
 
 (unless noninteractive
-  (add-hook 'kill-emacs-hook 'transient-maybe-save-history))
+  (add-hook 'kill-emacs-hook #'transient-maybe-save-history))
 
 ;;; Classes
 ;;;; Prefix
@@ -910,7 +923,7 @@ keyword.
        (put ',name 'transient--suffix
             (,(or class 'transient-switch) :command ',name ,@slots)))))
 
-(defalias 'transient-define-argument 'define-infix-command
+(defalias 'transient-define-argument #'transient-define-infix
   "Define NAME as a transient infix command.
 
 Only use this alias to define an infix command that actually
@@ -1061,7 +1074,8 @@ example, sets a variable use `transient-define-infix' 
instead.
           (put cmd 'transient--infix-command
                (transient--default-infix-command))
         ;; This is not an anonymous infix argument.
-        (error "Suffix %s is not defined or autoloaded as a command" cmd)))))
+        (when (transient--use-suffix-p obj)
+          (error "Suffix %s is not defined or autoloaded as a command" 
cmd))))))
 
 (defun transient--derive-shortarg (arg)
   (save-match-data
@@ -1415,14 +1429,14 @@ then just return it.  Otherwise return the symbol whose
 
 (defvar transient-base-map
   (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "ESC ESC ESC") 'transient-quit-all)
-    (define-key map (kbd "C-g") 'transient-quit-one)
-    (define-key map (kbd "C-q") 'transient-quit-all)
-    (define-key map (kbd "C-z") 'transient-suspend)
-    (define-key map (kbd "C-v") 'transient-scroll-up)
-    (define-key map (kbd "C-M-v") 'transient-scroll-down)
-    (define-key map [next]      'transient-scroll-up)
-    (define-key map [prior]     'transient-scroll-down)
+    (define-key map (kbd "ESC ESC ESC") #'transient-quit-all)
+    (define-key map (kbd "C-g")   #'transient-quit-one)
+    (define-key map (kbd "C-q")   #'transient-quit-all)
+    (define-key map (kbd "C-z")   #'transient-suspend)
+    (define-key map (kbd "C-v")   #'transient-scroll-up)
+    (define-key map (kbd "C-M-v") #'transient-scroll-down)
+    (define-key map [next]        #'transient-scroll-up)
+    (define-key map [prior]       #'transient-scroll-down)
     map)
   "Parent of other keymaps used by Transient.
 
@@ -1442,14 +1456,14 @@ to `transient-predicate-map'.")
 (defvar transient-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map transient-base-map)
-    (define-key map (kbd "C-p") 'universal-argument)
-    (define-key map (kbd "C--") 'negative-argument)
-    (define-key map (kbd "C-t") 'transient-show)
-    (define-key map (kbd "?")   'transient-help)
-    (define-key map (kbd "C-h") 'transient-help)
+    (define-key map (kbd "C-u")   #'universal-argument)
+    (define-key map (kbd "C--")   #'negative-argument)
+    (define-key map (kbd "C-t")   #'transient-show)
+    (define-key map (kbd "?")     #'transient-help)
+    (define-key map (kbd "C-h")   #'transient-help)
     ;; Also bound to "C-x p" and "C-x n" in transient-common-commands.
-    (define-key map (kbd "C-M-p") 'transient-history-prev)
-    (define-key map (kbd "C-M-n") 'transient-history-next)
+    (define-key map (kbd "C-M-p") #'transient-history-prev)
+    (define-key map (kbd "C-M-n") #'transient-history-next)
     map)
   "Top-level keymap used by all transients.
 
@@ -1459,16 +1473,16 @@ to `transient-predicate-map'.  Also see 
`transient-base-map'.")
 (defvar transient-edit-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map transient-base-map)
-    (define-key map (kbd "?")     'transient-help)
-    (define-key map (kbd "C-h")   'transient-help)
-    (define-key map (kbd "C-x l") 'transient-set-level)
+    (define-key map (kbd "?")     #'transient-help)
+    (define-key map (kbd "C-h")   #'transient-help)
+    (define-key map (kbd "C-x l") #'transient-set-level)
     map)
   "Keymap that is active while a transient in is in \"edit mode\".")
 
 (defvar transient-sticky-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map transient-base-map)
-    (define-key map (kbd "C-g") 'transient-quit-seq)
+    (define-key map (kbd "C-g") #'transient-quit-seq)
     map)
   "Keymap that is active while an incomplete key sequence is active.")
 
@@ -1503,36 +1517,36 @@ to `transient-predicate-map'.  Also see 
`transient-base-map'.")
 
 (defvar transient-predicate-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [handle-switch-frame]     'transient--do-suspend)
-    (define-key map [transient-suspend]       'transient--do-suspend)
-    (define-key map [transient-help]          'transient--do-stay)
-    (define-key map [transient-set-level]     'transient--do-stay)
-    (define-key map [transient-history-prev]  'transient--do-stay)
-    (define-key map [transient-history-next]  'transient--do-stay)
-    (define-key map [universal-argument]      'transient--do-stay)
-    (define-key map [negative-argument]       'transient--do-stay)
-    (define-key map [digit-argument]          'transient--do-stay)
-    (define-key map [transient-quit-all]      'transient--do-quit-all)
-    (define-key map [transient-quit-one]      'transient--do-quit-one)
-    (define-key map [transient-quit-seq]      'transient--do-stay)
-    (define-key map [transient-show]          'transient--do-stay)
-    (define-key map [transient-update]        'transient--do-stay)
-    (define-key map [transient-toggle-common] 'transient--do-stay)
-    (define-key map [transient-set]           'transient--do-call)
-    (define-key map [transient-save]          'transient--do-call)
-    (define-key map [describe-key-briefly]    'transient--do-stay)
-    (define-key map [describe-key]            'transient--do-stay)
-    (define-key map [transient-scroll-up]     'transient--do-stay)
-    (define-key map [transient-scroll-down]   'transient--do-stay)
-    (define-key map [mwheel-scroll]           'transient--do-stay)
-    (define-key map [scroll-bar-toolkit-scroll]   'transient--do-stay)
-    (define-key map [transient-noop]              'transient--do-noop)
-    (define-key map [transient-mouse-push-button] 'transient--do-move)
-    (define-key map [transient-push-button]       'transient--do-move)
-    (define-key map [transient-backward-button]   'transient--do-move)
-    (define-key map [transient-forward-button]    'transient--do-move)
-    (define-key map [transient-isearch-backward]  'transient--do-move)
-    (define-key map [transient-isearch-forward]   'transient--do-move)
+    (define-key map [handle-switch-frame]     #'transient--do-suspend)
+    (define-key map [transient-suspend]       #'transient--do-suspend)
+    (define-key map [transient-help]          #'transient--do-stay)
+    (define-key map [transient-set-level]     #'transient--do-stay)
+    (define-key map [transient-history-prev]  #'transient--do-stay)
+    (define-key map [transient-history-next]  #'transient--do-stay)
+    (define-key map [universal-argument]      #'transient--do-stay)
+    (define-key map [negative-argument]       #'transient--do-stay)
+    (define-key map [digit-argument]          #'transient--do-stay)
+    (define-key map [transient-quit-all]      #'transient--do-quit-all)
+    (define-key map [transient-quit-one]      #'transient--do-quit-one)
+    (define-key map [transient-quit-seq]      #'transient--do-stay)
+    (define-key map [transient-show]          #'transient--do-stay)
+    (define-key map [transient-update]        #'transient--do-stay)
+    (define-key map [transient-toggle-common] #'transient--do-stay)
+    (define-key map [transient-set]           #'transient--do-call)
+    (define-key map [transient-save]          #'transient--do-call)
+    (define-key map [describe-key-briefly]    #'transient--do-stay)
+    (define-key map [describe-key]            #'transient--do-stay)
+    (define-key map [transient-scroll-up]     #'transient--do-stay)
+    (define-key map [transient-scroll-down]   #'transient--do-stay)
+    (define-key map [mwheel-scroll]           #'transient--do-stay)
+    (define-key map [scroll-bar-toolkit-scroll]   #'transient--do-stay)
+    (define-key map [transient-noop]              #'transient--do-noop)
+    (define-key map [transient-mouse-push-button] #'transient--do-move)
+    (define-key map [transient-push-button]       #'transient--do-move)
+    (define-key map [transient-backward-button]   #'transient--do-move)
+    (define-key map [transient-forward-button]    #'transient--do-move)
+    (define-key map [transient-isearch-backward]  #'transient--do-move)
+    (define-key map [transient-isearch-forward]   #'transient--do-move)
     map)
   "Base keymap used to map common commands to their transient behavior.
 
@@ -1606,22 +1620,23 @@ of the corresponding object.")
              (sym (transient--suffix-symbol cmd)))
         (cond
          ((oref obj inapt)
-          (define-key map (vector sym) 'transient--do-warn-inapt))
+          (define-key map (vector sym) #'transient--do-warn-inapt))
          ((slot-boundp obj 'transient)
           (define-key map (vector sym)
             (let ((do (oref obj transient)))
               (pcase do
-                (`t (if sub-prefix
-                        'transient--do-replace
-                      'transient--do-stay))
+                (`t (cond (sub-prefix #'transient--do-replace)
+                          ((cl-typep obj 'transient-infix)
+                           #'transient--do-stay)
+                          (t #'transient--do-call)))
                 (`nil 'transient--do-exit)
                 (_ do)))))
          ((not (lookup-key transient-predicate-map (vector sym)))
           (define-key map (vector sym)
             (if sub-prefix
-                'transient--do-replace
+                #'transient--do-replace
               (or (oref transient--prefix transient-suffix)
-                  'transient--do-exit)))))))
+                  #'transient--do-exit)))))))
     map))
 
 (defun transient--make-redisplay-map ()
@@ -1649,7 +1664,7 @@ of the corresponding object.")
                   (listp def)
                   (keymapp def))
          (define-key topmap (vconcat transient--redisplay-key (list key))
-           'transient-update)))
+           #'transient-update)))
      (if transient--redisplay-key
          (lookup-key transient--transient-map (vconcat 
transient--redisplay-key))
        transient--transient-map))
@@ -1678,7 +1693,7 @@ EDIT may be non-nil."
       (transient--pop-keymap 'transient--redisplay-map)
       (setq name (oref transient--prefix command))
       (setq params (list :scope (oref transient--prefix scope))))
-     (transient--transient-map
+     (transient--prefix
       ;; Invoked as a ":transient-non-suffix 'transient--do-{stay,call}"
       ;; of an outer prefix.  Unlike the usual `transient--do-replace',
       ;; these predicates fail to clean up after the outer prefix.
@@ -1953,8 +1968,10 @@ value.  Otherwise return CHILDREN as is."
 (defun transient--delete-window ()
   (when (window-live-p transient--window)
     (let ((buf (window-buffer transient--window)))
-      (with-demoted-errors "Error while exiting transient: %S"
-        (delete-window transient--window))
+      ;; Only delete the window if it never showed another buffer.
+      (unless (eq (car (window-parameter transient--window 'quit-restore)) 
'other)
+        (with-demoted-errors "Error while exiting transient: %S"
+          (delete-window transient--window)))
       (kill-buffer buf))))
 
 (defun transient--export ()
@@ -2093,8 +2110,8 @@ value.  Otherwise return CHILDREN as is."
 
 (defun transient--emergency-exit ()
   "Exit the current transient command after an error occurred.
-When no transient is active (i.e. when `transient--prefix') is
-nil, then do nothing."
+When no transient is active (i.e. when `transient--prefix' is
+nil) then do nothing."
   (transient--debug 'emergency-exit)
   (when transient--prefix
     (setq transient--stack nil)
@@ -2171,17 +2188,17 @@ to `transient--do-warn'."
     (setq this-command 'transient-popup-navigation-help))
   transient--stay)
 
-(put 'transient--do-stay       'transient-color 'transient-blue)
-(put 'transient--do-noop       'transient-color 'transient-blue)
-(put 'transient--do-warn       'transient-color 'transient-blue)
-(put 'transient--do-warn-inapt 'transient-color 'transient-blue)
-(put 'transient--do-call       'transient-color 'transient-blue)
-(put 'transient--do-exit       'transient-color 'transient-red)
-(put 'transient--do-replace    'transient-color 'transient-red)
-(put 'transient--do-suspend    'transient-color 'transient-red)
-(put 'transient--do-quit-one   'transient-color 'transient-red)
-(put 'transient--do-quit-all   'transient-color 'transient-red)
-(put 'transient--do-move       'transient-color 'transient-blue)
+(put 'transient--do-stay       'transient-color 'transient-red)
+(put 'transient--do-noop       'transient-color 'transient-red)
+(put 'transient--do-warn       'transient-color 'transient-red)
+(put 'transient--do-warn-inapt 'transient-color 'transient-red)
+(put 'transient--do-call       'transient-color 'transient-red)
+(put 'transient--do-exit       'transient-color 'transient-blue)
+(put 'transient--do-replace    'transient-color 'transient-blue)
+(put 'transient--do-suspend    'transient-color 'transient-blue)
+(put 'transient--do-quit-one   'transient-color 'transient-blue)
+(put 'transient--do-quit-all   'transient-color 'transient-blue)
+(put 'transient--do-move       'transient-color 'transient-red)
 
 ;;; Commands
 
@@ -2209,7 +2226,18 @@ to `transient--do-warn'."
            (propertize "?"   'face 'transient-key)
            (propertize (symbol-name (transient--suffix-symbol
                                      this-original-command))
-                       'face 'font-lock-warning-face)))
+                       'face 'font-lock-warning-face))
+  (unless (and transient--transient-map
+               (memq transient--transient-map overriding-terminal-local-map))
+    (let ((transient--prefix (or transient--prefix 'sic)))
+      (transient--emergency-exit))
+    (view-lossage)
+    (other-window 1)
+    (display-warning 'transient "Inconsistent transient state detected.
+This should never happen.
+Please open an issue and post the shown command log.
+This is a heisenbug, so any additional details might help.
+Thanks!" :error)))
 
 (defun transient-toggle-common ()
   "Toggle whether common commands are always shown."
@@ -2407,14 +2435,14 @@ Non-infix suffix commands usually don't have a value."
 
 (cl-defmethod transient-init-value :around ((obj transient-prefix))
   "If bound, then call OBJ's `init-value' function.
-Otherwise call the primary method according to objects class."
+Otherwise call the primary method according to object's class."
   (if (slot-boundp obj 'init-value)
       (funcall (oref obj init-value) obj)
     (cl-call-next-method obj)))
 
 (cl-defmethod transient-init-value :around ((obj transient-infix))
   "If bound, then call OBJ's `init-value' function.
-Otherwise call the primary method according to objects class."
+Otherwise call the primary method according to object's class."
   (if (slot-boundp obj 'init-value)
       (funcall (oref obj init-value) obj)
     (cl-call-next-method obj)))
@@ -2595,13 +2623,12 @@ stand-alone command."
     (cl-block nil
       (while t
         (let ((str (read-from-minibuffer prompt initial-input nil nil 
history)))
-          (cond ((string-equal str "")
-                 (cl-return nil))
-                ((string-match-p (if include-zero
-                                     "\\`\\(0\\|[1-9][0-9]*\\)\\'"
-                                   "\\`[1-9][0-9]*\\'")
-                                 str)
-                 (cl-return str))))
+          (when (or (string-equal str "")
+                    (string-match-p (if include-zero
+                                        "\\`\\(0\\|[1-9][0-9]*\\)\\'"
+                                      "\\`[1-9][0-9]*\\'")
+                                    str))
+            (cl-return str)))
         (message "Please enter a natural number (%s zero)."
                  (if include-zero "including" "excluding"))
         (sit-for 1)))))
@@ -2670,7 +2697,10 @@ prompt."
                (oref obj argument-regexp))))
     (if-let ((sic (and value arg transient--unset-incompatible))
              (spec (oref transient--prefix incompatible))
-             (incomp (remove arg (cl-find-if (lambda (elt) (member arg elt)) 
spec))))
+             (incomp (cl-mapcan (lambda (rule)
+                                  (and (member arg rule)
+                                       (remove arg rule)))
+                                spec)))
         (progn
           (cl-call-next-method obj value)
           (dolist (arg incomp)
@@ -2703,7 +2733,7 @@ If the current command was invoked from the transient 
prefix
 command PREFIX, then return the active infix arguments.  If
 the current command was not invoked from PREFIX, then return
 the set, saved or default value for PREFIX."
-  (delq nil (mapcar 'transient-infix-value (transient-suffixes prefix))))
+  (delq nil (mapcar #'transient-infix-value (transient-suffixes prefix))))
 
 (defun transient-suffixes (prefix)
   "Return the suffix objects of the transient prefix command PREFIX."
@@ -2714,11 +2744,12 @@ the set, saved or default value for PREFIX."
        (transient--init-suffixes prefix)))))
 
 (defun transient-get-value ()
-  (delq nil (mapcar (lambda (obj)
-                      (and (or (not (slot-exists-p obj 'unsavable))
-                               (not (oref obj unsavable)))
-                           (transient-infix-value obj)))
-                    transient-current-suffixes)))
+  (transient--with-emergency-exit
+    (delq nil (mapcar (lambda (obj)
+                        (and (or (not (slot-exists-p obj 'unsavable))
+                                 (not (oref obj unsavable)))
+                             (transient-infix-value obj)))
+                      transient-current-suffixes))))
 
 (cl-defgeneric transient-infix-value (obj)
   "Return the value of the suffix object OBJ.
@@ -2860,16 +2891,11 @@ have a history of their own.")
   (setq transient--showp t)
   (let ((buf (get-buffer-create transient--buffer-name))
         (focus nil))
-    (unless (window-live-p transient--window)
-      (setq transient--window
-            (display-buffer buf transient-display-buffer-action)))
-    (with-selected-window transient--window
+    (with-current-buffer buf
       (when transient-enable-popup-navigation
-        (setq focus (button-get (point) 'command)))
+        (setq focus (or (button-get (point) 'command)
+                        (transient--heading-at-point))))
       (erase-buffer)
-      (set-window-hscroll transient--window 0)
-      (set-window-dedicated-p transient--window t)
-      (set-window-parameter transient--window 'no-other-window t)
       (setq window-size-fixed t)
       (when (bound-and-true-p tab-line-format)
         (setq tab-line-format nil))
@@ -2896,14 +2922,26 @@ have a history of their own.")
                  'transient-separator)))
           (insert (propertize "__" 'face face 'display '(space :height (1))))
           (insert (propertize "\n" 'face face 'line-height t))))
-      (let ((window-resize-pixelwise t)
-            (window-size-fixed nil))
-        (fit-window-to-buffer nil nil 1))
       (goto-char (point-min))
       (when transient-force-fixed-pitch
         (transient--force-fixed-pitch))
       (when transient-enable-popup-navigation
-        (transient--goto-button focus)))))
+        (transient--goto-button focus)))
+    (unless (window-live-p transient--window)
+      (setq transient--window
+            (display-buffer buf transient-display-buffer-action)))
+    (when (window-live-p transient--window)
+      (with-selected-window transient--window
+        (magit--fit-window-to-buffer transient--window)))))
+
+(defun magit--fit-window-to-buffer (window)
+  (let ((window-resize-pixelwise t)
+        (window-size-fixed nil))
+    (if (eq (car (window-parameter window 'quit-restore)) 'other)
+        ;; Grow but never shrink window that previously displayed
+        ;; another buffer and is going to display that again.
+        (fit-window-to-buffer window nil (window-height window))
+      (fit-window-to-buffer window nil 1))))
 
 (defun transient--insert-groups ()
   (let ((groups (cl-mapcan (lambda (group)
@@ -2946,7 +2984,7 @@ have a history of their own.")
           (mapcar
            (lambda (column)
              (transient--maybe-pad-keys column group)
-             (let ((rows (mapcar 'transient-format (oref column suffixes))))
+             (let ((rows (mapcar #'transient-format (oref column suffixes))))
                (when-let ((desc (transient-format-description column)))
                  (push desc rows))
                rows))
@@ -3064,18 +3102,18 @@ Optional support for popup buttons is also implemented 
here."
            ((equal (seq-take seq len) transient--redisplay-key)
             (let ((pre (key-description (vconcat (seq-take seq len))))
                   (suf (key-description (vconcat (seq-drop seq len)))))
-              (setq pre (string-replace "RET" "C-m" pre))
-              (setq pre (string-replace "TAB" "C-i" pre))
-              (setq suf (string-replace "RET" "C-m" suf))
-              (setq suf (string-replace "TAB" "C-i" suf))
+              (setq pre (replace-regexp-in-string "RET" "C-m" pre t))
+              (setq pre (replace-regexp-in-string "TAB" "C-i" pre t))
+              (setq suf (replace-regexp-in-string "RET" "C-m" suf t))
+              (setq suf (replace-regexp-in-string "TAB" "C-i" suf t))
               ;; We use e.g. "-k" instead of the more correct "- k",
               ;; because the former is prettier.  If we did that in
               ;; the definition, then we want to drop the space that
               ;; is reinserted above.  False-positives are possible
               ;; for silly bindings like "-C-c C-c".
-              (unless (string-search " " key)
-                (setq pre (string-replace " " "" pre))
-                (setq suf (string-replace " " "" suf)))
+              (unless (string-match-p " " key)
+                (setq pre (replace-regexp-in-string " " "" pre))
+                (setq suf (replace-regexp-in-string " " "" suf)))
               (concat (propertize pre 'face 'default)
                       (and (string-prefix-p (concat pre " ") key) " ")
                       (transient--colorize-key suf cmd)
@@ -3249,12 +3287,13 @@ Show the first one that is specified."
 
 (cl-defmethod transient-show-help ((obj transient-suffix))
   "Show the command doc-string."
-  (if (eq this-original-command 'transient-help)
+  (if (eq this-command 'transient-help)
       (if-let ((manpage (oref transient--prefix man-page)))
           (transient--show-manpage manpage)
         (transient--describe-function (oref transient--prefix command)))
     (if-let ((prefix (get (transient--suffix-command obj) 'transient--prefix))
-             (manpage (oref prefix man-page)))
+             (manpage (oref prefix man-page))
+             (- (not (eq this-command (oref transient--prefix command)))))
         (transient--show-manpage manpage)
       (transient--describe-function this-original-command))))
 
@@ -3366,9 +3405,9 @@ Suffixes on levels %s and %s are unavailable.\n"
 
 (defvar transient-resume-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [remap Man-quit]    'transient-resume)
-    (define-key map [remap Info-exit]   'transient-resume)
-    (define-key map [remap quit-window] 'transient-resume)
+    (define-key map [remap Man-quit]    #'transient-resume)
+    (define-key map [remap Info-exit]   #'transient-resume)
+    (define-key map [remap quit-window] #'transient-resume)
     map)
   "Keymap for `transient-resume-mode'.
 
@@ -3395,19 +3434,20 @@ resumes the suspended transient.")
               ;; Yes, I know that this is wrong(tm).
               ;; Unfortunately it is also necessary.
               (setq this-original-command command)
+              (transient--pre-command)
               (call-interactively command))))
 
 (defvar transient-popup-navigation-map
   (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "<down-mouse-1>") 'transient-noop)
-    (define-key map (kbd "<mouse-1>") 'transient-mouse-push-button)
-    (define-key map (kbd "RET")       'transient-push-button)
-    (define-key map (kbd "<up>")      'transient-backward-button)
-    (define-key map (kbd "C-p")       'transient-backward-button)
-    (define-key map (kbd "<down>")    'transient-forward-button)
-    (define-key map (kbd "C-n")       'transient-forward-button)
-    (define-key map (kbd "C-r")       'transient-isearch-backward)
-    (define-key map (kbd "C-s")       'transient-isearch-forward)
+    (define-key map (kbd "<down-mouse-1>") #'transient-noop)
+    (define-key map (kbd "<mouse-1>") #'transient-mouse-push-button)
+    (define-key map (kbd "RET")       #'transient-push-button)
+    (define-key map (kbd "<up>")      #'transient-backward-button)
+    (define-key map (kbd "C-p")       #'transient-backward-button)
+    (define-key map (kbd "<down>")    #'transient-forward-button)
+    (define-key map (kbd "C-n")       #'transient-forward-button)
+    (define-key map (kbd "C-r")       #'transient-isearch-backward)
+    (define-key map (kbd "C-s")       #'transient-isearch-forward)
     map))
 
 (defun transient-mouse-push-button (&optional pos)
@@ -3436,22 +3476,32 @@ See `forward-button' for information about N."
     (forward-button n t)))
 
 (defun transient--goto-button (command)
-  (if (not command)
-      (forward-button 1)
+  (cond
+   ((stringp command)
+    (when (re-search-forward (concat "^" (regexp-quote command)) nil t)
+      (goto-char (match-beginning 0))))
+   (command
     (while (and (ignore-errors (forward-button 1))
                 (not (eq (button-get (button-at (point)) 'command) command))))
     (unless (eq (button-get (button-at (point)) 'command) command)
       (goto-char (point-min))
-      (forward-button 1))))
+      (forward-button 1)))))
+
+(defun transient--heading-at-point ()
+  (and (eq (get-text-property (point) 'face) 'transient-heading)
+       (let ((beg (line-beginning-position)))
+         (buffer-substring-no-properties
+          beg (next-single-property-change
+               beg 'face nil (line-end-position))))))
 
 ;;;; Popup Isearch
 
 (defvar transient--isearch-mode-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map isearch-mode-map)
-    (define-key map [remap isearch-exit]   'transient-isearch-exit)
-    (define-key map [remap isearch-cancel] 'transient-isearch-cancel)
-    (define-key map [remap isearch-abort]  'transient-isearch-abort)
+    (define-key map [remap isearch-exit]   #'transient-isearch-exit)
+    (define-key map [remap isearch-cancel] #'transient-isearch-cancel)
+    (define-key map [remap isearch-abort]  #'transient-isearch-abort)
     map))
 
 (defun transient-isearch-backward (&optional regexp-p)
@@ -3537,14 +3587,14 @@ search instead."
     (funcall fn arg-mode)
     (transient--resume-override t)))
 
-(advice-add 'edebug--recursive-edit :around 'transient--edebug--recursive-edit)
+(advice-add 'edebug--recursive-edit :around 
#'transient--edebug--recursive-edit)
 
 (defun transient--abort-edebug ()
   (when (bound-and-true-p edebug-active)
     (transient--emergency-exit)))
 
-(advice-add 'abort-recursive-edit :before 'transient--abort-edebug)
-(advice-add 'top-level :before 'transient--abort-edebug)
+(advice-add 'abort-recursive-edit :before #'transient--abort-edebug)
+(advice-add 'top-level :before #'transient--abort-edebug)
 
 (defun transient--edebug-command-p ()
   (and (bound-and-true-p edebug-active)
@@ -3558,12 +3608,12 @@ search instead."
 (defun transient--suspend-which-key-mode ()
   (when (bound-and-true-p which-key-mode)
     (which-key-mode -1)
-    (add-hook 'transient-exit-hook 'transient--resume-which-key-mode)))
+    (add-hook 'transient-exit-hook #'transient--resume-which-key-mode)))
 
 (defun transient--resume-which-key-mode ()
   (unless transient--prefix
     (which-key-mode 1)
-    (remove-hook 'transient-exit-hook 'transient--resume-which-key-mode)))
+    (remove-hook 'transient-exit-hook #'transient--resume-which-key-mode)))
 
 (defun transient-bind-q-to-quit ()
   "Modify some keymaps to bind \"q\" to the appropriate quit command.
@@ -3583,10 +3633,10 @@ that does that.  Of course \"Q\" may already be bound 
to something
 else, so that function binds \"M-q\" to that command instead.
 Of course \"M-q\" may already be bound to something else, but
 we stop there."
-  (define-key transient-base-map   "q" 'transient-quit-one)
-  (define-key transient-sticky-map "q" 'transient-quit-seq)
+  (define-key transient-base-map   "q" #'transient-quit-one)
+  (define-key transient-sticky-map "q" #'transient-quit-seq)
   (setq transient-substitute-key-function
-        'transient-rebind-quit-commands))
+        #'transient-rebind-quit-commands))
 
 (defun transient-rebind-quit-commands (obj)
   "See `transient-bind-q-to-quit'."
diff --git a/lisp/xdg.el b/lisp/xdg.el
index 75c8bce..aee0dca 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -50,15 +50,39 @@
          ,env))))
 
 (defun xdg-config-home ()
-  "Return the base directory for user specific configuration files."
+  "Return the base directory for user specific configuration files.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_CONFIG_HOME defines the base directory relative to
+    which user-specific configuration files should be stored.
+    If $XDG_CONFIG_HOME is either not set or empty, a default
+    equal to $HOME/.config should be used.\""
   (xdg--dir-home "XDG_CONFIG_HOME" "~/.config"))
 
 (defun xdg-cache-home ()
-  "Return the base directory for user specific cache files."
+  "Return the base directory for user specific cache files.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_CACHE_HOME defines the base directory relative to
+    which user-specific non-essential data files should be
+    stored.  If $XDG_CACHE_HOME is either not set or empty, a
+    default equal to $HOME/.cache should be used.\""
   (xdg--dir-home "XDG_CACHE_HOME" "~/.cache"))
 
 (defun xdg-data-home ()
-  "Return the base directory for user specific data files."
+  "Return the base directory for user specific data files.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_DATA_HOME defines the base directory relative to which
+    user-specific data files should be stored.  If $XDG_DATA_HOME is
+    either not set or empty, a default equal to $HOME/.local/share
+    should be used.\""
   (xdg--dir-home "XDG_DATA_HOME" "~/.local/share"))
 
 (defun xdg-state-home ()
@@ -79,18 +103,48 @@ According to the XDG Base Directory Specification version
   (xdg--dir-home "XDG_STATE_HOME" "~/.local/state"))
 
 (defun xdg-runtime-dir ()
-  "Return the value of $XDG_RUNTIME_DIR."
+  "Return the value of $XDG_RUNTIME_DIR.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_RUNTIME_DIR defines the base directory relative to
+    which user-specific non-essential runtime files and other
+    file objects (such as sockets, named pipes, ...) should be
+    stored.\""
   (getenv "XDG_RUNTIME_DIR"))
 
 (defun xdg-config-dirs ()
-  "Return the config directory search path as a list."
+  "Return the config directory search path as a list.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_CONFIG_DIRS defines the preference-ordered set of base
+    directories to search for configuration files in addition to
+    the $XDG_CONFIG_HOME base directory.  The directories in
+    $XDG_CONFIG_DIRS should be seperated with a colon ':'.
+
+    \"If $XDG_CONFIG_DIRS is either not set or empty, a value equal to
+    /etc/xdg should be used.\""
   (let ((env (getenv "XDG_CONFIG_DIRS")))
     (if (or (null env) (string= env ""))
         '("/etc/xdg")
       (parse-colon-path env))))
 
 (defun xdg-data-dirs ()
-  "Return the data directory search path as a list."
+  "Return the data directory search path as a list.
+
+According to the XDG Base Directory Specification version
+0.8 (8th May 2021):
+
+    \"$XDG_DATA_DIRS defines the preference-ordered set of base
+    directories to search for data files in addition to the
+    $XDG_DATA_HOME base directory.  The directories in
+    $XDG_DATA_DIRS should be seperated with a colon ':'.
+
+    \"If $XDG_DATA_DIRS is either not set or empty, a value equal
+    to /usr/local/share/:/usr/share/ should be used.\""
   (let ((env (getenv "XDG_DATA_DIRS")))
     (if (or (null env) (string= env ""))
         '("/usr/local/share/" "/usr/share/")



reply via email to

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