commit 50140585a29f132e5e0562142ec223bc8e6870a0 (HEAD, refs/remotes/origin/master) Merge: 08bd066149f 8f3091defb3 Author: Stefan Kangas Date: Sun Feb 12 06:30:10 2023 +0100 Merge from origin/emacs-29 8f3091defb3 ; Fix typo in buffer.h commit 8f3091defb3ec4396ccea563f67c005044b822ca Author: Daniel Martín Date: Sun Feb 12 01:32:20 2023 +0100 ; Fix typo in buffer.h diff --git a/src/buffer.h b/src/buffer.h index 23340b4c0ee..c0e38ce9659 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -690,7 +690,7 @@ #define BVAR(buf, field) ((buf)->field ## _) display optimizations must be used. */ bool_bf long_line_optimizations_p : 1; - /* The inveral tree containing this buffer's overlays. */ + /* The interval tree containing this buffer's overlays. */ struct itree_tree *overlays; /* Changes in the buffer are recorded here for undo, and t means commit 08bd066149faee95fe6660d5002306a1dbc4b91b Merge: 14c97db7366 4da398d8b57 Author: Stefan Kangas Date: Sun Feb 12 03:27:46 2023 +0100 Merge from origin/emacs-29 4da398d8b57 ; Fix typos 074008ee2d2 ; Fix doc strings in lisp/image/ directory 2d1e43436da ; Improve documentation of hash functions. 900f7e07275 ; Remove extraneous local variables from image-dired-*.el... 4f053afe8e7 bug-reference: prevent match-data clobbering (bug#61395) 10af9fbcad1 ; * admin/notes/tree-sitter/starter-guide: Typos. 9ac242ce93d ; Fix recent changes in treesit docs f5789aefc2e Rename LIMIT to DEPTH in tree-sitter functions (bug#61231) b39821fdcef ; Fix incorrect function name in treesit manual 51901736965 Add 'live' property to treesit-node-check (bug#61235) 56960a6558b Update to Transient v0.3.7-205-gb8ad0da 68a6b364d1c Fix 'rmail-summary-output' 67c6ec25590 lisp-mode: add docstring recognition for more common lisp... 417a8ed8b05 ; Improve discoverability of empty file names handling e47cf6ca15a Update to Transient v0.3.7-204-gecff8c2 b04cce02ff4 Fix Scala entry in Eglot's DB of LSP servers # Conflicts: # lisp/transient.el commit 4da398d8b57aae740f054b4d04cba72735a4044c Author: Stefan Kangas Date: Sun Feb 12 03:23:13 2023 +0100 ; Fix typos diff --git a/ChangeLog.2 b/ChangeLog.2 index cde9e63df88..11e6049b0bd 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -111,7 +111,7 @@ 2017-03-21 Noam Postavsky - Narrow scope of modification hook renabling in org-src fontification + Narrow scope of modification hook re-enabling in org-src fontification Modification hooks should be enabled while modifying text in the org-src temp buffer, but in 2017-01-29 "Call modification hooks in diff --git a/ChangeLog.3 b/ChangeLog.3 index 3d733804e39..c254f595e89 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -204741,7 +204741,7 @@ 2017-03-21 Noam Postavsky - Narrow scope of modification hook renabling in org-src fontification + Narrow scope of modification hook re-enabling in org-src fontification Modification hooks should be enabled while modifying text in the org-src temp buffer, but in 2017-01-29 "Call modification hooks in diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index 15230c9e42a..6b932601df0 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -355,7 +355,7 @@ image-dired-mark-tagged-files "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 -promts for a regexp, and then matches it against all the tags +prompts 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) commit 14c97db7366435b1edbf2854f485058a9d7c6071 Author: Jim Porter Date: Sat Feb 11 12:37:32 2023 -0800 Make sure core Eshell modules are loaded Previously, if you removed all (or most) extension modules from Eshell, it failed to load esh-var.el, meaning that you couldn't use variable expansions. To avoid this issue, we now explicitly load the core modules in esh-mode.el. * lisp/eshell/esh-mode.el: Explicitly require core Eshell modules. diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 654e26777e0..46c3c2fa175 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -58,10 +58,16 @@ ;;; Code: -(require 'esh-util) -(require 'esh-module) +;; Load the core Eshell modules; we'll call their initialization +;; functions below in `eshell-mode'. +(require 'esh-arg) (require 'esh-cmd) -(require 'esh-arg) ;For eshell-parse-arguments +(require 'esh-ext) +(require 'esh-io) +(require 'esh-module) +(require 'esh-proc) +(require 'esh-util) +(require 'esh-var) (defgroup eshell-mode nil "This module contains code for handling input from the user." commit 838415525bd4e77a79e18af8e4f01ed004196c71 Author: Michael Albinus Date: Sat Feb 11 18:11:56 2023 +0100 Support Tramp user name completion * lisp/net/tramp.el (tramp-build-completion-file-name-regexp) (tramp-completion-handle-expand-file-name) (tramp-completion-handle-file-name-directory): Support user name completion. * test/lisp/net/tramp-tests.el (tramp-test26-interactive-file-name-completion): Fix test. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 36305dda496..1cda8fc4c61 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1211,9 +1211,12 @@ tramp-build-completion-file-name-regexp (? (regexp tramp-completion-method-regexp) ;; Method separator, user name and host name. (? (regexp tramp-postfix-method-regexp) - ;; This is a little bit lax, but it serves. - (? (regexp tramp-host-regexp)))) - + (? (regexp tramp-user-regexp) + (regexp tramp-postfix-user-regexp)) + (? (| (regexp tramp-host-regexp) ;; This includes a user. + (: (regexp tramp-prefix-ipv6-regexp) + (? (regexp tramp-ipv6-regexp) + (? (regexp tramp-postfix-ipv6-regexp)))))))) eos))) (defvar tramp-completion-file-name-regexp @@ -2958,7 +2961,8 @@ tramp-completion-handle-expand-file-name (concat dir filename)) ((string-match-p (rx bos (regexp tramp-prefix-regexp) - (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp)) + (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp) + (? (regexp tramp-user-regexp) (regexp tramp-postfix-user-regexp))) eos) dir) (concat dir filename)) @@ -3250,11 +3254,21 @@ tramp-completion-handle-file-name-directory (rx (group (regexp tramp-prefix-regexp) (group (regexp tramp-method-regexp)) - (regexp tramp-postfix-method-regexp))) + (regexp tramp-postfix-method-regexp) + (? (regexp tramp-user-regexp) + (regexp tramp-postfix-user-regexp)))) filename) ;; Is it a valid method? (assoc (match-string 2 filename) tramp-methods)) (match-string 1 filename)) + ((and (string-empty-p tramp-method-regexp) + (string-match + (rx (group + (regexp tramp-prefix-regexp) + (? (regexp tramp-user-regexp) + (regexp tramp-postfix-user-regexp)))) + filename)) + (match-string 1 filename)) ((string-match (rx (group (regexp tramp-prefix-regexp)) (regexp tramp-completion-method-regexp) eos) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 85714e79bc0..33afe820c58 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4643,13 +4643,15 @@ tramp-test26-interactive-file-name-completion "Check interactive completion with different `completion-styles'." (tramp-cleanup-connection tramp-test-vec nil 'keep-password) -;; Method and host name in completion mode. This kind of completion + ;; Method and host name in completion mode. This kind of completion ;; does not work on MS Windows. (unless (memq system-type '(cygwin windows-nt)) (let ((method (file-remote-p ert-remote-temporary-file-directory 'method)) + (user (file-remote-p ert-remote-temporary-file-directory 'user)) (host (file-remote-p ert-remote-temporary-file-directory 'host)) (orig-syntax tramp-syntax) - (non-essential t)) + (non-essential t) + (inhibit-message t)) (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) (setq host (match-string 1 host))) @@ -4689,68 +4691,70 @@ tramp-test26-interactive-file-name-completion tramp-postfix-ipv6-format)) test result completions) - ;; Complete method name. - (unless (string-empty-p tramp-method-regexp) - (ignore-errors (kill-buffer "*Completions*")) - (discard-input) - (setq test (concat - tramp-prefix-format - (substring-no-properties method 0 2)) - unread-command-events - (mapcar #'identity (concat test "\t\t\n")) - completions nil - result (read-file-name "Prompt: ")) - (if (not (get-buffer "*Completions*")) - (progn - (tramp--test-message - "syntax: %s style: %s test: %s result: %s" - syntax style test result) - (should - (string-prefix-p - (concat tramp-prefix-format method-string) - result))) - (with-current-buffer "*Completions*" - ;; We must remove leading `default-directory'. - (goto-char (point-min)) - (let ((inhibit-read-only t)) - (while (re-search-forward "//" nil 'noerror) - (delete-region (line-beginning-position) (point)))) - (goto-char (point-min)) - (re-search-forward - (rx bol (1+ nonl) "possible completions:" eol)) - (forward-line 1) - (setq completions - (split-string - (buffer-substring-no-properties (point) (point-max)) - (rx (any "\r\n")) 'omit))) - (tramp--test-message - "syntax: %s style: %s test: %s result: %s completions: %S" - syntax style test result completions) - (should (member method-string completions)))) - - ;; Complete host name. - (unless (or (tramp-string-empty-or-nil-p host) - (tramp--test-gvfs-p method)) + (dolist + (test-and-result + ;; These are triples (TEST-STRING SINGLE-RESULT + ;; COMPLETION-RESULT). + (append + ;; Complete method name. + (unless (string-empty-p tramp-method-regexp) + `((,(concat + tramp-prefix-format + (substring-no-properties method 0 2)) + ,(concat tramp-prefix-format method-string) + ,method-string))) + ;; Complete user name. + (unless (tramp-string-empty-or-nil-p user) + `((,(concat + tramp-prefix-format method-string + (substring-no-properties user 0 2)) + ,(concat + tramp-prefix-format method-string + user tramp-postfix-user-format) + ,(concat + user tramp-postfix-user-format)))) + ;; Complete host name. + (unless (tramp-string-empty-or-nil-p host) + `((,(concat + tramp-prefix-format method-string + ipv6-prefix (substring-no-properties host 0 2)) + ,(concat + tramp-prefix-format method-string + ipv6-prefix host + ipv6-postfix tramp-postfix-host-format) + ,(concat + ipv6-prefix host + ipv6-postfix tramp-postfix-host-format)))) + ;; Complete user and host name. + (unless (or (tramp-string-empty-or-nil-p user) + (tramp-string-empty-or-nil-p host)) + `((,(concat + tramp-prefix-format method-string + user tramp-postfix-user-format + ipv6-prefix (substring-no-properties host 0 2)) + ,(concat + tramp-prefix-format method-string + user tramp-postfix-user-format + ipv6-prefix host + ipv6-postfix tramp-postfix-host-format) + ,(concat + ipv6-prefix host + ipv6-postfix tramp-postfix-host-format)))))) + (ignore-errors (kill-buffer "*Completions*")) (discard-input) - (setq test (concat - tramp-prefix-format method-string - (substring-no-properties host 0 2)) + (setq test (car test-and-result) unread-command-events (mapcar #'identity (concat test "\t\t\n")) completions nil result (read-file-name "Prompt: ")) (if (not (get-buffer "*Completions*")) (progn - (tramp--test-message - "syntax: %s style: %s test: %s result: %s" - syntax style test result) - (should - (string-equal - (concat - tramp-prefix-format method-string - ipv6-prefix host ipv6-postfix tramp-postfix-host-format) - result))) + ;; (tramp--test-message + ;; "syntax: %s style: %s test: %s result: %s" + ;; syntax style test result) + (should (string-prefix-p (cadr test-and-result) result))) + (with-current-buffer "*Completions*" ;; We must remove leading `default-directory'. (goto-char (point-min)) @@ -4765,13 +4769,11 @@ tramp-test26-interactive-file-name-completion (split-string (buffer-substring-no-properties (point) (point-max)) (rx (any "\r\n")) 'omit))) - (tramp--test-message - "syntax: %s style: %s test: %s result: %s completions: %S" - syntax style test result completions) - (should - (member - (concat host tramp-postfix-host-format) - completions))))))) + + ;; (tramp--test-message + ;; "syntax: %s style: %s test: %s result: %s completions: %S" + ;; syntax style test result completions) + (should (member (caddr test-and-result) completions))))))) ;; Cleanup. (tramp-change-syntax orig-syntax))))) commit 074008ee2d24167ca21d5846e3d5a4466a1691a2 Author: Eli Zaretskii Date: Sat Feb 11 16:49:54 2023 +0200 ; Fix doc strings in lisp/image/ directory * lisp/image/wallpaper.el (wallpaper-setter) (wallpaper--find-command, wallpaper--x-monitor-name) (wallpaper--format-arg): * lisp/image/image-dired-util.el (image-dired-associated-dired-buffer) (image-dired--with-dired-buffer): * lisp/image/image-dired-tags.el (image-dired--with-db-file) (image-dired-remove-tag, image-dired-list-tags) (image-dired-tag-files, image-dired-write-comments) (image-dired-update-property): * lisp/image/image-dired-external.el (image-dired-cmd-pngnq-options) (image-dired-cmd-pngcrush-program) (image-dired-cmd-pngcrush-options) (image-dired-cmd-optipng-options) (image-dired-cmd-create-standard-thumbnail-options) (image-dired-cmd-rotate-original-program) (image-dired-cmd-rotate-original-options) (image-dired-cmd-write-exif-data-options, image-dired-queue) (image-dired-queue-active-limit, image-dired-pngnq-thumb) (image-dired-pngcrush-thumb, image-dired-optipng-thumb) (image-dired-thumb-queue-run, image-dired-get-exif-file-name) (image-dired-thumbnail-set-image-description): * lisp/image/image-dired.el (image-dired-thumbnail-storage) (image-dired-tags-db-file) (image-dired-rotate-original-ask-before-overwrite) (image-dired-line-up-method, image-dired-track-movement) (image-dired-display-properties-format) (image-dired-external-viewer) (image-dired-show-all-from-dir-max-files) (image-dired-insert-image) (image-dired-dired-with-window-configuration) (image-dired-restore-window-configuration) (image-dired-track-original-file) (image-dired-toggle-movement-tracking) (image-dired-format-properties-string) (image-dired--on-file-in-dired-buffer) (image-dired-thumbnail-display-external) (image-dired-display-image, image-dired-copy-filename-as-kill): * lisp/image/image-dired-dired.el (image-dired-dired-toggle-marked-thumbs) (image-dired-dired-after-readin-hook) (image-dired-next-line-and-display) (image-dired-previous-line-and-display) (image-dired-mark-and-display-next, image-dired-track-thumbnail) (image-dired-dired-next-line, image-dired-dired-previous-line) (image-dired-dired-display-external) (image-dired-copy-with-exif-file-name) (image-dired-mark-tagged-files) (image-dired-dired-display-properties): * lisp/image/image-crop.el (image-crop-exif-rotate) (image-crop-resize-command, image-crop-cut-command) (image-crop-crop-command, image-crop-rotate-command) (image-crop-buffer-text-function, image-cut-color): * lisp/image/image-converter.el (image-converter) (image-convert-to-format, image-converter-regexp) (image-converter--converters, image-convert-p, image-convert) (image-converter--value, image-converter--probe) (image-converter--find-converter, image-converter--convert) (image-converter-add-handler): * lisp/image/exif.el (exif-parse-buffer, exif-field) (exif-orientation, exif--direct-ascii-value) (exif--process-value, exif--read-chunk, exif--read-number-be) (exif--read-number-le, exif--read-number): Fix doc strings. diff --git a/lisp/image/exif.el b/lisp/image/exif.el index c561ea729af..503e3ffadc7 100644 --- a/lisp/image/exif.el +++ b/lisp/image/exif.el @@ -110,7 +110,7 @@ exif-parse-file (exif-parse-buffer))) (defun exif-parse-buffer (&optional buffer) - "Parse BUFFER (which should be a JPEG file) and return the Exif data, if any. + "Parse BUFFER (which should visit a JPEG file) and return Exif data, if any. The return value is a list of Exif items. If the data is invalid, an `exif-error' is signaled. @@ -134,17 +134,17 @@ exif-parse-buffer (exif--parse-exif-chunk app1)))))) (defun exif-field (field data) - "Return raw FIELD from EXIF. + "Return raw FIELD from Exif DATA. If FIELD is not present in the data, return nil. FIELD is a symbol in the cdr of `exif-tag-alist'. -DATA is the result of calling `exif-parse-file'." +DATA is the result of calling `exif-parse-file' or `exif-parse-buffer'." (plist-get (seq-find (lambda (e) (eq field (plist-get e :tag-name))) data) :value)) (defun exif-orientation (exif) - "Return the orientation (in degrees) in EXIF. + "Return the orientation (in degrees) in EXIF data. If the orientation isn't present in the data, return nil." (let ((code (exif-field 'orientation exif))) (cadr (assq code exif--orientation)))) @@ -254,21 +254,24 @@ exif--parse-directory ;; We've reached the end of the directories. dir)))) -(defun exif--direct-ascii-value (value bytes le) - "Make VALUE into a zero-terminated string. -VALUE is an integer representing BYTES characters." +(defun exif--direct-ascii-value (value nbytes le) + "Make a string representing VALUE with NBYTES bytes according to LE endianness. +VALUE is an integer value of NBYTES bytes. +The return value is a null-terminated unibyte string whose length is +NBYTES+1 bytes. If LE is non-nil, the returned string representation of +VALUE is little-endian, otherwise it is big-endian." (with-temp-buffer (set-buffer-multibyte nil) (if le - (dotimes (i bytes) + (dotimes (i nbytes) (insert (logand (ash value (* i -8)) 255))) - (dotimes (i bytes) - (insert (logand (ash value (* (- (1- bytes) i) -8)) 255)))) + (dotimes (i nbytes) + (insert (logand (ash value (* (- (1- nbytes) i) -8)) 255)))) (insert 0) (buffer-string))) (defun exif--process-value (value type le) - "Do type-based post-processing of the value." + "Do type-based post-processing of the VALUE whose endianness is per LE." (cl-case type ;; Chop off trailing zero byte. (ascii (substring value 0 (1- (length value)))) @@ -281,7 +284,8 @@ exif--process-value (otherwise value))) (defun exif--read-chunk (bytes) - "Return BYTES octets from the buffer and advance point that much." + "Return BYTES octets from the current buffer and advance point that much. +This function assumes that the current buffer is unibyte." (when (> (+ (point) bytes) (point-max)) (signal 'exif-error "Premature end of file")) (prog1 @@ -289,8 +293,9 @@ exif--read-chunk (forward-char bytes))) (defun exif--read-number-be (bytes) - "Read BYTES octets from the buffer as a chunk of big-endian bytes. -Advance point to after the read bytes." + "Read BYTES octets from the current buffer as a chunk of big-endian bytes. +Advance point to after the read bytes. +This function assumes that the current buffer is unibyte." (when (> (+ (point) bytes) (point-max)) (signal 'exif-error "Premature end of file")) (let ((sum 0)) @@ -300,8 +305,9 @@ exif--read-number-be sum)) (defun exif--read-number-le (bytes) - "Read BYTES octets from the buffer as a chunk of low-endian bytes. -Advance point to after the read bytes." + "Read BYTES octets from the current buffer as a chunk of little-endian bytes. +Advance point to after the read bytes. +This function assumes that the current buffer is unibyte." (when (> (+ (point) bytes) (point-max)) (signal 'exif-error "Premature end of file")) (let ((sum 0)) @@ -310,10 +316,11 @@ exif--read-number-le (forward-char 1)) sum)) -(defun exif--read-number (bytes lower-endian) - "Read BYTES octets from the buffer with endianness determined by LOWER-ENDIAN. -Advance point to after the read bytes." - (if lower-endian +(defun exif--read-number (bytes little-endian) + "Read BYTES octets from current buffer with endianness given by LITTLE-ENDIAN. +Advance point to after the read bytes. +This function assumes that the current buffer is unibyte." + (if little-endian (exif--read-number-le bytes) (exif--read-number-be bytes))) diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index 596e623357e..ff9d4ad0d82 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -38,9 +38,9 @@ image-converter installed on the system. The actual range of image formats that will be converted depends -on what image formats the chosen converter reports being able to -handle. `auto-mode-alist' is then used to further filter what -formats that are to be supported: Only the suffixes that map to +on the image formats which the chosen converter is able to +handle. `auto-mode-alist' is then used to further filter the +formats that are to be supported: only the suffixes that map to `image-mode' will be handled." :group 'image :type 'symbol @@ -48,16 +48,16 @@ image-converter (defcustom image-convert-to-format "png" "The image format to convert to. -This should be a string like \"png\" or \"ppm\" or some +This should be a string like \"png\" or \"ppm\", or some other (preferably lossless) format that Emacs understands -natively. The converter chosen has to support the format, and if -not, conversion will fail." +natively. The converter chosen has to support this format; if +not, the conversion will fail." :group 'image :version "29.1" :type 'string) (defvar image-converter-regexp nil - "A regexp that matches the file name suffixes that can be converted.") + "A regexp that matches the file name suffixes which can be converted.") (defvar image-converter-file-name-extensions nil "A list of file name suffixes that can be converted.") @@ -66,7 +66,7 @@ image-converter--converters '((graphicsmagick :command ("gm" "convert") :probe ("-list" "format")) (ffmpeg :command "ffmpeg" :probe "-decoders") (imagemagick :command "convert" :probe ("-list" "format"))) - "List of supported image converters to try.") + "List of supported image converters to try and required command-line switches.") (defvar image-converter--extra-converters (make-hash-table :test #'equal)) @@ -80,8 +80,8 @@ image-convert-p "Return `image-convert' if SOURCE is an image that can be converted. SOURCE can either be a file name or a string containing image data. In the latter case, DATA-P should be non-nil. If DATA-P -is a string, it should be a MIME format string like -\"image/gif\"." +is a string, it should be a MIME format string specifying the image type, +like \"image/gif\"." (image-converter-initialize) ;; When image-converter was customized (when (and image-converter (not image-converter-regexp)) @@ -101,22 +101,21 @@ image-convert-p 'image-convert)) (defun image-convert (image &optional image-format) - "Convert IMAGE file to an image format Emacs understands. -This will usually be \"png\", but this is controlled by the -`image-convert-to-format' user option. + "Convert IMAGE to an image format which Emacs understands. +This will usually be \"png\", but is controlled by the value +of the `image-convert-to-format' user option. -IMAGE can either be a file name or image data. - -To pass in image data, IMAGE should a string containing the image -data, and IMAGE-FORMAT should be a symbol with a MIME format name -like \"image/webp\". For instance: +IMAGE can either be a file name, an image object returned +by `create-image', or a string with image data. In the latter +case, IMAGE-FORMAT should be a symbol whose name is a MIME +specification of image format, such as \"image/webp\". +For instance: (image-convert data-string \\='image/bmp) -IMAGE can also be an image object as returned by `create-image'. - -This function converts the image the preferred format, and the -converted image data is returned as a string." +This function converts the image to the preferred format, per +the value of `image-convert-to-format', and returns the +converted image data as a string." (image-converter-initialize) (unless image-converter (error "No external image converters available")) @@ -152,14 +151,14 @@ image-convert (buffer-string)))) (defun image-converter--value (type elem) - "Return the value of ELEM of image converter TYPE." + "Return the value of property ELEM for image converter TYPE." (let ((value (plist-get (cdr (assq type image-converter--converters)) elem))) (if (stringp value) (list value) value))) (cl-defmethod image-converter--probe ((type (eql 'graphicsmagick))) - "Check whether the system has GraphicsMagick installed." + "Check whether the system has GraphicsMagick installed that's usable converter." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) @@ -177,7 +176,7 @@ image-converter--probe (nreverse formats))))) (cl-defmethod image-converter--probe ((type (eql 'imagemagick))) - "Check whether the system has ImageMagick installed." + "Check whether the system has ImageMagick installed that's a usable converter." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) @@ -197,7 +196,7 @@ image-converter--probe (nreverse formats)))) (cl-defmethod image-converter--probe ((type (eql 'ffmpeg))) - "Check whether the system has ffmpeg installed." + "Check whether the system has ffmpeg installed that's a usable converter." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) @@ -215,7 +214,7 @@ image-converter--probe (nreverse formats))))) (defun image-converter--find-converter () - "Find an installed image converter." + "Find an installed image converter Emacs can use." (catch 'done (dolist (elem image-converter--converters) (when-let ((formats (image-converter--filter-formats @@ -239,12 +238,12 @@ image-converter--filter-formats (cl-defmethod image-converter--convert ((type (eql 'graphicsmagick)) source image-format) - "Convert using GraphicsMagick." + "Convert image in SOURCE using GraphicsMagick." (image-converter--convert-magick type source image-format)) (cl-defmethod image-converter--convert ((type (eql 'imagemagick)) source image-format) - "Convert using ImageMagick." + "Convert image in SOURCE using ImageMagick." (image-converter--convert-magick type source image-format)) (defun image-converter--mime-type (image-format) @@ -281,7 +280,7 @@ image-converter--convert-magick (cl-defmethod image-converter--convert ((type (eql 'ffmpeg)) source image-format) - "Convert using ffmpeg." + "Convert image in SOURCE using ffmpeg." (let ((command (image-converter--value type :command)) (coding-system-for-read 'no-conversion)) (unless (zerop (if image-format @@ -308,12 +307,12 @@ image-converter--convert ;;;###autoload (defun image-converter-add-handler (suffix converter) - "Make Emacs use CONVERTER to parse image files that end with SUFFIX. -CONVERTER is a function with two parameters, where the first is -the file name or a string with the image data, and the second is -non-nil if the first parameter is image data. The converter -should output the image in the current buffer, converted to -`image-convert-to-format'." + "Make Emacs use CONVERTER to parse image files whose names end with SUFFIX. +CONVERTER is a function with two arguments, the file name or a string +with the image data, and a non-nil value if the first argument is image data. +The converter should produce the image in the current buffer, converted to +the format given by `image-convert-to-format'. +SUFFIX should not include the leading dot." (cl-pushnew suffix image-converter-file-name-extensions :test #'equal) (setq image-converter-file-name-extensions (sort image-converter-file-name-extensions #'string<)) diff --git a/lisp/image/image-crop.el b/lisp/image/image-crop.el index e6e5abf53d8..be6e22bc606 100644 --- a/lisp/image/image-crop.el +++ b/lisp/image/image-crop.el @@ -41,71 +41,71 @@ image-crop :group 'image) (defvar image-crop-exif-rotate nil - "If non-nil, rotate images by updating exif data. + "If non-nil, rotate images by updating Exif data. If nil, rotate the images \"physically\".") (defcustom image-crop-resize-command '("convert" "-resize" "%wx" "-" "%f:-") - "Command to resize an image. -The following `format-spec' elements are allowed: + "List of command and command-line arguments to resize an image. +The following `format-spec' elements are allowed in the value: %w: Width. -%f: Result file type." +%f: File type to produce." :type '(repeat string) :version "29.1") (defcustom image-crop-cut-command '("convert" "-draw" "rectangle %l,%t %r,%b" "-fill" "%c" "-" "%f:-") - "Command to cut a rectangle out of an image. + "List of command and its command-line arguments to cut a rectangle out of image. -The following `format-spec' elements are allowed: +The following `format-spec' elements are allowed in the value: %l: Left. %t: Top. %r: Right. %b: Bottom. %c: Color. -%f: Result file type." +%f: File type to produce." :type '(repeat string) :version "29.1") (defcustom image-crop-crop-command '("convert" "+repage" "-crop" "%wx%h+%l+%t" "-" "%f:-") - "Command to crop an image. + "List of command and its command-line arguments to crop an image. -The following `format-spec' elements are allowed: +The following `format-spec' elements are allowed in the value: %l: Left. %t: Top. %w: Width. %h: Height. -%f: Result file type." +%f: File type to produce." :type '(repeat string) :version "29.1") (defcustom image-crop-rotate-command '("convert" "-rotate" "%r" "-" "%f:-") - "Command to rotate an image. + "List of command and its command-line arguments to rotate an image. -The following `format-spec' elements are allowed: +The following `format-spec' elements are allowed in the value: %r: Rotation (in degrees). -%f: Result file type." +%f: File type to produce." :type '(repeat string) :version "29.1") (defvar image-crop-buffer-text-function #'image-crop--default-buffer-text - "Function to return the buffer text for the cropped image. -After cropping an image, the displayed image will be updated to -show the cropped image in the buffer. Different modes will have -different ways to represent this image data in a buffer. For -instance, an HTML-based mode might want to represent the image -with , 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 Date: Fri Feb 10 14:38:26 2023 +0100 LAP peephole optimiser improvementsa * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Make the improvements: - Add the rule stack-ref(X) discardN-preserve-tos(Y) --> discard(Y) stack-ref(X-Y), X≥Y discard(X) discardN-preserve-tos(Y-X-1), X OP return where OP is a unary operation such as `not` or `car`. - Generalise a previous rule to NOEFFECT PRODUCER return --> PRODUCER return where PRODUCER is now any op that pushes a value without looking at the stack: const, varref, point etc. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 3eef8f385b5..833e88887f9 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -2415,11 +2415,18 @@ byte-optimize-lapcode (setq keep-going t)) ;; - ;; OP const return --> const return - ;; where OP is side-effect-free (or mere stack manipulation). + ;; NOEFFECT PRODUCER return --> PRODUCER return + ;; where NOEFFECT lacks effects beyond stack change, + ;; PRODUCER pushes a result without looking at the stack: + ;; const, varref, point etc. ;; - ((and (eq (car lap1) 'byte-constant) - (eq (car (nth 2 rest)) 'byte-return) + ((and (eq (car (nth 2 rest)) 'byte-return) + (memq (car lap1) '( byte-constant byte-varref + byte-point byte-point-max byte-point-min + byte-following-char byte-preceding-char + byte-current-column + byte-eolp byte-eobp byte-bolp byte-bobp + byte-current-buffer byte-widen)) (or (memq (car lap0) '( byte-discard byte-discardN byte-discardN-preserve-tos byte-stack-set)) @@ -2430,6 +2437,35 @@ byte-optimize-lapcode (byte-compile-log-lap " %s %s %s\t-->\t%s %s" lap0 lap1 (nth 2 rest) lap1 (nth 2 rest))) + ;; + ;; discardN-preserve-tos OP return --> OP return + ;; dup OP return --> OP return + ;; where OP is 1->1 in stack use, like `not'. + ;; + ;; FIXME: ideally we should run this backwards, so that we could do + ;; discardN-preserve-tos OP1...OPn return -> OP1..OPn return + ;; but that would require a different approach. + ;; + ((and (eq (car (nth 2 rest)) 'byte-return) + (memq (car lap1) + '( byte-not + byte-symbolp byte-consp byte-stringp + byte-listp byte-integerp byte-numberp + byte-list1 + byte-car byte-cdr byte-car-safe byte-cdr-safe + byte-length + byte-add1 byte-sub1 byte-negate byte-nreverse + ;; There are more of these but the list is + ;; getting long and the gain is small. + )) + (or (memq (car lap0) '(byte-discardN-preserve-tos byte-dup)) + (and (eq (car lap0) 'byte-stack-set) + (eql (cdr lap0) 1)))) + (setq keep-going t) + (setcdr prev (cdr rest)) ; eat lap0 + (byte-compile-log-lap " %s %s %s\t-->\t%s %s" + lap0 lap1 (nth 2 rest) lap1 (nth 2 rest))) + ;; ;; goto-*-else-pop X ... X: goto-if-* --> whatever ;; goto-*-else-pop X ... X: discard --> whatever @@ -2659,6 +2695,63 @@ byte-optimize-lapcode (setcdr prev (cdr rest)) (byte-compile-log-lap " %s %s\t-->\t%s" lap0 lap1 lap1)) + ;; + ;; stack-ref(X) discardN-preserve-tos(Y) + ;; --> discard(Y) stack-ref(X-Y), X≥Y + ;; discard(X) discardN-preserve-tos(Y-X-1), X y 0)) + (cond + ((>= x y) ; --> discard(Y) stack-ref(X-Y) + (let ((new0 (if (= y 1) + (cons 'byte-discard nil) + (cons 'byte-discardN y))) + (new1 (if (= x y) + (cons 'byte-dup nil) + (cons 'byte-stack-ref (- x y))))) + (byte-compile-log-lap " %s %s\t-->\t%s %s" + lap0 lap1 new0 new1) + (setcar rest new0) + (setcar (cdr rest) new1))) + ((= x 0) ; --> discardN-preserve-tos(Y-1) + (setcdr prev (cdr rest)) ; eat lap0 + (if (> y 1) + (let ((new (cons 'byte-discardN-preserve-tos (- y 1)))) + (byte-compile-log-lap " %s %s\t-->\t%s" + lap0 lap1 new) + (setcar (cdr prev) new)) + (byte-compile-log-lap " %s %s\t-->\t" lap0 lap1) + (setcdr prev (cddr prev)))) ; eat lap1 + ((= y (+ x 1)) ; --> discard(X) + (setcdr prev (cdr rest)) ; eat lap0 + (let ((new (if (= x 1) + (cons 'byte-discard nil) + (cons 'byte-discardN x)))) + (byte-compile-log-lap " %s %s\t-->\t%s" lap0 lap1 new) + (setcar (cdr prev) new))) + (t ; --> discard(X) discardN-preserve-tos(Y-X-1) + (let ((new0 (if (= x 1) + (cons 'byte-discard nil) + (cons 'byte-discardN x))) + (new1 (cons 'byte-discardN-preserve-tos (- y x 1)))) + (byte-compile-log-lap " %s %s\t-->\t%s %s" + lap0 lap1 new0 new1) + (setcar rest new0) + (setcar (cdr rest) new1))))) + (setq keep-going t)) + ;; ;; goto-X ... X: discard ==> discard goto-Y ... X: discard Y: ;; commit dc3604cadfa8f4bc3e5d9346029e48b4268fcd60 Author: Alan Mackenzie Date: Sat Feb 11 10:45:31 2023 +0000 Make edebug see unused variables when lexical-binding is non-nil This fixes bug #59213. * lisp/emacs-lisp/cconv.el (cconv-dont-trim-unused-variables): New variable. (cconv-fv, cconv-make-interpreted-closure): Add/amend doc strings. (cconv-make-interpreted-closure): Test cconv-dont-trim-unused-variables, and if non-nil, don't "optimize" the lexical environment. * lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Compile a binding of cconv-dont-trim-unused-variables to t around the call of edebug-enter. * lisp/emacs-lisp/testconver.el (testcover-analyze-coverage): Add a new arm to the pcase form to handle the new form of edebug-enter. diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 570c9e66060..b8121aeba55 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -113,6 +113,10 @@ cconv--interactive-form-funs (defvar cconv--dynbound-variables nil "List of variables known to be dynamically bound.") +(defvar cconv-dont-trim-unused-variables nil + "When bound to non-nil, don't remove unused variables from the environment. +This is intended for use by edebug and similar.") + ;;;###autoload (defun cconv-closure-convert (form &optional dynbound-vars) "Main entry point for closure conversion. @@ -834,10 +838,13 @@ cconv-analyze-form (define-obsolete-function-alias 'cconv-analyse-form #'cconv-analyze-form "25.1") (defun cconv-fv (form lexvars dynvars) - "Return the list of free variables in FORM. -LEXVARS is the list of statically scoped vars in the context -and DYNVARS is the list of dynamically scoped vars in the context. -Returns a pair (LEXV . DYNV) of those vars actually used by FORM." + "Return the free variables used in FORM. +FORM is usually a function #\\='(lambda ...), but may be any valid +form. LEXVARS is a list of symbols, each of which is lexically +bound in FORM's context. DYNVARS is a list of symbols, each of +which is dynamically bound in FORM's context. +Returns a cons (LEXV . DYNV), the car and cdr being lists of the +lexically and dynamically bound symbols actually used by FORM." (let* ((fun ;; Wrap FORM into a function because the analysis code we ;; have only computes freevars for functions. @@ -875,11 +882,19 @@ cconv-fv (cons fvs dyns))))) (defun cconv-make-interpreted-closure (fun env) + "Make a closure for the interpreter. +This function is evaluated both at compile time and run time. +FUN, the closure's function, must be a lambda form. +ENV, the closure's environment, is a mixture of lexical bindings of the form +(SYMBOL . VALUE) and symbols which indicate dynamic bindings of those +symbols." (cl-assert (eq (car-safe fun) 'lambda)) (let ((lexvars (delq nil (mapcar #'car-safe env)))) - (if (null lexvars) - ;; The lexical environment is empty, so there's no need to - ;; look for free variables. + (if (or cconv-dont-trim-unused-variables (null lexvars)) + ;; The lexical environment is empty, or needs to be preserved, + ;; so there's no need to look for free variables. + ;; Attempting to replace ,(cdr fun) by a macroexpanded version + ;; causes bootstrap to fail. `(closure ,env . ,(cdr fun)) ;; We could try and cache the result of the macroexpansion and ;; `cconv-fv' analysis. Not sure it's worth the trouble. @@ -896,7 +911,7 @@ cconv-make-interpreted-closure (pcase expanded-form (`#'(lambda . ,cdr) cdr) (_ (cdr fun)))) - + (dynvars (delq nil (mapcar (lambda (b) (if (symbolp b) b)) env))) (fvs (cconv-fv expanded-form lexvars dynvars)) (newenv (nconc (mapcar (lambda (fv) (assq fv env)) (car fvs)) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 2f7d03e9d79..735a358cdba 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1217,16 +1217,16 @@ edebug-make-enter-wrapper (setq edebug-old-def-name nil)) (setq edebug-def-name (or edebug-def-name edebug-old-def-name (gensym "edebug-anon"))) - `(edebug-enter - (quote ,edebug-def-name) - ,(if edebug-inside-func - `(list - ;; Doesn't work with more than one def-body!! - ;; But the list will just be reversed. - ,@(nreverse edebug-def-args)) - 'nil) - (function (lambda () ,@forms)) - )) + `(let ((cconv-dont-trim-unused-variables t)) + (edebug-enter + (quote ,edebug-def-name) + ,(if edebug-inside-func + `(list + ;; Doesn't work with more than one def-body!! + ;; But the list will just be reversed. + ,@(nreverse edebug-def-args)) + 'nil) + (function (lambda () ,@forms))))) (defvar edebug-form-begin-marker) ; the mark for def being instrumented diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index ed31b90ca32..1212905f08a 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -442,6 +442,11 @@ testcover-analyze-coverage (let ((testcover-vector (get sym 'edebug-coverage))) (testcover-analyze-coverage-progn body))) + (`(let ((cconv-dont-trim-unused-variables t)) + (edebug-enter ',sym ,_ (function (lambda nil . ,body)))) + (let ((testcover-vector (get sym 'edebug-coverage))) + (testcover-analyze-coverage-progn body))) + (`(edebug-after ,(and before-form (or `(edebug-before ,before-id) before-id)) ,after-id ,wrapped-form) commit 2d1e43436da93defe13ad125de46e3bce41172c3 Author: Eli Zaretskii Date: Sat Feb 11 12:28:43 2023 +0200 ; Improve documentation of hash functions. * src/fns.c (Fsecure_hash, Fmd5): Document the length of the return values. * lisp/subr.el (sha1): Describe the return value in more detail. * doc/lispref/text.texi (Checksum/Hash): Document 'sha1'. Document the length of the strings returned by each hashing algorithm. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 326c111cac5..0a48beab8b8 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -4947,16 +4947,38 @@ Checksum/Hash If the argument @var{binary} is omitted or @code{nil}, the function returns the @dfn{text form} of the hash, as an ordinary Lisp string. If @var{binary} is non-@code{nil}, it returns the hash in @dfn{binary -form}, as a sequence of bytes stored in a unibyte string. +form}, as a sequence of bytes stored in a unibyte string. The length +of the returned string depends on @var{algorithm}: + +@itemize +@item +For @code{md5}: 32 characters (32 bytes if @var{binary} is +non-@code{nil}). +@item +For @code{sha1}: 40 characters (40 bytes if @var{binary} is +non-@code{nil}). +@item +For @code{sha224}: 56 characters (56 bytes if @var{binary} is +non-@code{nil}). +@item +For @code{sha256}: 64 characters (64 bytes if @var{binary} is +non-@code{nil}). +@item +For @code{sha384}: 96 characters (96 bytes if @var{binary} is +non-@code{nil}). +@item +For @code{sha512}: 128 characters (128 bytes if @var{binary} is +non-@code{nil}). +@end itemize This function does not compute the hash directly from the internal representation of @var{object}'s text (@pxref{Text Representations}). Instead, it encodes the text using a coding system (@pxref{Coding Systems}), and computes the hash from that encoded text. If @var{object} is a buffer, the coding system used is the one which -would be chosen by default for writing the text into a file. If -@var{object} is a string, the user's preferred coding system is used -(@pxref{Recognize Coding,,, emacs, GNU Emacs Manual}). +would be chosen by default for writing the text of that buffer into a +file. If @var{object} is a string, the user's preferred coding system +is used (@pxref{Recognize Coding,,, emacs, GNU Emacs Manual}). @end defun @defun md5 object &optional start end coding-system noerror @@ -4964,7 +4986,7 @@ Checksum/Hash most purposes it is equivalent to calling @code{secure-hash} with @code{md5} as the @var{algorithm} argument. The @var{object}, @var{start} and @var{end} arguments have the same meanings as in -@code{secure-hash}. +@code{secure-hash}. The function returns a 32-character string. If @var{coding-system} is non-@code{nil}, it specifies a coding system to use to encode the text; if omitted or @code{nil}, the default @@ -4987,7 +5009,20 @@ Checksum/Hash @code{secure-hash} is, and should not allocate more memory. @c Note that we do not document what hashing function we're using, or @c even whether it's a cryptographic hash, since that may change -@c according to what we find useful. +@c according to what we find useful. We also don't document the +@c length of the hash string it returns, since that can be used to +@c guess the hashing function being used. +@end defun + +@defun sha1 object &optional start end binary +This function is equivalent to calling @code{secure-hash} like this: + +@lisp +(secure-hash 'sha1 object start end binary) +@end lisp + +It returns a 40-character string if @var{binary} is @code{nil}, or a +40-byte unibyte string otherwise. @end defun @node Suspicious Text diff --git a/lisp/subr.el b/lisp/subr.el index 32c997425cf..9e6388987df 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4160,8 +4160,8 @@ sha1 "Return the SHA-1 (Secure Hash Algorithm) of an OBJECT. OBJECT is either a string or a buffer. Optional arguments START and END are character positions specifying which portion of OBJECT for -computing the hash. If BINARY is non-nil, return a string in binary -form. +computing the hash. If BINARY is non-nil, return a 40-byte unibyte +string; otherwise returna 40-character string. Note that SHA-1 is not collision resistant and should not be used for anything security-related. See `secure-hash' for diff --git a/src/fns.c b/src/fns.c index 3984e318feb..ff364c65e26 100644 --- a/src/fns.c +++ b/src/fns.c @@ -5804,8 +5804,9 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, DEFUN ("md5", Fmd5, Smd5, 1, 5, 0, doc: /* Return MD5 message digest of OBJECT, a buffer or string. -A message digest is a cryptographic checksum of a document, and the -algorithm to calculate it is defined in RFC 1321. +A message digest is the string representation of the cryptographic checksum +of a document, and the algorithm to calculate it is defined in RFC 1321. +The MD5 digest is 32-character long. The two optional arguments START and END are character positions specifying for which part of OBJECT the message digest should be @@ -5839,12 +5840,12 @@ DEFUN ("md5", Fmd5, Smd5, 1, 5, 0, DEFUN ("secure-hash", Fsecure_hash, Ssecure_hash, 2, 5, 0, doc: /* Return the secure hash of OBJECT, a buffer or string. ALGORITHM is a symbol specifying the hash to use: -- md5 corresponds to MD5 -- sha1 corresponds to SHA-1 -- sha224 corresponds to SHA-2 (SHA-224) -- sha256 corresponds to SHA-2 (SHA-256) -- sha384 corresponds to SHA-2 (SHA-384) -- sha512 corresponds to SHA-2 (SHA-512) +- md5 corresponds to MD5, produces a 32-character signature +- sha1 corresponds to SHA-1, produces a 40-character signature +- sha224 corresponds to SHA-2 (SHA-224), produces a 56-character signature +- sha256 corresponds to SHA-2 (SHA-256), produces a 64-character signature +- sha384 corresponds to SHA-2 (SHA-384), produces a 96-character signature +- sha512 corresponds to SHA-2 (SHA-512), produces a 128-character signature The two optional arguments START and END are positions specifying for which part of OBJECT to compute the hash. If nil or omitted, uses the commit 900f7e07275405d8e40ce19b91eca3f5b0f3a870 Author: Eli Zaretskii Date: Sat Feb 11 11:48:48 2023 +0200 ; Remove extraneous local variables from image-dired-*.el files These cause annoying prompts when visiting these files, and evidently belong to a third-party package. * lisp/image/image-dired-external.el: * lisp/image/image-dired-tags.el: * lisp/image/image-dired-dired.el: * lisp/image/image-dired-util.el: Remove unsafe local-variables. diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index 85bdd537c27..3e2b47a618f 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -405,8 +405,4 @@ image-dired-dired-display-properties (provide 'image-dired-dired) -;; Local Variables: -;; nameless-current-name: "image-dired" -;; End: - ;;; image-dired-dired.el ends here diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el index b3ee4b36ad3..6e14fb1dab3 100644 --- a/lisp/image/image-dired-external.el +++ b/lisp/image/image-dired-external.el @@ -466,8 +466,4 @@ 'image-dired-thumb-size (provide 'image-dired-external) -;; Local Variables: -;; nameless-current-name: "image-dired" -;; End: - ;;; image-dired-external.el ends here diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.el index 039a7a6617a..b36c526fde0 100644 --- a/lisp/image/image-dired-tags.el +++ b/lisp/image/image-dired-tags.el @@ -378,8 +378,4 @@ image-dired-save-information-from-widgets (provide 'image-dired-tags) -;; Local Variables: -;; nameless-current-name: "image-dired" -;; End: - ;;; image-dired-tags.el ends here diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index c03f9d2e3d3..ebde531f723 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -179,8 +179,4 @@ image-dired-window-width-pixels (provide 'image-dired-util) -;; Local Variables: -;; nameless-current-name: "image-dired" -;; End: - ;;; image-dired-util.el ends here commit 4f053afe8e792c6261d4be0376e2ef0c91353188 Author: Tassilo Horn Date: Fri Feb 10 19:22:56 2023 +0100 bug-reference: prevent match-data clobbering (bug#61395) * lisp/progmodes/bug-reference.el (bug-reference-fontify): Wrap call to syntax-ppss in save-match-data since it can clobber our match-data (bug#61395). diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 9f1439e6a04..bc280284588 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -174,7 +174,7 @@ bug-reference-fontify (re-search-forward bug-reference-bug-regexp end-line 'move)) (when (or (not bug-reference-prog-mode) ;; This tests for both comment and string syntax. - (nth 8 (syntax-ppss))) + (nth 8 (save-match-data (syntax-ppss)))) (let* ((bounds (bug-reference--overlay-bounds)) (overlay (or (let ((ov (pop overlays))) commit 10af9fbcad107ae76f50d408e0d6d04e082cc6d8 Author: Basil L. Contovounesios Date: Fri Feb 10 15:24:45 2023 +0000 ; * admin/notes/tree-sitter/starter-guide: Typos. Reported by Romanos Skiadas . diff --git a/admin/notes/tree-sitter/starter-guide b/admin/notes/tree-sitter/starter-guide index 606f7891dfa..b8910aab5ca 100644 --- a/admin/notes/tree-sitter/starter-guide +++ b/admin/notes/tree-sitter/starter-guide @@ -45,7 +45,7 @@ You can use this script that I put together here: You can also find them under this directory in /build-modules. This script automatically pulls and builds language definitions for C, -C++, Rust, JSON, Go, HTML, Javascript, CSS, Python, Typescript, +C++, Rust, JSON, Go, HTML, JavaScript, CSS, Python, Typescript, and C#. Better yet, I pre-built these language definitions for GNU/Linux and macOS, they can be downloaded here: @@ -271,7 +271,7 @@ Matchers and anchors are functions that takes (NODE PARENT BOL &rest _). Matches return nil/non-nil for no match/match, and anchors return the anchor point. Below are some convenient builtin matchers and anchors. -For MATHCER we have +For MATCHER we have (parent-is TYPE) => matches if PARENT’s type matches TYPE as regexp (node-is TYPE) => matches NODE’s type commit 9ac242ce93d7c4fbc34b556f4fa0d2ac2ebac604 Author: Eli Zaretskii Date: Fri Feb 10 14:14:05 2023 +0200 ; Fix recent changes in treesit docs * doc/lispref/parsing.texi (Accessing Node Information): Fix wording and indexing, and add cross-reference. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index b22b3eb25c3..fd65fa3e75b 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -970,15 +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 tree-sitter, live parsing node @cindex live node, tree-sitter -A node is ``live'' if its parser is not deleted, and the buffer it -belongs to is live. +A node is considered @dfn{live} if its parser is not deleted, and the +buffer to which it belongs to is a live buffer (@pxref{Killing Buffers}). @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}, @code{has-error}, or @code{live}. +This function returns non-@code{nil} if @var{node} has the specified +@var{property}. @var{property} can be @code{named}, @code{missing}, +@code{extra}, @code{outdated}, @code{has-error}, or @code{live}. @end defun @defun treesit-node-type node commit f5789aefc2e245075b5cced402edb086fefb60ef Author: Yuan Fu Date: Thu Feb 9 23:25:57 2023 -0800 Rename LIMIT to DEPTH in tree-sitter functions (bug#61231) I only changed the Lisp functions, internal functions are left unchanged. * doc/lispref/parsing.texi (Retrieving Nodes): Update manual. * src/treesit.c (Ftreesit_search_subtree) (Ftreesit_induce_sparse_tree): Change LIMIT to DEPTH. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 53787d7e54d..b22b3eb25c3 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -734,7 +734,7 @@ Retrieving Nodes @heading Searching for node -@defun treesit-search-subtree node predicate &optional backward all limit +@defun treesit-search-subtree node predicate &optional backward all depth This function traverses the subtree of @var{node} (including @var{node} itself), looking for a node for which @var{predicate} returns non-@code{nil}. @var{predicate} is a regexp that is matched @@ -745,9 +745,9 @@ Retrieving Nodes By default, this function only traverses named nodes, but if @var{all} is non-@code{nil}, it traverses all the nodes. If @var{backward} is non-@code{nil}, it traverses backwards (i.e., it visits the last child -first when traversing down the tree). If @var{limit} is +first when traversing down the tree). If @var{depth} is non-@code{nil}, it must be a number that limits the tree traversal to -that many levels down the tree. If @var{limit} is @code{nil}, it +that many levels down the tree. If @var{depth} is @code{nil}, it defaults to 1000. @end defun @@ -805,7 +805,7 @@ Retrieving Nodes as in @code{treesit-search-forward}. @end defun -@defun treesit-induce-sparse-tree root predicate &optional process-fn limit +@defun treesit-induce-sparse-tree root predicate &optional process-fn depth This function creates a sparse tree from @var{root}'s subtree. It takes the subtree under @var{root}, and combs it so only the nodes @@ -836,8 +836,8 @@ Retrieving Nodes If @var{process-fn} is non-@code{nil}, instead of returning the matched nodes, this function passes each node to @var{process-fn} and -uses the returned value instead. If non-@code{nil}, @var{limit} is -the number of levels to go down from @var{root}. If @var{limit} is +uses the returned value instead. If non-@code{nil}, @var{depth} is +the number of levels to go down from @var{root}. If @var{depth} is @code{nil}, it defaults to 1000. Each node in the returned tree looks like diff --git a/src/treesit.c b/src/treesit.c index 01c7621c6ea..cab2f0d5354 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -3150,13 +3150,13 @@ DEFUN ("treesit-search-subtree", node's type, or a function that takes a node and returns nil/non-nil. By default, only traverse named nodes, but if ALL is non-nil, traverse -all nodes. If BACKWARD is non-nil, traverse backwards. If LIMIT is +all nodes. If BACKWARD is non-nil, traverse backwards. If DEPTH is non-nil, only traverse nodes up to that number of levels down in the -tree. If LIMIT is nil, default to 1000. +tree. If DEPTH is nil, default to 1000. Return the first matched node, or nil if none matches. */) (Lisp_Object node, Lisp_Object predicate, Lisp_Object backward, - Lisp_Object all, Lisp_Object limit) + Lisp_Object all, Lisp_Object depth) { CHECK_TS_NODE (node); CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), @@ -3167,10 +3167,10 @@ DEFUN ("treesit-search-subtree", /* We use a default limit of 1000. See bug#59426 for the discussion. */ ptrdiff_t the_limit = treesit_recursion_limit; - if (!NILP (limit)) + if (!NILP (depth)) { - CHECK_FIXNUM (limit); - the_limit = XFIXNUM (limit); + CHECK_FIXNUM (depth); + the_limit = XFIXNUM (depth); } treesit_initialize (); @@ -3322,8 +3322,8 @@ DEFUN ("treesit-induce-sparse-tree", that case, instead of returning the matched nodes, pass each node to PROCESS-FN, and use its return value instead. -If non-nil, LIMIT is the number of levels to go down the tree from -ROOT. If LIMIT is nil or omitted, it defaults to 1000. +If non-nil, DEPTH is the number of levels to go down the tree from +ROOT. If DEPTH is nil or omitted, it defaults to 1000. Each node in the returned tree looks like (NODE . (CHILD ...)). The root of this tree might be nil, if ROOT doesn't match PREDICATE. @@ -3334,7 +3334,7 @@ DEFUN ("treesit-induce-sparse-tree", nil/non-nil, but it is slower and more memory consuming than using a regexp. */) (Lisp_Object root, Lisp_Object predicate, Lisp_Object process_fn, - Lisp_Object limit) + Lisp_Object depth) { CHECK_TS_NODE (root); CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), @@ -3346,10 +3346,10 @@ DEFUN ("treesit-induce-sparse-tree", /* We use a default limit of 1000. See bug#59426 for the discussion. */ ptrdiff_t the_limit = treesit_recursion_limit; - if (!NILP (limit)) + if (!NILP (depth)) { - CHECK_FIXNUM (limit); - the_limit = XFIXNUM (limit); + CHECK_FIXNUM (depth); + the_limit = XFIXNUM (depth); } treesit_initialize (); commit b39821fdcef5d094838a978d2b0ab1ebb44b7cb8 Author: Simon Pugnet Date: Thu Feb 9 11:33:31 2023 +0000 ; Fix incorrect function name in treesit manual An example in the documentation uses the function 'treesit-get-parser-create' which does not exist. Replace this with 'treesit-parser-create'. * admin/notes/tree-sitter/html-manual/Multiple-Languages.html: * doc/lispref/parsing.texi (Multiple Languages): Change example. Copyright-paperwork-exempt: yes diff --git a/admin/notes/tree-sitter/html-manual/Multiple-Languages.html b/admin/notes/tree-sitter/html-manual/Multiple-Languages.html index 65507687d51..390d9082590 100644 --- a/admin/notes/tree-sitter/html-manual/Multiple-Languages.html +++ b/admin/notes/tree-sitter/html-manual/Multiple-Languages.html @@ -223,9 +223,9 @@

;; 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 Fu 
Date:   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")))