commit 50140585a29f132e5e0562142ec223bc8e6870a0 (HEAD, refs/remotes/origin/master)
Merge: 08bd066149f 8f3091defb3
Author: Stefan Kangas , but that's up to the mode.
+ "Function to return the buffer text corresponding to the cropped image.
+After cropping an image, the displayed image in the buffer will be updated
+to show the cropped image. Different modes will have different ways to
+represent this image data in a buffer, but that's up to the mode. For
+instance, an HTML-based mode might want to represent the image with
+
.
-The default action is to not alter the buffer text at all.
+The default action is to not alter the image's text in the buffer, and
+just return it.
-The function is called with two arguments: The first is the
-original buffer text, and the second parameter is the cropped
-image data.")
+The function is called with two arguments: the original buffer text,
+and the cropped image data.")
(defcustom image-cut-color "black"
- "Color to use for the rectangle cut from the image."
+ "Color to use for the rectangle that was cut from the image."
:type 'string
:version "29.1")
diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el
index 3e2b47a618f..15230c9e42a 100644
--- a/lisp/image/image-dired-dired.el
+++ b/lisp/image/image-dired-dired.el
@@ -57,11 +57,12 @@ image-dired-dired-disp-props
;;;###autoload
(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
- "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
-previous -ARG, if ARG<0) files."
+ "Toggle thumbnails in front of marked file names in the Dired buffer.
+If no file is marked, toggle display of thumbnail on the current file's line.
+ARG, if non-nil (interactively, the prefix argument), specifies the files
+whose thumbnail display to toggle instead of the marked files: if ARG is an
+integer, use the next ARG (or previous -ARG, if ARG<0) files; any other
+value of ARG means toggle thumbnail display of the current line's file."
(interactive "P" dired-mode)
(setq image-dired--generate-thumbs-start (current-time))
(dired-map-over-marks
@@ -91,8 +92,8 @@ image-dired-dired-toggle-marked-thumbs
(defun image-dired-dired-after-readin-hook ()
"Relocate existing thumbnail overlays in Dired buffer after reverting.
-Move them to their corresponding files if they still exist.
-Otherwise, delete overlays.
+Move each overlay to its corresponding file if it still exists.
+Otherwise, delete the overlay.
Used by `image-dired-dired-toggle-marked-thumbs'."
(mapc (lambda (overlay)
(when (overlay-get overlay 'put-image)
@@ -104,7 +105,7 @@ image-dired-dired-after-readin-hook
(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 its thumbnail image."
(interactive nil dired-mode)
(dired-next-line 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@@ -112,7 +113,7 @@ image-dired-next-line-and-display
(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 its thumbnail image."
(interactive nil dired-mode)
(dired-previous-line 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@@ -130,7 +131,7 @@ image-dired-toggle-append-browsing
"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 the next thumbnail image."
(interactive nil dired-mode)
(dired-mark 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@@ -148,7 +149,7 @@ image-dired-toggle-dired-display-properties
"off")))
(defun image-dired-track-thumbnail ()
- "Track current Dired file's thumb in `image-dired-thumbnail-buffer'.
+ "Move to thumbnail of the current Dired file 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))
@@ -170,18 +171,18 @@ image-dired-track-thumbnail
(image-dired--update-header-line))))))
(defun image-dired-dired-next-line (&optional arg)
- "Call `dired-next-line', then track thumbnail.
+ "Call `dired-next-line', while tracking the file's thumbnail.
This can safely replace `dired-next-line'.
-With prefix argument, move ARG lines."
+With prefix argument ARG, move that many lines."
(interactive "P" dired-mode)
(dired-next-line (or arg 1))
(if image-dired-track-movement
(image-dired-track-thumbnail)))
(defun image-dired-dired-previous-line (&optional arg)
- "Call `dired-previous-line', then track thumbnail.
+ "Call `dired-previous-line', while tracking the file's thumbnail.
This can safely replace `dired-previous-line'.
-With prefix argument, move ARG lines."
+With prefix argument ARG, move that many lines."
(interactive "P" dired-mode)
(dired-previous-line (or arg 1))
(if image-dired-track-movement
@@ -307,7 +308,8 @@ image-dired-display-thumb
;;;###autoload
(defun image-dired-dired-display-external ()
- "Display file at point using an external viewer."
+ "Display file at point using an external viewer.
+The viewer is specified by the value of `image-dired-external-viewer'."
(interactive nil dired-mode)
(let ((file (dired-get-filename)))
(start-process "image-dired-external" nil
@@ -323,15 +325,15 @@ image-dired-dired-display-image
(defun image-dired-copy-with-exif-file-name ()
"Copy file with unique name to main image directory.
-Copy current or all marked files in Dired to a new file in your
-main image directory, using a file name generated by
+Copy current or all files marked in Dired to new file(s) in your
+main image directory, using file name(s) generated by
`image-dired-get-exif-file-name'. A typical usage for this if when
copying images from a digital camera into the image directory.
- Typically, you would open up the folder with the incoming
+Typically, you would open up the folder with the incoming
digital images, mark the files to be copied, and execute this
-function. The result is a couple of new files in
-`image-dired-main-image-directory' called
+command. The result is one or more new files in
+`image-dired-main-image-directory', named like
2005_05_08_12_52_00_dscn0319.jpg,
2005_05_08_14_27_45_dscn0320.jpg etc."
(interactive nil dired-mode)
@@ -350,11 +352,11 @@ image-dired-copy-with-exif-file-name
;;;###autoload
(defun image-dired-mark-tagged-files (regexp)
- "Use REGEXP to mark files with matching tag.
+ "Mark files whose tag matches REGEXP.
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
+promts for a regexp, and then matches it against all the tags
+of all the image files in the database file. The files that have a
matching tag will be marked in the Dired buffer."
(interactive "sMark tagged files (regexp): " dired-mode)
(image-dired-sane-db-file)
@@ -386,7 +388,7 @@ image-dired-mark-tagged-files
(message "%d files with matching tag marked" hits)))
(defun image-dired-dired-display-properties ()
- "Display properties for Dired file in the echo area."
+ "Show in the echo area the image-related properties of a file in Dired buffer."
(interactive nil dired-mode)
(let* ((file-name (dired-get-filename))
(dired-buf (buffer-name (current-buffer)))
diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el
index 6e14fb1dab3..9f35e17a7e6 100644
--- a/lisp/image/image-dired-external.el
+++ b/lisp/image/image-dired-external.el
@@ -86,15 +86,15 @@ image-dired-cmd-pngnq-options
(if (executable-find "pngquant")
'("--ext" "-nq8.png" "%t") ; same extension as "pngnq"
'("-f" "%t"))
- "Arguments to pass `image-dired-cmd-pngnq-program'.
-Available format specifiers are the same as in
+ "Arguments to pass to `image-dired-cmd-pngnq-program'.
+Value can use the same format specifiers as in
`image-dired-cmd-create-thumbnail-options'."
:type '(repeat (string :tag "Argument"))
:version "29.1")
(defcustom image-dired-cmd-pngcrush-program (executable-find "pngcrush")
"The file name of the `pngcrush' program.
-It optimizes the compression of PNG images. Also it adds PNG textual chunks
+It optimizes the compression of PNG images. It also adds PNG textual chunks
with the information required by the Thumbnail Managing Standard."
:type '(choice (const :tag "Not Set" nil) file))
@@ -110,7 +110,7 @@ image-dired-cmd-pngcrush-options
"-text" "b" "Thumb::URI" "file://%f"
"%q" "%t")
"Arguments for `image-dired-cmd-pngcrush-program'.
-The available %-format specifiers are the same as in
+The value can use the same %-format specifiers as in
`image-dired-cmd-create-thumbnail-options', with \"%q\" for a
temporary file name (typically generated by pnqnq)."
:version "26.1"
@@ -123,7 +123,7 @@ image-dired-cmd-optipng-program
(defcustom image-dired-cmd-optipng-options '("-o5" "%t")
"Arguments passed to `image-dired-cmd-optipng-program'.
-Available format specifiers are described in
+The value can use format specifiers described in
`image-dired-cmd-create-thumbnail-options'."
:version "26.1"
:type '(repeat (string :tag "Argument"))
@@ -139,14 +139,14 @@ image-dired-cmd-create-standard-thumbnail-options
"-thumbnail" "%wx%h>" "png:%t")))
(if (executable-find "gm") (cons "convert" opts) opts))
"Options for creating thumbnails according to the Thumbnail Managing Standard.
-The available %-format specifiers are the same as in
+The value can use the same %-format specifiers as in
`image-dired-cmd-create-thumbnail-options', with \"%m\" for file
modification time."
:type '(repeat (string :tag "Argument"))
:version "29.1")
(defcustom image-dired-cmd-rotate-original-program "jpegtran"
- "Executable used to rotate original image.
+ "Executable program used to rotate original image.
Used together with `image-dired-cmd-rotate-original-options'."
:type 'file)
@@ -154,11 +154,11 @@ image-dired-cmd-rotate-original-options
'("-rotate" "%d" "-copy" "all" "-outfile" "%t" "%o")
"Arguments of command used to rotate original image.
Used with `image-dired-cmd-rotate-original-program'.
-Available format specifiers are: %d which is replaced by the
-number of (positive) degrees to rotate the image, normally 90 or
-270 \(for 90 degrees right and left), %o which is replaced by the
-original image file name and %t which is replaced by
-`image-dired-temp-image-file'."
+The value can use the following format specifiers:
+%d which is replaced by the number of (positive) degrees
+to rotate the image, normally 90 or 270 (for 90 degrees right and left),
+%o which is replaced by the original image file name
+and %t which is replaced by `image-dired-temp-image-file'."
:version "26.1"
:type '(repeat (string :tag "Argument")))
@@ -176,9 +176,10 @@ image-dired-cmd-write-exif-data-program
(defcustom image-dired-cmd-write-exif-data-options '("-%t=%v" "%f")
"Arguments of command used to write EXIF data.
Used with `image-dired-cmd-write-exif-data-program'.
-Available format specifiers are: %f which is replaced by
-the image file name, %t which is replaced by the tag name and %v
-which is replaced by the tag value."
+The value can use the following format specifiers are:
+%f which is replaced by the image file name,
+%t which is replaced by the tag name
+and %v which is replaced by the tag value."
:version "26.1"
:type '(repeat (string :tag "Argument")))
@@ -206,7 +207,7 @@ image-dired--generate-thumbs-start
"Time when `display-thumbs' was called.")
(defvar image-dired-queue nil
- "List of items in the queue.
+ "List of items in the Image-Dired queue.
Each item has the form (ORIGINAL-FILE TARGET-FILE).")
(defvar image-dired-queue-active-jobs 0
@@ -214,13 +215,13 @@ image-dired-queue-active-jobs
(defvar image-dired-queue-active-limit (min 4 (max 2 (/ (num-processors) 2)))
"Maximum number of concurrent jobs permitted for generating images.
-Increase at own risk. If you want to experiment with this,
+Increase at your own risk. If you want to experiment with this,
consider setting `image-dired-debug' to a non-nil value to see
the time spent on generating thumbnails. Run `clear-image-cache'
and remove the cached thumbnail files between each trial run.")
(defun image-dired-pngnq-thumb (spec)
- "Quantize thumbnail described by format SPEC with pngnq(1)."
+ "Quantize thumbnail described by format SPEC with command `pngnq'."
(let ((process
(apply #'start-process "image-dired-pngnq" nil
image-dired-cmd-pngnq-program
@@ -243,7 +244,7 @@ image-dired-pngnq-thumb
process))
(defun image-dired-pngcrush-thumb (spec)
- "Optimize thumbnail described by format SPEC with pngcrush(1)."
+ "Optimize thumbnail described by format SPEC with command `pngcrush'."
;; If pngnq wasn't run, then the THUMB-nq8.png file does not exist.
;; pngcrush needs an infile and outfile, so we just copy THUMB to
;; THUMB-nq8.png and use the latter as a temp file.
@@ -268,7 +269,7 @@ image-dired-pngcrush-thumb
process))
(defun image-dired-optipng-thumb (spec)
- "Optimize thumbnail described by format SPEC with optipng(1)."
+ "Optimize thumbnail described by format SPEC with command `optipng'."
(let ((process
(apply #'start-process "image-dired-optipng" nil
image-dired-cmd-optipng-program
@@ -354,7 +355,8 @@ image-dired-create-thumb-1
(defun image-dired-thumb-queue-run ()
"Run a queued job if one exists and not too many jobs are running.
-Queued items live in `image-dired-queue'."
+Queued items live in `image-dired-queue'.
+Number of simultaneous jobs is limited by `image-dired-queue-active-limit'."
(while (and image-dired-queue
(< image-dired-queue-active-jobs
image-dired-queue-active-limit))
@@ -414,7 +416,7 @@ image-dired-get-exif-file-name
The file name should be unique as long as you do not take more than
one picture per second. The original file name is suffixed at the end
for traceability. The format of the returned file name is
-YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from
+YYYY_MM_DD_HH_MM_ss_ORIG_FILE_NAME.jpg. Used from
`image-dired-copy-with-exif-file-name'."
(let (data no-exif-data-found)
(if (not (eq 'jpeg (image-type (expand-file-name file))))
@@ -434,7 +436,7 @@ image-dired-get-exif-file-name
(file-name-nondirectory file))))
(defun image-dired-thumbnail-set-image-description ()
- "Set the ImageDescription EXIF tag for the original image.
+ "Set the ImageDescription EXIF tag for the original image at point.
If the image already has a value for this tag, it is used as the
default value at the prompt."
(interactive nil image-dired-thumbnail-mode)
diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.el
index b36c526fde0..b9c1a811850 100644
--- a/lisp/image/image-dired-tags.el
+++ b/lisp/image/image-dired-tags.el
@@ -39,7 +39,7 @@ image-dired-tags-db-file
(defmacro image-dired--with-db-file (&rest body)
"Run BODY in a temp buffer containing `image-dired-tags-db-file'.
-Return the last form in BODY."
+Return the value of last form in BODY."
(declare (indent 0) (debug t))
`(with-temp-buffer
(if (file-exists-p image-dired-tags-db-file)
@@ -91,7 +91,8 @@ image-dired-write-tags
(save-buffer))))
(defun image-dired-remove-tag (files tag)
- "For all FILES, remove TAG from the image database."
+ "For each file in FILES, remove TAG from the image database.
+FILES can be a name of a single file (a string) or a list of file names."
(image-dired-sane-db-file)
(image-dired--with-db-file
(setq buffer-file-name image-dired-tags-db-file)
@@ -119,7 +120,8 @@ image-dired-remove-tag
(save-buffer)))
(defun image-dired-list-tags (file)
- "Read all tags for image FILE from the image database."
+ "Read all tags for image FILE from the image database.
+Value is a list of all tags for FILE."
(image-dired-sane-db-file)
(image-dired--with-db-file
(let (end (tags ""))
@@ -136,7 +138,8 @@ image-dired-list-tags
;;;###autoload
(defun image-dired-tag-files (arg)
- "Tag marked file(s) in Dired. With prefix ARG, tag file at point."
+ "Tag file(s) which are marked in a Dired buffer.
+With prefix ARG, tag the file at point."
(interactive "P" dired-mode)
(let ((tag (completing-read
"Tags to add (separate tags with a semicolon): "
@@ -187,8 +190,7 @@ image-dired-tag-thumbnail-remove
'tags (image-dired-list-tags (image-dired-original-file-name))))))
(defun image-dired-write-comments (file-comments)
- "Write file comments to database.
-Write file comments to one or more files.
+ "Write file comments specified by FILE-COMMENTS comments to database.
FILE-COMMENTS is an alist on the following form:
((FILE . COMMENT) ... )"
(image-dired-sane-db-file)
@@ -224,7 +226,7 @@ image-dired-write-comments
(save-buffer))))
(defun image-dired-update-property (prop value)
- "Update text property PROP with value VALUE at point."
+ "Set text property PROP of text at point to have the given VALUE."
(let ((inhibit-read-only t))
(put-text-property
(point) (1+ (point))
diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el
index ebde531f723..a80b3afc0f3 100644
--- a/lisp/image/image-dired-util.el
+++ b/lisp/image/image-dired-util.el
@@ -110,11 +110,11 @@ image-dired-file-name-at-point
(abbreviate-file-name f)))
(defun image-dired-associated-dired-buffer ()
- "Get associated Dired buffer at point."
+ "Get associated Dired buffer for thumbnail at point."
(get-text-property (point) 'associated-dired-buffer))
(defmacro image-dired--with-dired-buffer (&rest body)
- "Run BODY in associated Dired buffer.
+ "Run BODY in the Dired buffer associated with thumbnail at point.
Should be used by commands in `image-dired-thumbnail-mode'."
(declare (indent defun) (debug t))
(let ((file (make-symbol "file"))
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 0c6fd74392c..49b8d9f03c8 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -171,7 +171,7 @@ image-dired-thumbnail-storage
sharing of thumbnails across different programs. Thumbnails
will be stored in \"$XDG_CACHE_HOME/thumbnails/\"
- Set this user option to one of the following values:
+ To use this way, set this user option to one of the following values:
- `standard' means use thumbnails sized 128x128.
- `standard-large' means use thumbnails sized 256x256.
@@ -181,20 +181,20 @@ image-dired-thumbnail-storage
2. In the Image-Dired specific directory indicated by
`image-dired-dir'.
- Set this user option to `image-dired' to use it (or
- `use-image-dired-dir', which means the same thing for
- backwards-compatibility reasons).
+ To use this way, set this user option to `image-dired' (or
+ to `use-image-dired-dir', which means the same thing for
+ backward-compatibility reasons).
3. In a subdirectory \".image-dired\" in the same directory
where the image files are.
- Set this user option to `per-directory' to use it.
+ To use this way, set this user option to `per-directory'.
-To change the default size of thumbnails with (2) and (3) above,
-customize `image-dired-thumb-size'.
+To control the default size of thumbnails for alternatives (2)
+and (3) above, customize the value of `image-dired-thumb-size'.
With Thumbnail Managing Standard, save thumbnails in the PNG
-format, as mandated by that standard, and otherwise as JPEG.
+format, as mandated by that standard; otherwise save them as JPEG.
For more information on the Thumbnail Managing Standard, see:
https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html"
@@ -216,13 +216,13 @@ 'image-dired-db-file
'image-dired-tags-db-file "29.1")
(defcustom image-dired-tags-db-file
(expand-file-name ".image-dired_db" image-dired-dir)
- "Database file where file names and their associated tags are stored."
+ "Database file where image-dired file names and associated tags are stored."
:type 'file)
(defcustom image-dired-rotate-original-ask-before-overwrite t
- "Confirm overwrite of original file after rotate operation.
+ "Confirm overwriting of original file after image-rotate operation.
If non-nil, ask user for confirmation before overwriting the
-original file with `image-dired-temp-rotate-image-file'."
+original image file by `image-dired-temp-rotate-image-file'."
:type 'boolean)
(defcustom image-dired-thumb-size
@@ -261,11 +261,12 @@ image-dired-thumb-visible-marks
(defcustom image-dired-line-up-method 'dynamic
"Default method for line-up of thumbnails in thumbnail buffer.
-Used by `image-dired-display-thumbs' and other functions that needs
-to line-up thumbnails. Dynamic means to use the available width of
-the window containing the thumbnail buffer, Fixed means to use
-`image-dired-thumbs-per-row', Interactive is for asking the user,
-and No line-up means that no automatic line-up will be done."
+Used by `image-dired-display-thumbs' and other functions that need
+to line-up thumbnails. The value `dynamic' means to use the
+available width of the window containing the thumbnail buffer,
+the value `fixed' means to use `image-dired-thumbs-per-row',
+the value `interactive' means ask the user, and the
+value `none' means that no automatic line-up will be done."
:type '(choice :tag "Default line-up method"
(const :tag "Dynamic" dynamic)
(const :tag "Fixed" fixed)
@@ -277,8 +278,8 @@ image-dired-thumbs-per-row
:type 'natnum)
(defcustom image-dired-track-movement t
- "The current state of the tracking and mirroring.
-For more information, see the documentation for
+ "The current state of the Image-Dired tracking and mirroring of thumbnails.
+For more information, see the documentation of
`image-dired-toggle-movement-tracking'."
:type 'boolean)
@@ -286,14 +287,14 @@ image-dired-display-properties-format
"Display format for thumbnail properties.
This is used for the header line in the Image-Dired buffer.
-The following %-specs are replaced by `format-spec' before
+The following %-specs in the value are replaced by `format-spec' before
displaying:
\"%f\" The file name (without a directory) of the
original image file.
\"%n\" The number of this image out of the total (e.g. 1/10).
\"%b\" The associated Dired buffer name.
- \"%d\" The name of the directory that the file is in.
+ \"%d\" The name of the file's directory.
\"%s\" The image file size.
\"%t\" The list of tags (from the Image-Dired database).
\"%c\" The comment (from the Image-Dired database)."
@@ -310,9 +311,9 @@ image-dired-external-viewer
((executable-find "xli") "xli")
((executable-find "qiv") "qiv -t")
((executable-find "xloadimage") "xloadimage"))
- "Name of external viewer.
-Including parameters. Used when displaying original image from
-`image-dired-thumbnail-mode'."
+ "Shell command to invoke the external image viewer program.
+Should include command-line arguments if needed. Used when displaying
+original image from `image-dired-thumbnail-mode'."
:version "29.1"
:type '(choice string
(const :tag "Not Set" nil)))
@@ -325,14 +326,14 @@ image-dired-main-image-directory
:version "29.1")
(defcustom image-dired-show-all-from-dir-max-files 1000
- "Maximum number of files in directory before prompting.
+ "Maximum number of files in directory to show before prompting.
-If there are more image files than this in a selected directory,
+If there are more image files in a selected directory than this number,
the `image-dired-show-all-from-dir' command will ask for
confirmation before creating the thumbnail buffer. If this
-variable is nil, it will never ask."
+variable is nil, never ask."
:type '(choice integer
- (const :tag "Disable warning" nil))
+ (const :tag "Don't ask for confirmation" nil))
:version "29.1")
(defcustom image-dired-marking-shows-next t
@@ -401,7 +402,7 @@ image-dired--file-name-regexp
(image-file-name-regexp)))
(defun image-dired-insert-image (file type relief margin)
- "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point."
+ "Insert at point image FILE of image TYPE, using RELIEF and MARGIN."
(let ((i `(image :type ,type
:file ,file
:relief ,relief
@@ -495,9 +496,9 @@ image-dired-dired-with-window-configuration
Convenience command that:
- - Opens Dired in folder DIR
- - Splits windows in most useful (?) way
- - Sets `truncate-lines' to t
+ - opens Dired in folder DIR;
+ - splits windows in most useful (?) way; and
+ - sets `truncate-lines' to t
After the command has finished, you would typically mark some
image files in Dired and type
@@ -525,7 +526,7 @@ image-dired-dired-with-window-configuration
(other-window -2)))))
(defun image-dired-restore-window-configuration ()
- "Restore window configuration.
+ "Restore window configuration altered by Image-Dired.
Restore any changes to the window configuration made by calling
`image-dired-dired-with-window-configuration'."
(interactive nil image-dired-thumbnail-mode)
@@ -632,7 +633,7 @@ 'image-dired
;;; Movement tracking
(defun image-dired-track-original-file ()
- "Track the original file in the associated Dired buffer.
+ "Track in the associated Dired buffer the file that corresponds to thumbnail.
See `image-dired-toggle-movement-tracking'. Interactive use is
only useful if `image-dired-track-movement' is nil."
(interactive nil image-dired-thumbnail-mode image-dired-image-mode)
@@ -646,8 +647,8 @@ image-dired-track-original-file
(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
-they are \"mirrored\" in the dired buffer. When this is on, moving
-around in the thumbnail or dired buffer will find the matching
+the movements are \"mirrored\" in the Dired buffer. When this is on,
+moving around in the thumbnail or Dired buffer will move to the matching
position in the other buffer."
(interactive nil image-dired-thumbnail-mode image-dired-image-mode)
(setq image-dired-track-movement (not image-dired-track-movement))
@@ -751,7 +752,9 @@ image-dired-move-end-of-line
;;; Header line
(defun image-dired-format-properties-string (buf file image-count props comment)
- "Format display properties.
+ "Format display properties for Image-Dired.
+The properties are formatted according to specification
+in `image-dired-display-properties-format', which see.
BUF is the associated Dired buffer, FILE is the original image
file name, IMAGE-COUNT is a string like \"N/M\" where N is the
number of this image and M is the total number of images, PROPS
@@ -816,7 +819,7 @@ image-dired-dired-file-flagged-p
(image-dired-dired-file-marked-p dired-del-marker))
(defmacro image-dired--on-file-in-dired-buffer (&rest body)
- "Run BODY with point on file at point in Dired buffer.
+ "Run BODY in associated Dired buffer with point on current file's line.
Should be called from commands in `image-dired-thumbnail-mode'."
(declare (indent defun) (debug t))
`(if-let ((file-name (image-dired-original-file-name)))
@@ -1192,7 +1195,8 @@ image-dired-line-up-interactive
;;; Display image from thumbnail buffer
(defun image-dired-thumbnail-display-external ()
- "Display original image for thumbnail at point using external viewer."
+ "Display original image for thumbnail at point using external viewer.
+The viewer command is specified by `image-dired-external-viewer'."
(interactive nil image-dired-thumbnail-mode)
(let ((file (image-dired-original-file-name)))
(if (not (image-dired-image-at-point-p))
@@ -1205,7 +1209,7 @@ image-dired-thumbnail-display-external
(defun image-dired-display-image (file &optional _ignored)
"Display image FILE in the image buffer window.
-If it is an image, the window will use `image-dired-image-mode'
+If FILE is an image, the window will use `image-dired-image-mode'
which is based on `image-mode'."
(declare (advertised-calling-convention (file) "29.1"))
(setq file (expand-file-name file))
@@ -1293,7 +1297,7 @@ image-dired-comment-thumbnail
(defun image-dired-copy-filename-as-kill (&optional arg)
"Copy names of marked (or next ARG) files into the kill ring.
-This works as `dired-copy-filename-as-kill' (which see)."
+This works like `dired-copy-filename-as-kill' (which see)."
(interactive "P" image-dired-thumbnail-mode)
(image-dired--with-dired-buffer
(dired-copy-filename-as-kill arg)))
diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el
index c497e1f429b..a2f175e4628 100644
--- a/lisp/image/wallpaper.el
+++ b/lisp/image/wallpaper.el
@@ -109,7 +109,7 @@ wallpaper--use-default-set-function-p
ARGS is the default list of command line arguments for COMMAND.
PREDICATE is a function that will be called without any arguments
-and returns non-nil if this setter should be used.
+and should return non-nil if this setter should be used.
INIT-ACTION is a function that will be called without any
arguments before trying to set the wallpaper.
@@ -304,7 +304,7 @@ wallpaper--find-setter
(throw 'found setter))))))))
(defun wallpaper--find-command ()
- "Return a valid command to set the wallpaper in this environment."
+ "Return the appropriate command to set the wallpaper."
(when-let ((setter (wallpaper--find-setter)))
(wallpaper-setter-command setter)))
@@ -437,7 +437,7 @@ wallpaper--x-monitor-name
On a graphical display, try using the same monitor as the current
frame.
On a non-graphical display, try to get the name by connecting to
-the display server directly, and run \"xrandr\" if that doesn't
+the display server directly, or run \"xrandr\" if that doesn't
work. Prompt for the monitor name if neither method works.
This function is meaningful only on X and is used only there."
@@ -469,7 +469,7 @@ wallpaper--x-monitor-name
(read-string (format-prompt "Monitor name" nil)))))
(defun wallpaper--format-arg (format file)
- "Format a `wallpaper-command-args' argument ARG.
+ "Format a `wallpaper-command-args' argument ARG using FORMAT.
FILE is the image file name."
(format-spec
format
commit 85a2eb2c789e7f9c1afa838817b3e9ebecb49da4
Author: Mattias Engdegård
;; Create parsers. -(setq html (treesit-get-parser-create 'html)) -(setq css (treesit-get-parser-create 'css)) -(setq js (treesit-get-parser-create 'javascript)) +(setq html (treesit-parser-create 'html)) +(setq css (treesit-parser-create 'css)) +(setq js (treesit-parser-create 'javascript))
;; Set CSS ranges. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 6e13af9a20f..53787d7e54d 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -1589,9 +1589,9 @@ Multiple Languages @example @group ;; Create parsers. -(setq html (treesit-get-parser-create 'html)) -(setq css (treesit-get-parser-create 'css)) -(setq js (treesit-get-parser-create 'javascript)) +(setq html (treesit-parser-create 'html)) +(setq css (treesit-parser-create 'css)) +(setq js (treesit-parser-create 'javascript)) @end group @group commit 51901736965f9a6f07938fa4399d14c9283437c5 Author: Yuan FuDate: Sun Feb 5 20:22:52 2023 -0800 Add 'live' property to treesit-node-check (bug#61235) * doc/lispref/parsing.texi (Accessing Node Information): Document. * src/treesit.c (treesit_parser_live_p): New function. (Ftreesit_node_check): Add 'live' property. * test/src/treesit-tests.el (treesit-node-api): Add tests. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index cebb59b6501..6e13af9a20f 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -970,10 +970,15 @@ Accessing Node Information can be that the node itself has an error, or one of its descendants has an error. +@cindex tree-sitter live node +@cindex live node, tree-sitter +A node is ``live'' if its parser is not deleted, and the buffer it +belongs to is live. + @defun treesit-node-check node property This function checks if @var{node} has the specified @var{property}. @var{property} can be @code{named}, @code{missing}, @code{extra}, -@code{outdated}, or @code{has-error}. +@code{outdated}, @code{has-error}, or @code{live}. @end defun @defun treesit-node-type node diff --git a/src/treesit.c b/src/treesit.c index cfa3721b5e7..01c7621c6ea 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1475,6 +1475,15 @@ DEFUN ("treesit-parser-language", return XTS_PARSER (parser)->language_symbol; } +/* Return true if PARSER is not deleted and its buffer is live. */ +static bool +treesit_parser_live_p (Lisp_Object parser) +{ + CHECK_TS_PARSER (parser); + return ((!XTS_PARSER (parser)->deleted) && + (!NILP (Fbuffer_live_p (XTS_PARSER (parser)->buffer)))); +} + /*** Parser API */ DEFUN ("treesit-parser-root-node", @@ -1908,7 +1917,8 @@ DEFUN ("treesit-node-check", Ftreesit_node_check, Streesit_node_check, 2, 2, 0, doc: /* Return non-nil if NODE has PROPERTY, nil otherwise. -PROPERTY could be `named', `missing', `extra', `outdated', or `has-error'. +PROPERTY could be `named', `missing', `extra', `outdated', +`has-error', or `live'. Named nodes correspond to named rules in the language definition, whereas "anonymous" nodes correspond to string literals in the @@ -1924,7 +1934,10 @@ DEFUN ("treesit-node-check", the node was created. A node "has error" if itself is a syntax error or contains any syntax -errors. */) +errors. + +A node is "live" if its parser is not deleted and its buffer is +live. */) (Lisp_Object node, Lisp_Object property) { if (NILP (node)) return Qnil; @@ -1947,9 +1960,11 @@ DEFUN ("treesit-node-check", result = ts_node_is_extra (treesit_node); else if (EQ (property, Qhas_error)) result = ts_node_has_error (treesit_node); + else if (EQ (property, Qlive)) + result = treesit_parser_live_p (XTS_NODE (node)->parser); else signal_error ("Expecting `named', `missing', `extra', " - "`outdated', or `has-error', but got", + "`outdated', `has-error', or `live', but got", property); return result ? Qt : Qnil; } @@ -3448,6 +3463,7 @@ syms_of_treesit (void) DEFSYM (Qextra, "extra"); DEFSYM (Qoutdated, "outdated"); DEFSYM (Qhas_error, "has-error"); + DEFSYM (Qlive, "live"); DEFSYM (QCanchor, ":anchor"); DEFSYM (QCequal, ":equal"); diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index a2ab3be7cd8..5aa12e8aa0e 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el @@ -100,6 +100,7 @@ treesit-node-api (should (eq nil (treesit-node-check root-node 'missing))) (should (eq nil (treesit-node-check root-node 'extra))) (should (eq nil (treesit-node-check root-node 'has-error))) + (should (eq t (treesit-node-check root-node 'live))) ;; `treesit-node-child'. (setq doc-node (treesit-node-child root-node 0)) (should (equal "array" (treesit-node-type doc-node))) @@ -160,7 +161,18 @@ treesit-node-api :type 'args-out-of-range) ;; `treesit-node-eq'. (should (treesit-node-eq root-node root-node)) - (should (not (treesit-node-eq root-node doc-node)))))) + (should (not (treesit-node-eq root-node doc-node))) + + ;; Further test for `treesit-node-check'. + (treesit-parser-delete parser) + (should (equal nil (treesit-node-check root-node 'live))) + ;; Recreate parser. + (setq parser (treesit-parser-create 'json)) + (setq root-node (treesit-parser-root-node + parser)) + (should (equal t (treesit-node-check root-node 'live))) + (kill-buffer) + (should (equal nil (treesit-node-check root-node 'live)))))) ;;; Indirect buffer commit 56960a6558b65ce9643684c09203709f015e1812 Author: Jonas Bernoulli Date: Thu Feb 9 23:53:33 2023 +0100 Update to Transient v0.3.7-205-gb8ad0da diff --git a/lisp/transient.el b/lisp/transient.el index 9858bff03a8..73ea6fa940e 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2162,7 +2162,7 @@ transient--recursive-edit (funcall fn) (transient--suspend-override (bound-and-true-p edebug-active)) (funcall fn) ; Already unwind protected. - (cond ((eq this-command '(top-level abort-recursive-edit)) + (cond ((memq this-command '(top-level abort-recursive-edit)) (setq transient--exitp t) (transient--post-exit) (transient--delete-window)) commit 68a6b364d1cdc8894c25df555786b870973e07cb Author: Eli Zaretskii Date: Thu Feb 9 17:34:19 2023 +0200 Fix 'rmail-summary-output' * lisp/mail/rmailsum.el (rmail-summary-output): Fix deletion of messages when 'rmail-output-reset-deleted-flag' is non-nil. (Bug#61380) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index ba580907658..21dec2bbeb7 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -1931,7 +1931,7 @@ rmail-summary-output (progn (require 'rmailout) (list (rmail-output-read-file-name) (prefix-numeric-value current-prefix-arg)))) - (let ((i 0) prev-msg) + (let ((i 0) prev-msg curmsg) (while (and (< i n) (progn (rmail-summary-goto-msg) @@ -1942,7 +1942,11 @@ rmail-summary-output (setq i (1+ i)) (with-current-buffer rmail-buffer (let ((rmail-delete-after-output nil)) + (setq curmsg rmail-current-message) (rmail-output file-name 1))) + ;; rmail-output sometimes moves to the next message; undo that. + (or (= curmsg (rmail-summary-msg-number)) + (rmail-summary-goto-msg curmsg)) (if rmail-delete-after-output (rmail-summary-delete-forward nil) (if (< i n) commit 67c6ec25590a690cbf8659e65e64f319ce3bcd64 Author: Nicolas Martyanoff Date: Thu Feb 9 11:39:14 2023 +0100 lisp-mode: add docstring recognition for more common lisp symbols * lisp/emacs-lisp/lisp-mode.el (define-compiler-macro) (define-setf-expander, deftype): Add the 'doc-string-elt' property for proper docstring highlighting in Common Lisp. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 367f59e8785..d44c9d6e23d 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -181,8 +181,11 @@ lisp-mode-autoload-regexp (put 'define-category 'doc-string-elt 2) ;; CL (put 'defconstant 'doc-string-elt 3) +(put 'define-compiler-macro 'doc-string-elt 3) +(put 'define-setf-expander 'doc-string-elt 3) (put 'defparameter 'doc-string-elt 3) (put 'defstruct 'doc-string-elt 2) +(put 'deftype 'doc-string-elt 3) (defvar lisp-doc-string-elt-property 'doc-string-elt "The symbol property that holds the docstring position info.") commit 417a8ed8b05845090340c7ce9fd5493087a66839 Author: Eli Zaretskii Date: Thu Feb 9 16:06:55 2023 +0200 ; Improve discoverability of empty file names handling * doc/lispref/files.texi (Relative File Names) (Testing Accessibility, File Name Expansion): Document and index the behavior with empty strings as file names. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 707af6ee64c..5062b1697b5 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -895,6 +895,12 @@ Testing Accessibility If the file does not exist, or if there was trouble determining whether the file exists, this function returns @code{nil}. +@cindex empty file name, and @code{file-exists-p} +Since a file name that is an empty string is interpreted relative to +the current buffer's default directory (@pxref{Relative File Names}), +calling @code{file-exists-p} with an argument that is an empty string +will report about the buffer's default directory. + @cindex dangling symlinks, testing for existence Directories are files, so @code{file-exists-p} can return @code{t} when given a directory. However, because @code{file-exists-p} follows @@ -2338,6 +2344,10 @@ Relative File Names @end example @end defun +@cindex empty file name + A file name that is an empty string stands for the current buffer's +default directory. + @node Directory Names @subsection Directory Names @cindex directory name @@ -2527,6 +2537,7 @@ File Name Expansion superroot above the root directory @file{/}. On other filesystems, @file{/../} is interpreted exactly the same as @file{/}. +@cindex empty file names, and @code{expand-file-name} Expanding @file{.} or the empty string returns the default directory: @example commit e47cf6ca15a4c03862b9c038dec6a4062db2b481 Author: Jonas Bernoulli Date: Thu Feb 9 13:28:05 2023 +0100 Update to Transient v0.3.7-204-gecff8c2 diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi index 8ac5df9904c..7be8b630412 100644 --- a/doc/misc/transient.texi +++ b/doc/misc/transient.texi @@ -1061,18 +1061,6 @@ Defining Transients the branch whose variables are being configured. @end defmac -It is possible to define one or more groups independently of a prefix -definition, which is useful when those groups are to be used by more -than just one prefix command. - -@defmac transient-define-groups name group... -This macro defines one or more groups of infix and suffix commands -and stores them in a property of the symbol @var{NAME}. @var{GROUP} has the -same form as for @code{transient-define-prefix}. Subsequently @var{NAME} can -be used in a @var{GROUP} of @code{transient-define-prefix}, as described in the -next section. -@end defmac - @node Binding Suffix and Infix Commands @section Binding Suffix and Infix Commands @@ -1199,22 +1187,8 @@ Group Specifications Inside group specifications, including inside contained suffix specifications, nothing has to be quoted and quoting anyway is -invalid. - -How symbols are treated, depends on context. Inside suffix -specifications they often name functions. However if they appear in -a place where a group is expected, then they are treated as indirect -group specifications. Such a symbol must have an associated group -specification, created using @code{transient-define-groups}. - -Likewise a symbol can appear in a place where a suffix specification -is expected. The value of the @code{transient--layout} property of that -symbol must be a single suffix specification or a list of such -specifications. Currently no macro exist that would create such a -symbol, and this feature should usually not be used. - -The value following a keyword, can be explicitly unquoted using @code{,}. -This feature is experimental and should be avoided as well. +invalid. The value following a keyword, can be explicitly unquoted +using @code{,}. This feature is experimental and should be avoided. The form of suffix specifications is documented in the next node. diff --git a/lisp/transient.el b/lisp/transient.el index cd8640a7d74..9858bff03a8 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -632,7 +632,8 @@ transient-prefix (transient-non-suffix :initarg :transient-non-suffix :initform nil) (incompatible :initarg :incompatible :initform nil) (suffix-description :initarg :suffix-description) - (variable-pitch :initarg :variable-pitch :initform nil)) + (variable-pitch :initarg :variable-pitch :initform nil) + (unwind-suffix :documentation "Internal use." :initform nil)) "Transient prefix command. Each transient prefix command consists of a command, which is @@ -876,18 +877,6 @@ transient-define-prefix (list ,@(cl-mapcan (lambda (s) (transient--parse-child name s)) suffixes)))))) -(defmacro transient-define-groups (name &rest groups) - "Define one or more GROUPS and store them in symbol NAME. -GROUPS, defined using this macro, can be used inside the -definition of transient prefix commands, by using the symbol -NAME where a group vector is expected. GROUPS has the same -form as for `transient-define-prefix'." - (declare (debug (&define name [&rest vectorp])) - (indent defun)) - `(put ',name 'transient--layout - (list ,@(cl-mapcan (lambda (group) (transient--parse-child name group)) - groups)))) - (defmacro transient-define-suffix (name arglist &rest args) "Define NAME as a transient suffix command. @@ -1411,17 +1400,6 @@ transient--debug (defvar transient--history nil) -(defvar transient--abort-commands - '(abort-minibuffers ; (minibuffer-quit-recursive-edit) - abort-recursive-edit ; (throw 'exit t) - exit-recursive-edit ; (throw 'exit nil) - keyboard-escape-quit ; dwim - keyboard-quit ; (signal 'quit nil) - minibuffer-keyboard-quit ; (abort-minibuffers) - minibuffer-quit-recursive-edit ; (throw 'exit (lambda () - ; (signal 'minibuffer-quit nil))) - top-level)) ; (throw 'top-level nil) - (defvar transient--scroll-commands '(transient-scroll-up transient-scroll-down @@ -1476,10 +1454,11 @@ transient-suffix-object (lambda (obj) (eq (transient--suffix-command obj) (or command - ;; When `this-command' is `transient-set-level', - ;; its reader needs to know what command is being - ;; configured. - this-original-command))) + (if (eq this-command 'transient-set-level) + ;; This is how it can look up for which + ;; command it is setting the level. + this-original-command + this-command)))) (or transient--suffixes transient-current-suffixes)))) (or (and (cdr suffixes) @@ -1657,6 +1636,7 @@ transient-predicate-map (define-key map [universal-argument] #'transient--do-stay) (define-key map [negative-argument] #'transient--do-minus) (define-key map [digit-argument] #'transient--do-stay) + (define-key map [top-level] #'transient--do-quit-all) (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) @@ -1717,8 +1697,8 @@ transient--push-keymap (defun transient--pop-keymap (var) (let ((map (symbol-value var))) - (transient--debug " pop %s%s" var (if map "" " VOID")) (when map + (transient--debug " pop %s" var) (with-demoted-errors "transient--pop-keymap: %S" (internal-pop-keymap map 'overriding-terminal-local-map))))) @@ -2042,6 +2022,7 @@ transient--init-transient (transient--push-keymap 'transient--redisplay-map) (add-hook 'pre-command-hook #'transient--pre-command) (add-hook 'post-command-hook #'transient--post-command) + (advice-add 'recursive-edit :around #'transient--recursive-edit) (when transient--exitp ;; This prefix command was invoked as the suffix of another. ;; Prevent `transient--post-command' from removing the hooks @@ -2077,11 +2058,14 @@ transient--pre-command (not (memq this-command '(transient-quit-one transient-quit-all transient-help)))) - (setq this-command 'transient-set-level)) + (setq this-command 'transient-set-level) + (transient--wrap-command)) (t (setq transient--exitp nil) - (when (eq (transient--do-pre-command) transient--exit) - (transient--pre-exit)))))) + (let ((exitp (eq (transient--do-pre-command) transient--exit))) + (transient--wrap-command) + (when exitp + (transient--pre-exit))))))) (defun transient--do-pre-command () (if-let ((fn (transient--get-predicate-for this-command))) @@ -2163,7 +2147,7 @@ transient--suspend-override (remove-hook 'pre-command-hook #'transient--pre-command) (remove-hook 'post-command-hook #'transient--post-command)) -(defun transient--resume-override () +(defun transient--resume-override (&optional _ignore) (transient--debug 'resume-override) (when (and transient--showp transient-hide-during-minibuffer-read) (transient--show)) @@ -2172,6 +2156,19 @@ transient--resume-override (add-hook 'pre-command-hook #'transient--pre-command) (add-hook 'post-command-hook #'transient--post-command)) +(defun transient--recursive-edit (fn) + (transient--debug 'recursive-edit) + (if (not transient--prefix) + (funcall fn) + (transient--suspend-override (bound-and-true-p edebug-active)) + (funcall fn) ; Already unwind protected. + (cond ((eq this-command '(top-level abort-recursive-edit)) + (setq transient--exitp t) + (transient--post-exit) + (transient--delete-window)) + (transient--prefix + (transient--resume-override))))) + (defmacro transient--with-suspended-override (&rest body) (let ((depth (make-symbol "depth")) (setup (make-symbol "setup")) @@ -2199,71 +2196,69 @@ transient--with-suspended-override (remove-hook 'minibuffer-exit-hook ,exit))) ,@body))) -(defun transient--post-command-hook () - (run-hooks 'transient--post-command-hook)) - -(add-hook 'post-command-hook #'transient--post-command-hook) - -(defun transient--delay-post-command (&optional abort-only) - (transient--debug 'delay-post-command) - (let ((depth (minibuffer-depth)) - (command this-command) - (delayed (if transient--exitp - (apply-partially #'transient--post-exit this-command) - #'transient--resume-override)) - post-command abort-minibuffer) - (unless abort-only - (setq post-command - (lambda () "@transient--delay-post-command" - (let ((act (and (not (equal (this-command-keys-vector) [])) - (or (eq this-command command) - ;; `execute-extended-command' was - ;; used to call another command - ;; that also uses the minibuffer. - (equal - (ignore-errors - (string-to-multibyte (this-command-keys))) - (format "\M-x%s\r" this-command)))))) - (transient--debug 'post-command-hook "act: %s" act) - (when act - (remove-hook 'transient--post-command-hook post-command) - (remove-hook 'minibuffer-exit-hook abort-minibuffer) - (funcall delayed))))) - (add-hook 'transient--post-command-hook post-command)) - (setq abort-minibuffer - (lambda () "@transient--delay-post-command" - (let ((act (and (or (memq this-command transient--abort-commands) - (equal (this-command-keys) "")) - (= (minibuffer-depth) depth)))) - (transient--debug - 'abort-minibuffer - "mini: %s|%s, act %s" (minibuffer-depth) depth act) - (when act - (remove-hook 'transient--post-command-hook post-command) - (remove-hook 'minibuffer-exit-hook abort-minibuffer) - (funcall delayed))))) - (add-hook 'minibuffer-exit-hook abort-minibuffer))) +(defun transient--wrap-command () + (let* ((prefix transient--prefix) + (suffix this-command) + (advice nil) + (advice-interactive + (lambda (spec) + (let ((abort t)) + (unwind-protect + (prog1 (advice-eval-interactive-spec spec) + (setq abort nil)) + (when abort + (when-let ((unwind (oref prefix unwind-suffix))) + (transient--debug 'unwind-interactive) + (funcall unwind suffix)) + (if (symbolp suffix) + (advice-remove suffix advice) + (remove-function suffix advice)) + (oset prefix unwind-suffix nil)))))) + (advice-body + (lambda (fn &rest args) + (unwind-protect + (apply fn args) + (when-let ((unwind (oref prefix unwind-suffix))) + (transient--debug 'unwind-command) + (funcall unwind suffix)) + (if (symbolp suffix) + (advice-remove suffix advice) + (remove-function suffix advice)) + (oset prefix unwind-suffix nil))))) + (setq advice `(lambda (fn &rest args) + (interactive ,advice-interactive) + (apply ',advice-body fn args))) + (if (symbolp suffix) + (advice-add suffix :around advice '((depth . -99))) + (add-function :around (var suffix) advice '((depth . -99)))))) + +(defun transient--premature-post-command () + (and (equal (this-command-keys-vector) []) + (= (minibuffer-depth) + (1+ transient--minibuffer-depth)) + (progn + (transient--debug 'premature-post-command) + (transient--suspend-override) + (oset (or transient--prefix transient-current-prefix) + unwind-suffix + (if transient--exitp + #'transient--post-exit + #'transient--resume-override)) + t))) (defun transient--post-command () - (transient--debug 'post-command) - (transient--with-emergency-exit - (cond - ((and (equal (this-command-keys-vector) []) - (= (minibuffer-depth) - (1+ transient--minibuffer-depth))) - (transient--suspend-override) - (transient--delay-post-command (eq transient--exitp 'replace))) - (transient--exitp - (transient--post-exit)) - ((eq this-command (oref transient--prefix command))) - (t - (let ((old transient--redisplay-map) - (new (transient--make-redisplay-map))) - (unless (equal old new) - (transient--pop-keymap 'transient--redisplay-map) - (setq transient--redisplay-map new) - (transient--push-keymap 'transient--redisplay-map))) - (transient--redisplay))))) + (unless (transient--premature-post-command) + (transient--debug 'post-command) + (transient--with-emergency-exit + (cond (transient--exitp (transient--post-exit)) + ((eq this-command (oref transient--prefix command))) + ((let ((old transient--redisplay-map) + (new (transient--make-redisplay-map))) + (unless (equal old new) + (transient--pop-keymap 'transient--redisplay-map) + (setq transient--redisplay-map new) + (transient--push-keymap 'transient--redisplay-map)) + (transient--redisplay))))))) (defun transient--post-exit (&optional command) (transient--debug 'post-exit) @@ -2284,7 +2279,8 @@ transient--post-exit (setq transient--exitp nil) (transient--stack-zap))))) (remove-hook 'pre-command-hook #'transient--pre-command) - (remove-hook 'post-command-hook #'transient--post-command)) + (remove-hook 'post-command-hook #'transient--post-command) + (advice-remove 'recursive-edit #'transient--recursive-edit)) (setq transient-current-prefix nil) (setq transient-current-command nil) (setq transient-current-suffixes nil) @@ -2353,7 +2349,7 @@ transient--debug (when transient--debug (let ((inhibit-message (not (eq transient--debug 'message)))) (if (symbolp arg) - (message "-- %-18s (cmd: %s, event: %S, exit: %s%s)" + (message "-- %-22s (cmd: %s, event: %S, exit: %s%s)" arg (or (ignore-errors (transient--suffix-symbol this-command)) (if (byte-code-function-p this-command) @@ -3989,23 +3985,6 @@ transient--prefix-color ;;;; Edebug -(defun transient--edebug--recursive-edit (fn arg-mode) - (transient--debug 'edebug--recursive-edit) - (if (not transient--prefix) - (funcall fn arg-mode) - (transient--suspend-override t) - (funcall fn arg-mode) - (transient--resume-override))) - -(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) - (defun transient--edebug-command-p () (and (bound-and-true-p edebug-active) (or (memq this-command '(top-level abort-recursive-edit)) @@ -4100,7 +4079,8 @@ transient-font-lock-keywords (regexp-opt (list "transient-define-prefix" "transient-define-infix" "transient-define-argument" - "transient-define-suffix") + "transient-define-suffix" + "transient-define-groups") t) "\\_>[ \t'(]*" "\\(\\(?:\\sw\\|\\s_\\)+\\)?") commit b04cce02ff41a2ecb850e9772ab8d415cc6c8b50 Author: Eli Zaretskii Date: Thu Feb 9 12:17:18 2023 +0200 Fix Scala entry in Eglot's DB of LSP servers * lisp/progmodes/eglot.el (eglot-server-programs): Support Scala LSP named "metals", in addition to "metals-emacs". (Bug#61312) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index c906890c949..58d519548e0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -221,7 +221,8 @@ eglot-server-programs "--client-id" "emacs.eglot-dart")) (elixir-mode . ("language_server.sh")) (ada-mode . ("ada_language_server")) - (scala-mode . ("metals-emacs")) + (scala-mode . ,(eglot-alternatives + '("metals" "metals-emacs"))) (racket-mode . ("racket" "-l" "racket-langserver")) ((tex-mode context-mode texinfo-mode bibtex-mode) . ,(eglot-alternatives '("digestif" "texlab")))