commit 1704fa4fb4164a15c7e258b922dbba190811d92d (HEAD, refs/remotes/origin/master) Author: Jim Porter Date: Sat Nov 9 16:06:34 2024 -0800 When using Eshell's "du" implementation, deduplicate hard links * lisp/eshell/em-unix.el (eshell-du-sum-directory): Take SEEN-FILES. (eshell/du): Create 'seen-files' hash table. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 74d61e82bef..9cdc0ca6f25 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -860,11 +860,15 @@ external command." (cl-defun eshell-du-sum-directory (path depth-remaining &rest args &key print-function show-all - dereference-links only-one-filesystem) + dereference-links only-one-filesystem + seen-files) "Summarize PATH, and its member directories." (let ((size 0.0)) (dolist (entry (eshell-directory-files-and-attributes path)) - (unless (string-match "\\`\\.\\.?\\'" (car entry)) + (unless (or (string-match "\\`\\.\\.?\\'" (car entry)) + (gethash (file-attribute-file-identifier (cdr entry)) + seen-files)) + (puthash (file-attribute-file-identifier (cdr entry)) t seen-files) (let* ((file-name (concat path "/" (car entry))) (file-type (file-attribute-type (cdr entry))) (symlink (and (stringp file-type) file-type))) @@ -938,6 +942,7 @@ Summarize disk usage of each FILE, recursively for directories.") (when (eshell-under-windows-p) (setq only-one-filesystem nil)) (let ((size 0.0) + (seen-files (make-hash-table :test #'equal)) (print-function (lambda (size name) (let ((size-str (eshell-printable-size size human-readable @@ -952,7 +957,8 @@ Summarize disk usage of each FILE, recursively for directories.") (directory-file-name arg) max-depth :print-function print-function :show-all show-all :dereference-links dereference-links - :only-one-filesystem only-one-filesystem)))) + :only-one-filesystem only-one-filesystem + :seen-files seen-files)))) (when grand-total (funcall print-function size "total")))))) commit 37c583a2c2f97c6fb0ed0433db9c74c6a1758e3e Author: Jim Porter Date: Tue Jan 30 10:51:03 2024 -0800 Don't use dynamically-bound variables for Eshell's "du" command * lisp/eshell/em-unix.el (block-size, by-bytes, dereference-links) (grand-total, human-readable, max-depth, only-one-filesystem, show-all) (eshell-du-size-string): Remove. (eshell-du-sum-directory): Accept key arguments for adjusting behavior. (eshell/du): Use 'block-size' of 1 instead of 'by-bytes', and define a print function. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 17dd14d0f3e..74d61e82bef 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -858,54 +858,35 @@ external command." pcomplete-last-completion-raw t) (throw 'pcomplete-completions (pcomplete-read-host-names))))) -(defvar block-size) -(defvar by-bytes) -(defvar dereference-links) -(defvar grand-total) -(defvar human-readable) -(defvar max-depth) -(defvar only-one-filesystem) -(defvar show-all) - -(defsubst eshell-du-size-string (size) - (let* ((str (eshell-printable-size size human-readable block-size t)) - (len (length str))) - (concat str (if (< len 8) - (make-string (- 8 len) ? ))))) - -(defun eshell-du-sum-directory (path depth) +(cl-defun eshell-du-sum-directory (path depth-remaining &rest args + &key print-function show-all + dereference-links only-one-filesystem) "Summarize PATH, and its member directories." - (let ((entries (eshell-directory-files-and-attributes path)) - (size 0.0)) - (while entries - (unless (string-match "\\`\\.\\.?\\'" (caar entries)) - (let* ((entry (concat path "/" - (caar entries))) - (symlink (and (stringp (file-attribute-type (cdar entries))) - (file-attribute-type (cdar entries))))) + (let ((size 0.0)) + (dolist (entry (eshell-directory-files-and-attributes path)) + (unless (string-match "\\`\\.\\.?\\'" (car entry)) + (let* ((file-name (concat path "/" (car entry))) + (file-type (file-attribute-type (cdr entry))) + (symlink (and (stringp file-type) file-type))) (unless (or (and symlink (not dereference-links)) (and only-one-filesystem (/= only-one-filesystem - (file-attribute-device-number (cdar entries))))) - (if symlink - (setq entry symlink)) + (file-attribute-device-number (cdr entry))))) + (when symlink + (setq file-name symlink)) (setq size (+ size - (if (eq t (car (cdar entries))) - (eshell-du-sum-directory entry (1+ depth)) - (let ((file-size (file-attribute-size (cdar entries)))) - (prog1 - file-size - (if show-all - (eshell-print - (concat (eshell-du-size-string file-size) - entry "\n"))))))))))) - (setq entries (cdr entries))) - (if (or (not max-depth) - (= depth max-depth) - (= depth 0)) - (eshell-print (concat (eshell-du-size-string size) - (directory-file-name path) "\n"))) + (if (eq file-type t) ; This is a directory. + (apply #'eshell-du-sum-directory file-name + (when depth-remaining (1- depth-remaining)) + args) + (let ((file-size (file-attribute-size (cdr entry)))) + (when show-all + (funcall print-function file-size file-name)) + file-size)))))))) + (when (or (not depth-remaining) + (natnump depth-remaining)) + (funcall print-function size (directory-file-name path))) size)) (defun eshell/du (&rest args) @@ -917,7 +898,7 @@ external command." "write counts for all files, not just directories") (nil "block-size" t block-size "use SIZE-byte blocks (i.e., --block-size SIZE)") - (?b "bytes" nil by-bytes + (?b "bytes" 1 block-size "print size in bytes") (?c "total" nil grand-total "produce a grand total") @@ -948,8 +929,7 @@ Summarize disk usage of each FILE, recursively for directories.") args))) (ext-du (eshell-search-path "du"))) (throw 'eshell-external (eshell-external-command ext-du original-args))) - (unless by-bytes - (setq block-size (or block-size 1024))) + (setq block-size (or block-size 1024)) (when (stringp block-size) (setq block-size (string-to-number block-size))) (when (stringp max-depth) @@ -957,17 +937,24 @@ Summarize disk usage of each FILE, recursively for directories.") ;; Filesystem support means nothing under MS-Windows. (when (eshell-under-windows-p) (setq only-one-filesystem nil)) - (let ((size 0.0)) + (let ((size 0.0) + (print-function + (lambda (size name) + (let ((size-str (eshell-printable-size size human-readable + block-size t))) + (eshell-print (concat (string-pad size-str 8) name "\n")))))) (dolist (arg (or args '("."))) (when only-one-filesystem (setq only-one-filesystem (file-attribute-device-number (eshell-file-attributes (file-name-as-directory arg))))) (setq size (+ size (eshell-du-sum-directory - (directory-file-name arg) 0)))) - (if grand-total - (eshell-print (concat (eshell-du-size-string size) - "total\n"))))))) + (directory-file-name arg) max-depth + :print-function print-function :show-all show-all + :dereference-links dereference-links + :only-one-filesystem only-one-filesystem)))) + (when grand-total + (funcall print-function size "total")))))) (put 'eshell/du 'eshell-filename-arguments t) commit f26fb25ec8ca12901db6224973c7fef29ce938f9 Author: Jim Porter Date: Fri Nov 8 23:12:53 2024 -0800 Use the Lisp implemention of "du" in Eshell when querying remote dirs * lisp/eshell/em-unix.el (eshell/du): If all directories are local, use the external "du" instead. diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 671573f38c5..17dd14d0f3e 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -910,67 +910,64 @@ external command." (defun eshell/du (&rest args) "Implementation of \"du\" in Lisp, passing ARGS." - (setq args (if args - (eshell-stringify-list (flatten-tree args)) - '("."))) - (let ((ext-du (eshell-search-path "du"))) - (if (and ext-du - (not (catch 'have-ange-path - (dolist (arg args) - (if (string-equal - (file-remote-p (expand-file-name arg) 'method) "ftp") - (throw 'have-ange-path t)))))) - (throw 'eshell-external (eshell-external-command ext-du args)) - (eshell-eval-using-options - "du" args - '((?a "all" nil show-all - "write counts for all files, not just directories") - (nil "block-size" t block-size - "use SIZE-byte blocks (i.e., --block-size SIZE)") - (?b "bytes" nil by-bytes - "print size in bytes") - (?c "total" nil grand-total - "produce a grand total") - (?d "max-depth" t max-depth - "display data only this many levels of data") - (?h "human-readable" 1024 human-readable - "print sizes in human readable format") - (?H "si" 1000 human-readable - "likewise, but use powers of 1000 not 1024") - (?k "kilobytes" 1024 block-size - "like --block-size 1024") - (?L "dereference" nil dereference-links - "dereference all symbolic links") - (?m "megabytes" 1048576 block-size - "like --block-size 1048576") - (?s "summarize" 0 max-depth - "display only a total for each argument") - (?x "one-file-system" nil only-one-filesystem - "skip directories on different filesystems") - (nil "help" nil nil - "show this usage screen") - :external "du" - :usage "[OPTION]... FILE... + (let ((original-args args)) + (eshell-eval-using-options + "du" args + '((?a "all" nil show-all + "write counts for all files, not just directories") + (nil "block-size" t block-size + "use SIZE-byte blocks (i.e., --block-size SIZE)") + (?b "bytes" nil by-bytes + "print size in bytes") + (?c "total" nil grand-total + "produce a grand total") + (?d "max-depth" t max-depth + "display data only this many levels of data") + (?h "human-readable" 1024 human-readable + "print sizes in human readable format") + (?H "si" 1000 human-readable + "likewise, but use powers of 1000 not 1024") + (?k "kilobytes" 1024 block-size + "like --block-size 1024") + (?L "dereference" nil dereference-links + "dereference all symbolic links") + (?m "megabytes" 1048576 block-size + "like --block-size 1048576") + (?s "summarize" 0 max-depth + "display only a total for each argument") + (?x "one-file-system" nil only-one-filesystem + "skip directories on different filesystems") + (nil "help" nil nil + "show this usage screen") + :external "du" + :usage "[OPTION]... FILE... Summarize disk usage of each FILE, recursively for directories.") - (unless by-bytes - (setq block-size (or block-size 1024))) - (if (and max-depth (stringp max-depth)) - (setq max-depth (string-to-number max-depth))) - ;; filesystem support means nothing under Windows - (if (eshell-under-windows-p) - (setq only-one-filesystem nil)) - (let ((size 0.0)) - (while args - (if only-one-filesystem - (setq only-one-filesystem - (file-attribute-device-number (eshell-file-attributes - (file-name-as-directory (car args)))))) - (setq size (+ size (eshell-du-sum-directory - (directory-file-name (car args)) 0))) - (setq args (cdr args))) - (if grand-total - (eshell-print (concat (eshell-du-size-string size) - "total\n")))))))) + ;; If possible, use the external "du" command. + (when-let* (((not (seq-some + (lambda (i) (and (stringp i) (file-remote-p i))) + args))) + (ext-du (eshell-search-path "du"))) + (throw 'eshell-external (eshell-external-command ext-du original-args))) + (unless by-bytes + (setq block-size (or block-size 1024))) + (when (stringp block-size) + (setq block-size (string-to-number block-size))) + (when (stringp max-depth) + (setq max-depth (string-to-number max-depth))) + ;; Filesystem support means nothing under MS-Windows. + (when (eshell-under-windows-p) + (setq only-one-filesystem nil)) + (let ((size 0.0)) + (dolist (arg (or args '("."))) + (when only-one-filesystem + (setq only-one-filesystem + (file-attribute-device-number + (eshell-file-attributes (file-name-as-directory arg))))) + (setq size (+ size (eshell-du-sum-directory + (directory-file-name arg) 0)))) + (if grand-total + (eshell-print (concat (eshell-du-size-string size) + "total\n"))))))) (put 'eshell/du 'eshell-filename-arguments t) commit f6a63e4b441424298f1239372ec50b528d343b65 Author: Stefan Kangas Date: Sun Nov 10 01:29:18 2024 +0100 Don't pcomplete 'find -newerxy' flag * lisp/pcmpl-gnu.el (pcomplete/find): Remove -newerxy flag. This flag is not used verbatim like that, and we already complete the "-newer" flag, which should be all that users need. Problem reported by Juri Linkov . diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el index efba0cc2d34..2b48255f3f1 100644 --- a/lisp/pcmpl-gnu.el +++ b/lisp/pcmpl-gnu.el @@ -360,7 +360,7 @@ Return the new list." "-inum" "-ipath" "-iregex" "-iwholename" "-links" "-lname" "-ls" "-maxdepth" "-mindepth" "-mmin" "-mount" "-mtime" - "-name" "-newer" "-newerxy" "-nogroup" "-noignore_readdir_race" + "-name" "-newer" "-nogroup" "-noignore_readdir_race" "-noleaf" "-nouser" "-nowarn" "-ok" "-okdir" "-path" "-perm" "-print" "-print0" "-printf" "-prune" "-quit" commit daa42ddebea6a798648f03f41497fddfcb3e0de9 Author: Eli Zaretskii Date: Sat Nov 9 07:38:42 2024 -0500 ; * etc/NEWS.30: Fix merge result. diff --git a/etc/NEWS.30 b/etc/NEWS.30 index 3c765b97542..fbc29206039 100644 --- a/etc/NEWS.30 +++ b/etc/NEWS.30 @@ -57,10 +57,10 @@ operating systems instead. --- ** New configuration option '--disable-gc-mark-trace'. -This disables the GC mark trace buffer for about 5 % better garbage +This disables the GC mark trace buffer for about 5% better garbage collection performance. Doing so may make it more difficult for Emacs developers to help finding GC-related bugs that you run into, which is -why it the mark trace buffer is enabled by default. +why the mark trace buffer is enabled by default. * Startup Changes in Emacs 30.1 commit 61c8cc740e15c114e937915c2e81ba6c82c66af2 Merge: 6abe4feb73c dbcd9d782c9 Author: Eli Zaretskii Date: Sat Nov 9 07:35:12 2024 -0500 Merge from origin/emacs-30 dbcd9d782c9 Fix documentation and error message of adding local varia... 94bf7ad797b Document the 'display-line-numbers-disable' property b1be0f2ba6b Document issues with 'use-package's ':custom' and byte co... 775970a7831 ; * src/ftcrfont.c (ftcrhbfont_end_hb_font): Improve comm... 9149aa89ee8 Fix display of compositions when font style changes (Cair... 3bf00777be1 ; * src/xdisp.c (face_before_or_after_it_pos): Fix thinko... commit 6abe4feb73c646e6cdc1582ee175e4ee059707d1 Merge: 96beaeab063 e88309eef30 Author: Eli Zaretskii Date: Sat Nov 9 07:35:11 2024 -0500 ; Merge from origin/emacs-30 The following commit was skipped: e88309eef30 Fix wrong value of `when` and `unless` with empty body (b... commit 96beaeab06312f51f2dfe3bf310ea17ae32cae74 Merge: 0642d5f7da2 3231af3727b Author: Eli Zaretskii Date: Sat Nov 9 07:34:57 2024 -0500 Merge from origin/emacs-30 3231af3727b Improve 'open-network-stream' documentation. fb55431c44e ; Fix typos in case-conversion descriptions 83f095d1fd4 ; Fix typo and indexing in the ELisp manual 37b1799c9e5 ; Instrument proced-tests.el further 03fa832b4dc Improve Tramp documentation on direct async processes # Conflicts: # etc/NEWS commit dbcd9d782c94e34baf9aabdaeaa70efb791d8a25 (refs/remotes/origin/emacs-30) Author: Eli Zaretskii Date: Sat Nov 9 14:02:06 2024 +0200 Fix documentation and error message of adding local variables * lisp/files-x.el (add-file-local-variable) (add-file-local-variable-prop-line): Doc fixes. (add-file-local-variable): Improve the user-error text. (Bug#74267) diff --git a/lisp/files-x.el b/lisp/files-x.el index f70be5f7ff3..5f8c1e9aec2 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -239,18 +239,23 @@ This command deletes all existing settings of VARIABLE (except `mode' and `eval') and adds a new file-local VARIABLE with VALUE to the Local Variables list. -If there is no Local Variables list in the current file buffer -then this function adds the first line containing the string -`Local Variables:' and the last line containing the string `End:'." +If there is no Local Variables list in the current file buffer, +then this function adds it at the end of the file, with the first +line containing the string `Local Variables:' and the last line +containing the string `End:'. + +For adding local variables on the first line of a file, for example +for settings like `lexical-binding, which must be specified there, +use the `add-file-local-variable-prop-line' command instead." (interactive (let ((variable (read-file-local-variable "Add file-local variable"))) ;; Error before reading value. (if (equal variable 'lexical-binding) - (user-error "The `%s' variable must be set at the start of the file" + (user-error "Use `add-file-local-variable-prop-line' to add the `%s' variable" variable)) (list variable (read-file-local-variable-value variable) t))) (if (equal variable 'lexical-binding) - (user-error "The `%s' variable must be set at the start of the file" + (user-error "Use `add-file-local-variable-prop-line' to add the `%s' variable" variable)) (modify-file-local-variable variable value 'add-or-replace interactive)) @@ -394,10 +399,13 @@ from the -*- line ignoring the input argument VALUE." This command deletes all existing settings of VARIABLE (except `mode' and `eval') and adds a new file-local VARIABLE with VALUE to -the -*- line. +the -*- line at the beginning of the file. If there is no -*- line at the beginning of the current file buffer -then this function adds it." +then this function adds it. + +To add variables to the Local Variables list at the end of the file, +use the `add-file-local-variable' command instead." (interactive (let ((variable (read-file-local-variable "Add -*- file-local variable"))) (list variable (read-file-local-variable-value variable) t))) commit 94bf7ad797bb7a3c1faa72d2066a1e9b883c4547 Author: Eli Zaretskii Date: Sat Nov 9 13:33:21 2024 +0200 Document the 'display-line-numbers-disable' property * doc/lispref/display.texi (Overlay Properties): * doc/lispref/text.texi (Special Properties): Document 'display-line-numbers-disable'. Fix indexing. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 59d39837cc5..11faf1dc9a0 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -1825,8 +1825,8 @@ overlay properties and text properties for a given character. of them: @table @code -@item priority @kindex priority @r{(overlay property)} +@item priority This property's value determines the priority of the overlay. If you want to specify a priority value, use either @code{nil} (or zero), or a positive integer, or a cons of two values. Any other value triggers @@ -1865,19 +1865,19 @@ Currently, all overlays take priority over text properties. If you need to put overlays in priority order, use the @var{sorted} argument of @code{overlays-at}. @xref{Finding Overlays}. -@item window @kindex window @r{(overlay property)} +@item window If the @code{window} property is non-@code{nil}, then the overlay applies only on that window. -@item category @kindex category @r{(overlay property)} +@item category If an overlay has a @code{category} property, we call it the @dfn{category} of the overlay. It should be a symbol. The properties of the symbol serve as defaults for the properties of the overlay. -@item face @kindex face @r{(overlay property)} +@item face This property controls the appearance of the text (@pxref{Faces}). The value of the property can be the following: @@ -1905,37 +1905,37 @@ form is supported for backward compatibility only, and should be avoided. @end itemize -@item mouse-face @kindex mouse-face @r{(overlay property)} +@item mouse-face This property is used instead of @code{face} when the mouse is within the range of the overlay. However, Emacs ignores all face attributes from this property that alter the text size (e.g., @code{:height}, @code{:weight}, and @code{:slant}); those attributes are always the same as in the unhighlighted text. -@item display @kindex display @r{(overlay property)} +@item display This property activates various features that change the way text is displayed. For example, it can make text appear taller or shorter, higher or lower, wider or narrower, or replaced with an image. @xref{Display Property}. -@item help-echo @kindex help-echo @r{(overlay property)} +@item help-echo If an overlay has a @code{help-echo} property, then when you move the mouse onto the text in the overlay, Emacs displays a help string in the echo area, or as a tooltip. For details see @ref{Text help-echo}. -@item field @kindex field @r{(overlay property)} +@item field @c Copied from Special Properties. Consecutive characters with the same @code{field} property constitute a @emph{field}. Some motion functions including @code{forward-word} and @code{beginning-of-line} stop moving at a field boundary. @xref{Fields}. -@item modification-hooks @kindex modification-hooks @r{(overlay property)} +@item modification-hooks This property's value is a list of functions to be called if any character within the overlay is changed or if text is inserted strictly within the overlay. @@ -1966,26 +1966,26 @@ prepare for that. @xref{Change Hooks}. Text properties also support the @code{modification-hooks} property, but the details are somewhat different (@pxref{Special Properties}). -@item insert-in-front-hooks @kindex insert-in-front-hooks @r{(overlay property)} +@item insert-in-front-hooks This property's value is a list of functions to be called before and after inserting text right at the beginning of the overlay. The calling conventions are the same as for the @code{modification-hooks} functions. -@item insert-behind-hooks @kindex insert-behind-hooks @r{(overlay property)} +@item insert-behind-hooks This property's value is a list of functions to be called before and after inserting text right at the end of the overlay. The calling conventions are the same as for the @code{modification-hooks} functions. -@item invisible @kindex invisible @r{(overlay property)} +@item invisible The @code{invisible} property can make the text in the overlay invisible, which means that it does not appear on the screen. @xref{Invisible Text}, for details. -@item intangible @kindex intangible @r{(overlay property)} +@item intangible The @code{intangible} property on an overlay works just like the @code{intangible} text property. It is obsolete. @xref{Special Properties}, for details. @@ -2000,15 +2000,15 @@ Text}. This property tells incremental search how to make an invisible overlay visible, temporarily, during the search. @xref{Invisible Text}. -@item before-string @kindex before-string @r{(overlay property)} +@item before-string This property's value is a string to add to the display at the beginning of the overlay. The string does not appear in the buffer in any sense---only on the screen. Note that if the text at the beginning of the overlay is made invisible, the string will not be displayed. -@item after-string @kindex after-string @r{(overlay property)} +@item after-string This property's value is a string to add to the display at the end of the overlay. The string does not appear in the buffer in any sense---only on the screen. Note that if the text at the end of the @@ -2022,8 +2022,8 @@ non-continuation line at display-time. @xref{Truncation}. This property specifies a display spec to prepend to each continuation line at display-time. @xref{Truncation}. -@item evaporate @kindex evaporate @r{(overlay property)} +@item evaporate If this property is non-@code{nil}, the overlay is deleted automatically if it becomes empty (i.e., if its length becomes zero). If you give an empty overlay (@pxref{Managing Overlays, empty overlay}) a @@ -2032,9 +2032,18 @@ Note that, unless an overlay has this property, it will not be deleted when the text between its starting and ending positions is deleted from the buffer. -@item keymap +@kindex display-line-numbers-disable @r{(overlay property)} +@item display-line-numbers-disable +This property prevents display of line numbers (@pxref{Display Custom, +display-line-numbers,, emacs, The GNU Emacs Manual}) for the text which +is within an overlay having this property. One situation where using an +overlay with this property is useful is an empty overlay at +end-of-buffer, since otherwise there's no way of preventing the display +of the line number there. + @cindex keymap of character (and overlays) @kindex keymap @r{(overlay property)} +@item keymap If this property is non-@code{nil}, it specifies a keymap for a portion of the text. This keymap takes precedence over most other keymaps (@pxref{Active Keymaps}), and it is used when point is within @@ -2042,8 +2051,8 @@ the overlay, where the front- and rear-advance properties define whether the boundaries are considered as being @emph{within} or not. -@item local-map @kindex local-map @r{(overlay property)} +@item local-map The @code{local-map} property is similar to @code{keymap} but replaces the buffer's local map rather than augmenting existing keymaps. This also means it has lower precedence than minor mode keymaps. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index df56433fd18..edef9f6333f 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3569,8 +3569,8 @@ the context. The @code{add-face-text-property} function provides a convenient way to set this text property. @xref{Changing Properties}. -@item font-lock-face @kindex font-lock-face @r{(text property)} +@item font-lock-face This property specifies a value for the @code{face} property that Font Lock mode should apply to the underlying text. It is one of the fontification methods used by Font Lock mode, and is useful for @@ -3578,8 +3578,8 @@ special modes that implement their own highlighting. @xref{Precalculated Fontification}. When Font Lock mode is disabled, @code{font-lock-face} has no effect. -@item mouse-face @kindex mouse-face @r{(text property)} +@item mouse-face This property is used instead of @code{face} when the mouse pointer hovers over the text which has this property. When this happens, the entire stretch of text that has the same @code{mouse-face} property @@ -3590,10 +3590,10 @@ that alter the text size (e.g., @code{:height}, @code{:weight}, and @code{:slant}). Those attributes are always the same as for the unhighlighted text. -@item cursor-face @kindex cursor-face @r{(text property)} @findex cursor-face-highlight-mode @vindex cursor-face-highlight-nonselected-window +@item cursor-face This property is similar to @code{mouse-face}, but it is used when point (not the mouse) is inside text that has this property. The highlighting happens only if the mode @@ -3604,8 +3604,8 @@ similarly to what @code{highlight-nonselected-windows} does for the region (@pxref{Mark,, The Mark and the Region, emacs, The GNU Emacs Manual}). -@item fontified @kindex fontified @r{(text property)} +@item fontified This property says whether the text is ready for display. If @code{nil}, Emacs's redisplay routine calls the functions in @code{fontification-functions} (@pxref{Auto Faces}) to prepare this @@ -3618,9 +3618,9 @@ way text is displayed. For example, it can make text appear taller or shorter, higher or lower, wider or narrow, or replaced with an image. @xref{Display Property}. -@item help-echo @kindex help-echo @r{(text property)} @cindex tooltip for help strings +@item help-echo @anchor{Text help-echo} If text has a string as its @code{help-echo} property, then when you move the mouse onto that text, Emacs displays that string in the echo @@ -3655,17 +3655,17 @@ You can alter the way help text is displayed by setting the variable This feature is used in the mode line and for other active text. -@item help-echo-inhibit-substitution @cindex help-echo text, avoid command-key substitution @kindex help-echo-inhibit-substitution @r{(text property)} +@item help-echo-inhibit-substitution If the first character of a @code{help-echo} string has a non-@code{nil} @code{help-echo-inhibit-substitution} property, then it is displayed as-is by @code{show-help-function}, without being passed through @code{substitute-command-keys}. +@cindex help-echo text on fringes @item left-fringe-help @itemx right-fringe-help -@cindex help-echo text on fringes If any visible text of a screen line has the @code{left-fringe-help} or @code{right-fringe-help} text property whose value is a string, then that string will be displayed when the mouse pointer hovers over the @@ -3673,9 +3673,9 @@ corresponding line's fringe through @code{show-help-function} (@pxref{Help display}). This is useful when used together with fringe cursors and bitmaps (@pxref{Fringes}). -@item keymap @cindex keymap of character @kindex keymap @r{(text property)} +@item keymap The @code{keymap} property specifies an additional keymap for commands. When this keymap applies, it is used for key lookup before the minor mode keymaps and before the buffer's local map. @@ -3688,8 +3688,8 @@ character after point applies if it is non-@code{nil} and front-sticky. (For mouse clicks, the position of the click is used instead of the position of point.) -@item local-map @kindex local-map @r{(text property)} +@item local-map This property works like @code{keymap} except that it specifies a keymap to use @emph{instead of} the buffer's local map. For most purposes (perhaps all purposes), it is better to use the @code{keymap} @@ -3699,9 +3699,9 @@ property. The @code{syntax-table} property overrides what the syntax table says about this particular character. @xref{Syntax Properties}. -@item read-only @cindex read-only character @kindex read-only @r{(text property)} +@item read-only If a character has the property @code{read-only}, then modifying that character is not allowed. Any command that would do so gets an error, @code{text-read-only}. If the property value is a string, that string @@ -3717,23 +3717,23 @@ possible to remove a @code{read-only} property unless you know the special trick: bind @code{inhibit-read-only} to a non-@code{nil} value and then remove the property. @xref{Read Only Buffers}. -@item inhibit-read-only @kindex inhibit-read-only @r{(text property)} +@item inhibit-read-only Characters that have the property @code{inhibit-read-only} can be edited even in read-only buffers. @xref{Read Only Buffers}. -@item invisible @kindex invisible @r{(text property)} +@item invisible A non-@code{nil} @code{invisible} property can make a character invisible on the screen. @xref{Invisible Text}, for details. -@kindex inhibit-isearch @r{(text property)} @item inhibit-isearch +@kindex inhibit-isearch @r{(text property)} A non-@code{nil} @code{inhibit-isearch} property will make isearch skip the text. -@item intangible @kindex intangible @r{(text property)} +@item intangible If a group of consecutive characters have equal and non-@code{nil} @code{intangible} properties, then you cannot place point between them. If you try to move point forward into the group, point actually moves to @@ -3754,10 +3754,10 @@ the command loop will move point outside of the invisible text at the end of each command anyway. @xref{Adjusting Point}. For these reasons, this property is obsolete; use the @code{cursor-intangible} property instead. -@item cursor-intangible @kindex cursor-intangible @r{(text property)} @findex cursor-intangible-mode @cindex rear-nonsticky, and cursor-intangible property +@item cursor-intangible When the minor mode @code{cursor-intangible-mode} is turned on, point is moved away from any position that has a non-@code{nil} @code{cursor-intangible} property, just before redisplay happens. @@ -3777,15 +3777,15 @@ When the variable @code{cursor-sensor-inhibit} is non-@code{nil}, the @code{cursor-intangible} property and the @code{cursor-sensor-functions} property (described below) are ignored. -@item field @kindex field @r{(text property)} +@item field Consecutive characters with the same @code{field} property constitute a @dfn{field}. Some motion functions including @code{forward-word} and @code{beginning-of-line} stop moving at a field boundary. @xref{Fields}. -@item cursor @kindex cursor @r{(text property)} +@item cursor Normally, the cursor is displayed at the beginning or the end of any overlay and text property strings that ``hide'' (i.e., are displayed instead of) the current buffer position. You can instead tell Emacs @@ -3834,21 +3834,21 @@ Lisp program wants to put the cursor, or where the user would expect the cursor, when point is located on some buffer position that is ``covered'' by the display or overlay string. -@item pointer @kindex pointer @r{(text property)} +@item pointer This specifies a specific pointer shape when the mouse pointer is over this text or image. @xref{Pointer Shape}, for possible pointer shapes. -@item line-spacing @kindex line-spacing @r{(text property)} +@item line-spacing A newline can have a @code{line-spacing} text or overlay property that controls the height of the display line ending with that newline. The property value overrides the default frame line spacing and the buffer local @code{line-spacing} variable. @xref{Line Height}. -@item line-height @kindex line-height @r{(text property)} +@item line-height A newline can have a @code{line-height} text or overlay property that controls the total height of the display line ending in that newline. @xref{Line Height}. @@ -3892,10 +3892,10 @@ A line-prefix may also be specified for an entire buffer using the @code{line-prefix} text-property takes precedence over the value of the @code{line-prefix} variable). @xref{Truncation}. -@item modification-hooks @cindex change hooks for a character @cindex hooks for changing a character @kindex modification-hooks @r{(text property)} +@item modification-hooks If a character has the property @code{modification-hooks}, then its value should be a list of functions; modifying that character calls all of those functions before the actual modification. Each function @@ -3918,10 +3918,10 @@ recursive calls. @xref{Change Hooks}. Overlays also support the @code{modification-hooks} property, but the details are somewhat different (@pxref{Overlay Properties}). -@item insert-in-front-hooks -@itemx insert-behind-hooks @kindex insert-in-front-hooks @r{(text property)} @kindex insert-behind-hooks @r{(text property)} +@item insert-in-front-hooks +@itemx insert-behind-hooks The operation of inserting text in a buffer also calls the functions listed in the @code{insert-in-front-hooks} property of the following character and in the @code{insert-behind-hooks} property of the @@ -3939,11 +3939,11 @@ prepare for that. See also @ref{Change Hooks}, for other hooks that are called when you change text in a buffer. -@item point-entered -@itemx point-left @cindex hooks for motion of point @kindex point-entered @r{(text property)} @kindex point-left @r{(text property)} +@item point-entered +@itemx point-left The special properties @code{point-entered} and @code{point-left} record hook functions that report motion of point. Each time point moves, Emacs compares these two property values: @@ -3979,9 +3979,9 @@ running the @code{point-left} and @code{point-entered} hooks, see These properties are obsolete; please use @code{cursor-sensor-functions} instead. -@item cursor-sensor-functions @kindex cursor-sensor-functions @r{(text property)} @findex cursor-sensor-mode +@item cursor-sensor-functions This special property records a list of functions that react to cursor motion. Each function in the list is called, just before redisplay, with 3 arguments: the affected window, the previous known position of @@ -3993,15 +3993,15 @@ mode @code{cursor-sensor-mode} is turned on. When the variable @code{cursor-sensor-inhibit} is non-@code{nil}, the @code{cursor-sensor-functions} property is ignored. -@item composition @kindex composition @r{(text property)} +@item composition This text property is used to display a sequence of characters as a single glyph composed from components. But the value of the property itself is completely internal to Emacs and should not be manipulated directly by, for instance, @code{put-text-property}. -@item minibuffer-message @kindex minibuffer-message @r{(text property)} +@item minibuffer-message This text property tells where to display temporary messages in an active minibuffer. Specifically, the first character of the minibuffer text which has this property will have the temporary @@ -4010,6 +4010,12 @@ messages at the end of the minibuffer text. This text property is used by the function that is the default value of @code{set-message-function} (@pxref{Displaying Messages}). +@kindex display-line-numbers-disable @r{(text property)} +@item display-line-numbers-disable +This text property prevents display of line numbers (@pxref{Display +Custom, display-line-numbers,, emacs, The GNU Emacs Manual}) for the +text which has this property. + @end table @defvar inhibit-point-motion-hooks commit 0642d5f7da208e3237f17102858811c2d9c28990 Author: Ola Nilsson Date: Mon Nov 4 23:33:09 2024 +0100 Add functions supported by GNU Make 4.3. * lisp/progmodes/make-mode.el (makefile-gnumake-functions-alist): Add missing GNU Make functions, according to The GNU Make Manual 0.75 for GNU Make, and reorder the list of functions. (Bug#74207) diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 60b87142850..5441903738d 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -704,7 +704,7 @@ The function must satisfy this calling convention: ;; Each "ARG" is used as a prompt for a required argument. (defconst makefile-gnumake-functions-alist '( - ;; Text functions + ;; Functions for String Substitution and Analysis ("subst" "From" "To" "In") ("patsubst" "Pattern" "Replacement" "In") ("strip" "Text") @@ -712,22 +712,42 @@ The function must satisfy this calling convention: ("filter" "Pattern" "Text") ("filter-out" "Pattern" "Text") ("sort" "List") - ;; Filename functions + ("word" "Index" "Text") + ("wordlist" "S" "E" "Text") + ("words" "Text") + ("firstword" "Text") + ("lastword" "Names") + ;; Functions for File Names ("dir" "Names") ("notdir" "Names") ("suffix" "Names") ("basename" "Names") - ("addprefix" "Prefix" "Names") ("addsuffix" "Suffix" "Names") + ("addprefix" "Prefix" "Names") ("join" "List 1" "List 2") - ("word" "Index" "Text") - ("words" "Text") - ("firstword" "Text") ("wildcard" "Pattern") + ("realpath" "Names") + ("abspath" "Names") + ;; Functions for Conditionals + ("if" "Condition" "Then-part" "Else-part") + ("or" "Condition 1" "Condition 2" "Condition 3" "Condition 4") + ("and" "Condition 1" "Condition 2" "Condition 3" "Condition 4") ;; Misc functions ("foreach" "Variable" "List" "Text") + ("file" "Op" "Filename" "Text") + ("call" "Variable" "Param 1" "Param 2" "Param 3" "Param 4" "Param 5") + ("value" "Variable") + ("eval" "statement") ("origin" "Variable") - ("shell" "Command"))) + ("flavor" "Variable") + ("shell" "Command") + ("guile" "Program") + ;; Functions that control make + ("error" "Text") + ("warning" "Text") + ("info" "Text") + ) + "Alist of GNU Make functions and their arguments.") ;;; ------------------------------------------------------------ commit 8ee14643d2c222d9dbf0e914d878c3da0c8f2386 Author: David Ponce Date: Sun Nov 3 22:56:10 2024 +0100 Fix 'string-pixel-width' to not reset 'display-line-numbers' * lisp/emacs-lisp/subr-x.el (string-pixel-width): Use the 'display-line-numbers-disable' property instead of setting the variable 'display-line-numbers', to avoid global effects. (Bug#73005) diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index e5a056e7732..df825bd68c8 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -400,12 +400,6 @@ substring that does not include newlines." ;; Keeping a work buffer around is more efficient than creating a ;; new temporary buffer. (with-work-buffer - ;; If `display-line-numbers' is enabled in internal - ;; buffers (e.g. globally), it breaks width calculation - ;; (bug#59311). Disable `line-prefix' and `wrap-prefix', - ;; for the same reason. - (setq display-line-numbers nil - line-prefix nil wrap-prefix nil) (if buffer (setq-local face-remapping-alist (with-current-buffer buffer @@ -414,10 +408,17 @@ substring that does not include newlines." ;; Avoid deactivating the region as side effect. (let (deactivate-mark) (insert string)) + ;; If `display-line-numbers' is enabled in internal + ;; buffers (e.g. globally), it breaks width calculation + ;; (bug#59311). Disable `line-prefix' and `wrap-prefix', + ;; for the same reason. + (add-text-properties + (point-min) (point-max) '(display-line-numbers-disable t)) ;; Prefer `remove-text-properties' to `propertize' to avoid ;; creating a new string on each call. (remove-text-properties (point-min) (point-max) '(line-prefix nil wrap-prefix nil)) + (setq line-prefix nil wrap-prefix nil) (car (buffer-text-pixel-size nil nil t))))) ;;;###autoload commit 17f4f2dec95d93eae3aaf3c6e4c59955732f8f62 Author: Eli Zaretskii Date: Sat Nov 9 12:45:14 2024 +0200 ; Fix last changes * lisp/color.el (color-blend): Fix quoting of apostrophe. (color-rgb-to-hex, color-blend): Autoload. diff --git a/lisp/color.el b/lisp/color.el index 30e041c60a7..cdeaa97ee64 100644 --- a/lisp/color.el +++ b/lisp/color.el @@ -55,6 +55,7 @@ If FRAME cannot display COLOR, return nil." (let ((valmax (float (car (color-values "#ffffffffffff"))))) (mapcar (lambda (x) (/ x valmax)) (color-values color frame)))) +;;;###autoload (defun color-rgb-to-hex (red green blue &optional digits-per-component) "Return hexadecimal #RGB notation for the color specified by RED GREEN BLUE. RED, GREEN, and BLUE should be numbers between 0.0 and 1.0, inclusive. @@ -75,6 +76,7 @@ components (e.g. \"#ffff1212ecec\")." (- 1.0 (nth 1 color)) (- 1.0 (nth 2 color))))) +;;;###autoload (defun color-blend (a b &optional alpha) "Blend the two colors A and B in linear space with ALPHA. A and B should be lists (RED GREEN BLUE), where each element is @@ -83,7 +85,7 @@ has on the result and should be between 0.0 and 1.0, inclusive. For instance: - (color-blend '(1 0.5 1) '(0 0 0) 0.75) + (color-blend \\='(1 0.5 1) \\='(0 0 0) 0.75) => (0.75 0.375 0.75)" (setq alpha (or alpha 0.5)) (let (blend) commit fdab542a56201b1581abdc0df940e0c50abde1c7 Author: Joseph Turner Date: Fri Nov 1 22:21:34 2024 -0700 Replace vtable--color-blend with color-blend * lisp/emacs-lisp/vtable.el (vtable--face-color): Use `color-blend'. (vtable--color-blend): Remove unused function. diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index a839f3d70b8..c4f14d7b4b2 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -213,18 +213,12 @@ See info node `(vtable)Top' for vtable documentation." (funcall accessor face2) (plist-get face2 slot)))) (if (and col1 col2) - (vtable--color-blend col1 col2) + (apply #'color-rgb-to-hex + `(,@(color-blend (color-name-to-rgb col1) + (color-name-to-rgb col2)) + 2)) (or col1 col2)))) -;;; FIXME: This is probably not the right way to blend two colors, is -;;; it? -(defun vtable--color-blend (color1 color2) - (cl-destructuring-bind (r g b) - (mapcar (lambda (n) (* (/ n 2) 255.0)) - (cl-mapcar #'+ (color-name-to-rgb color1) - (color-name-to-rgb color2))) - (format "#%02X%02X%02X" r g b))) - ;;; Interface utility functions. (defun vtable-current-table () commit bf312529def48bc6fdf72d43d5be158d125f52f6 Author: Joseph Turner Date: Fri Nov 1 21:58:07 2024 -0700 Add color-blend to blend two RGB lists * lisp/color.el (color-blend): Blend two RGB lists. * test/lisp/color-tests.el (color-tests-blend): Test color-blend. * etc/NEWS: Announce color-blend. diff --git a/etc/NEWS b/etc/NEWS index f6fe068b830..e63132efeda 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -732,6 +732,11 @@ restore the old behavior, you can set 'eshell-pwd-convert-function' to This function natively-compiles all Lisp files in a directory and in its sub-directories, recursively, which were not already natively-compiled. +--- +** New function 'color-blend'. +This function takes two RGB lists and optional ALPHA and returns an RGB +list whose elements are blended in linear space proportional to ALPHA. + +++ ** The 'defcustom' ':local' keyword can now be 'permanent-only'. This means that the variable's 'permanent-local' property is set to t, diff --git a/lisp/color.el b/lisp/color.el index 007504043cc..30e041c60a7 100644 --- a/lisp/color.el +++ b/lisp/color.el @@ -75,6 +75,22 @@ components (e.g. \"#ffff1212ecec\")." (- 1.0 (nth 1 color)) (- 1.0 (nth 2 color))))) +(defun color-blend (a b &optional alpha) + "Blend the two colors A and B in linear space with ALPHA. +A and B should be lists (RED GREEN BLUE), where each element is +between 0.0 and 1.0, inclusive. ALPHA controls the influence A +has on the result and should be between 0.0 and 1.0, inclusive. + +For instance: + + (color-blend '(1 0.5 1) '(0 0 0) 0.75) + => (0.75 0.375 0.75)" + (setq alpha (or alpha 0.5)) + (let (blend) + (dotimes (i 3) + (push (+ (* (nth i a) alpha) (* (nth i b) (- 1 alpha))) blend)) + (nreverse blend))) + (defun color-gradient (start stop step-number) "Return a list with STEP-NUMBER colors from START to STOP. The color list builds a color gradient starting at color START to diff --git a/test/lisp/color-tests.el b/test/lisp/color-tests.el index 63cb024bb8d..3f7483a97c6 100644 --- a/test/lisp/color-tests.el +++ b/test/lisp/color-tests.el @@ -62,6 +62,12 @@ (should (equal (color-complement "#ffffffffffff") '(0.0 0.0 0.0))) (should (equal (color-complement "red") '(0.0 1.0 1.0)))) +(ert-deftest color-tests-blend () + (should (equal (color-blend '(1.0 0.0 0.0) '(0.0 1.0 0.0)) '(0.5 0.5 0.0))) + (should (equal (color-blend '(1.0 1.0 1.0) '(0.0 1.0 0.0)) '(0.5 1.0 0.5))) + (should (equal (color-blend '(0.0 0.39215686274509803 0.0) '(0.9607843137254902 0.8705882352941177 0.7019607843137254)) + '(0.4803921568627451 0.6313725490196078 0.3509803921568627)))) + (ert-deftest color-tests-gradient () (should-not (color-gradient '(0 0 0) '(255 255 255) 0)) (should commit e1e8da5e4f1951744d26b99b000c7f746a9ca8c6 Author: Manuel Giraud Date: Fri Nov 1 19:27:31 2024 +0100 Fix tmm "previous menu" shortcut * lisp/tmm.el (tmm-clear-self-insert-and-exit): New function to clear the minibuffer content then call `self-insert-and-exit'. (tmm-define-keys): Use it. (tmm-goto-completions): Explain why. (Bug#74166) diff --git a/lisp/tmm.el b/lisp/tmm.el index eeea1cf20be..632e55e47a8 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -336,6 +336,12 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." str)) (cdr elt)))))) +(defun tmm-clear-self-insert-and-exit () + "Clear the minibuffer contents then self insert and exit." + (interactive) + (delete-minibuffer-contents) + (self-insert-and-exit)) + ;; This returns the old map. (defun tmm-define-keys (minibuffer) (let ((map (make-sparse-keymap))) @@ -354,7 +360,7 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (define-key map "\C-n" 'next-history-element) (define-key map "\C-p" 'previous-history-element) ;; Previous menu shortcut (see `tmm-prompt'). - (define-key map "^" 'self-insert-and-exit)) + (define-key map "^" 'tmm-clear-self-insert-and-exit)) (prog1 (current-local-map) (use-local-map (append map (current-local-map)))))) @@ -452,10 +458,10 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (defun tmm-goto-completions () "Jump to the completions buffer." (interactive) - (let ((prompt-end (minibuffer-prompt-end))) - (setq tmm-c-prompt (buffer-substring prompt-end (point-max))) - ;; FIXME: Why? - (delete-region prompt-end (point-max))) + (setq tmm-c-prompt (buffer-substring (minibuffer-prompt-end) (point-max))) + ;; Clear minibuffer old contents before using *Completions* buffer for + ;; selection. + (delete-minibuffer-contents) (switch-to-buffer-other-window "*Completions*") (search-forward tmm-c-prompt) (search-backward tmm-c-prompt)) commit 5def10ad944a6f6fe5e09b153c3cb4f0ce78e415 Author: Manuel Giraud Date: Fri Nov 1 18:30:40 2024 +0100 `tmm-shortcut-inside-entry' docstring fix (bug#74111) * lisp/tmm.el (tmm-shortcut-inside-entry): Doc fix. diff --git a/lisp/tmm.el b/lisp/tmm.el index 80991b246b6..eeea1cf20be 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -111,8 +111,8 @@ specify nil for this variable." (defcustom tmm-shortcut-inside-entry nil "Highlight the shortcut character in the menu entry's string. When non-nil, the first menu-entry's character that acts as a shortcut -will be highlighted with the `highlight' face to help identifying it. -The `tmm-mid-prompt' string is not used then." +is displayed with the `highlight' face to help identify it. The +`tmm-mid-prompt' string is not used then." :type 'boolean) (defface tmm-inactive commit ac91d190d623f6fef186b035373cdb72347cc99d Author: Joost Kremers Date: Mon Oct 14 13:10:57 2024 +0200 Update vtable documentation * doc/misc/vtable.texi: Document creation of empty vtables. * etc/NEWS: Announce empty vtables. (Bug#73775) diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi index 795d7fad037..b2ead47d0bc 100644 --- a/doc/misc/vtable.texi +++ b/doc/misc/vtable.texi @@ -264,6 +264,10 @@ In the latter case, if @code{:columns} is non-@code{nil} and there's more elements in the sequence than there is in @code{:columns}, only the @code{:columns} first elements are displayed. +If the @code{:objects} list is empty (and no @code{:objects-function} is +defined), an empty vtable is created. In this case, a @code{:columns} +spec must be provided. + @item :objects-function It's often convenient to generate the objects dynamically (for instance, to make reversion work automatically). In that case, this @@ -295,6 +299,11 @@ The width of @var{n} @samp{x} characters in the table's face. @var{n} percent of the window's width. @end table +If no @code{width} is provided, the width is calculated based on the +column data (provided in the @code{:objects} list or through the +@code{:objects-function}) or, if there is no data, on the basis of the +window width. + @item min-width This uses the same format as @code{width}, but specifies the minimum width (and overrides @code{width} if @code{width} is smaller than this. @@ -576,6 +585,8 @@ index is out of range, @var{object} is prepended to @var{table} if the index is too small, or appended if it is too large. In this case, @var{before} is ignored. +If @var{table} is empty, @var{location} and @var{before} are ignored. + This also updates the displayed table. @end defun diff --git a/etc/NEWS b/etc/NEWS index 689f85270c9..f6fe068b830 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -821,6 +821,16 @@ This lets a Lisp program access the core functionality of the program, choosing the program according to the operating system's conventions. ++++ +** 'make-vtable' can create an empty vtable. +It is now possible to create a vtable without data, by leaving the +':objects' list empty, or by providing a ':objects-function' that +(initially) produces no data. In such a case, it is necessary to +provide a ':columns' spec, so that the number of columns and their +widths can be determined. Columns widths can be set explicitly, or they +will be calculated based on the window width. + + * Changes in Emacs 31.1 on Non-Free Operating Systems commit 35e1ab970c1cfc6a1b62fbb920e0d2bb031765da Author: Joost Kremers Date: Fri May 31 01:38:54 2024 +0200 vtable: allow resetting column alignment when table data changes * lisp/emacs-lisp/vtable.el (vtable--compute-columns): If a column was not created with an explicit 'align' property, allow changing this property when the column data changes from numeric to non-numeric (or vice versa). This makes it possible to add data to an empty table, because in a table without data all columns are assumed to be numeric and right-aligned. (Bug#73775) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index cd874e7c2c1..a839f3d70b8 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -45,7 +45,8 @@ getter formatter displayer - -numerical) + -numerical + -aligned) (defclass vtable () ((columns :initarg :columns :accessor vtable-columns) @@ -473,7 +474,17 @@ This also updates the displayed table." (t (elt object index)))) -(defun vtable--compute-columns (table) +(defun vtable--compute-columns (table &optional recompute) + "Compute column specs for TABLE. +Set the `align', `-aligned' and `-numerical' properties of each column. +If the column contains only numerical data, set `-numerical' to t, +otherwise to nil. `-aligned' indicates whether the column has an +`align' property set by the user. If it does, `align' is not touched, +otherwise it is set to `right' for numeric columns and to `left' for +non-numeric columns. + +If RECOMPUTE is non-nil, do not set `-aligned'. This can be used to +recompute the column specs when the table data has changed." (let ((numerical (make-vector (length (vtable-columns table)) t)) (columns (vtable-columns table))) ;; First determine whether there are any all-numerical columns. @@ -484,11 +495,16 @@ This also updates the displayed table." table)) (setf (elt numerical index) nil))) (vtable-columns table))) + ;; Check if any columns have an explicit `align' property. + (unless recompute + (dolist (column (vtable-columns table)) + (when (vtable-column-align column) + (setf (vtable-column--aligned column) t)))) ;; Then fill in defaults. (seq-map-indexed (lambda (column index) ;; This is used when displaying. - (unless (vtable-column-align column) + (unless (vtable-column--aligned column) (setf (vtable-column-align column) (if (elt numerical index) 'right @@ -813,7 +829,7 @@ If NEXT, do the next column." (setq recompute t))) line) (when recompute - (vtable--compute-columns table)))) + (vtable--compute-columns table t)))) (defun vtable--set-header-line (table widths spacer) (setq header-line-format commit 425f244738e784fbf46e3fcc3461759340cfb928 Author: Joost Kremers Date: Thu May 30 23:20:00 2024 +0200 Enable inserting new objects into empty vtable * lisp/emacs-lisp/vtable.el (vtable-insert-object): If the vtable is empty, add the new object and recreate + redisplay the table. (Bug#73775) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 043b9ca55c4..cd874e7c2c1 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -368,86 +368,89 @@ end (if the index is too large) of the table. BEFORE is ignored in this case. This also updates the displayed table." - ;; FIXME: Inserting an object into an empty vtable currently isn't - ;; possible. `nconc' fails silently (twice), and `setcar' on the cache - ;; raises an error. + ;; If the vtable is empty, just add the object and regenerate the + ;; table. (if (null (vtable-objects table)) - (error "[vtable] Cannot insert object into empty vtable")) - ;; First insert into the objects. - (let ((pos (if location - (if (integerp location) - (prog1 - (nthcdr location (vtable-objects table)) - ;; Do not prepend if index is too large: - (setq before nil)) - (or (memq location (vtable-objects table)) - ;; Prepend if `location' is not found and - ;; `before' is non-nil: - (and before (vtable-objects table)))) - ;; If `location' is nil and `before' is non-nil, we - ;; prepend the new object. - (if before (vtable-objects table))))) - (if (or before ; If `before' is non-nil, `pos' should be, as well. - (and pos (integerp location))) - ;; Add the new object before. - (let ((old-object (car pos))) - (setcar pos object) - (setcdr pos (cons old-object (cdr pos)))) - ;; Otherwise, add the object after. - (if pos - ;; Splice the object into the list. - (setcdr pos (cons object (cdr pos))) - ;; Otherwise, append the object. - (nconc (vtable-objects table) (list object))))) - ;; Then adjust the cache and display. - (save-excursion - (vtable-goto-table table) - (let* ((cache (vtable--cache table)) - (inhibit-read-only t) - (keymap (get-text-property (point) 'keymap)) - (ellipsis (if (vtable-ellipsis table) - (propertize (truncate-string-ellipsis) - 'face (vtable-face table)) - "")) - (ellipsis-width (string-pixel-width ellipsis)) - (elem (if location ; This binding mirrors the binding of `pos' above. - (if (integerp location) - (nth location (car cache)) - (or (assq location (car cache)) - (and before (caar cache)))) - (if before (caar cache)))) - (pos (memq elem (car cache))) - (line (cons object (vtable--compute-cached-line table object)))) - (if (or before + (progn + (setf (vtable-objects table) (list object)) + (vtable--recompute-numerical table (vtable--compute-cached-line table object)) + (vtable-goto-table table) + (vtable-revert-command)) + ;; First insert into the objects. + (let ((pos (if location + (if (integerp location) + (prog1 + (nthcdr location (vtable-objects table)) + ;; Do not prepend if index is too large: + (setq before nil)) + (or (memq location (vtable-objects table)) + ;; Prepend if `location' is not found and + ;; `before' is non-nil: + (and before (vtable-objects table)))) + ;; If `location' is nil and `before' is non-nil, we + ;; prepend the new object. + (if before (vtable-objects table))))) + (if (or before ; If `before' is non-nil, `pos' should be, as well. (and pos (integerp location))) - ;; Add the new object before:. - (let ((old-line (car pos))) - (setcar pos line) - (setcdr pos (cons old-line (cdr pos))) - (unless (vtable-goto-object (car elem)) - (vtable-beginning-of-table))) + ;; Add the new object before. + (let ((old-object (car pos))) + (setcar pos object) + (setcdr pos (cons old-object (cdr pos)))) ;; Otherwise, add the object after. (if pos ;; Splice the object into the list. - (progn - (setcdr pos (cons line (cdr pos))) - (if (vtable-goto-object location) - (forward-line 1) ; Insert *after*. - (vtable-end-of-table))) + (setcdr pos (cons object (cdr pos))) ;; Otherwise, append the object. - (setcar cache (nconc (car cache) (list line))) - (vtable-end-of-table))) - (let ((start (point))) - ;; FIXME: We have to adjust colors in lines below this if we - ;; have :row-colors. - (vtable--insert-line table line 0 - (nth 1 cache) (vtable--spacer table) - ellipsis ellipsis-width) - (add-text-properties start (point) (list 'keymap keymap - 'vtable table))) - ;; We may have inserted a non-numerical value into a previously - ;; all-numerical table, so recompute. - (vtable--recompute-numerical table (cdr line))))) + (nconc (vtable-objects table) (list object))))) + ;; Then adjust the cache and display. + (save-excursion + (vtable-goto-table table) + (let* ((cache (vtable--cache table)) + (inhibit-read-only t) + (keymap (get-text-property (point) 'keymap)) + (ellipsis (if (vtable-ellipsis table) + (propertize (truncate-string-ellipsis) + 'face (vtable-face table)) + "")) + (ellipsis-width (string-pixel-width ellipsis)) + (elem (if location ; This binding mirrors the binding of `pos' above. + (if (integerp location) + (nth location (car cache)) + (or (assq location (car cache)) + (and before (caar cache)))) + (if before (caar cache)))) + (pos (memq elem (car cache))) + (line (cons object (vtable--compute-cached-line table object)))) + (if (or before + (and pos (integerp location))) + ;; Add the new object before:. + (let ((old-line (car pos))) + (setcar pos line) + (setcdr pos (cons old-line (cdr pos))) + (unless (vtable-goto-object (car elem)) + (vtable-beginning-of-table))) + ;; Otherwise, add the object after. + (if pos + ;; Splice the object into the list. + (progn + (setcdr pos (cons line (cdr pos))) + (if (vtable-goto-object location) + (forward-line 1) ; Insert *after*. + (vtable-end-of-table))) + ;; Otherwise, append the object. + (setcar cache (nconc (car cache) (list line))) + (vtable-end-of-table))) + (let ((start (point))) + ;; FIXME: We have to adjust colors in lines below this if we + ;; have :row-colors. + (vtable--insert-line table line 0 + (nth 1 cache) (vtable--spacer table) + ellipsis ellipsis-width) + (add-text-properties start (point) (list 'keymap keymap + 'vtable table))) + ;; We may have inserted a non-numerical value into a previously + ;; all-numerical table, so recompute. + (vtable--recompute-numerical table (cdr line)))))) (defun vtable-column (table index) "Return the name of the INDEXth column in TABLE." commit d94bb481ba1bcf8602fc600572e5779b25cd896d Author: Joost Kremers Date: Wed Nov 6 09:46:00 2024 +0100 Allow empty vtable * lisp/emacs-lisp/vtable.el (vtable--compute-widths): Set default width for columns that have no explicit width and no data. (Bug#73775) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 925961f012c..043b9ca55c4 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -850,32 +850,48 @@ If NEXT, do the next column." (error "Invalid spec: %s" spec)))) (defun vtable--compute-widths (table cache) - "Compute the display widths for TABLE." - (seq-into - (seq-map-indexed - (lambda (column index) - (let ((width - (or - ;; Explicit widths. - (and (vtable-column-width column) - (vtable--compute-width table (vtable-column-width column))) - ;; Compute based on the displayed widths of - ;; the data. - (seq-max (seq-map (lambda (elem) - (nth 1 (elt (cdr elem) index))) - cache))))) - ;; Let min-width/max-width specs have their say. - (when-let* ((min-width (and (vtable-column-min-width column) - (vtable--compute-width - table (vtable-column-min-width column))))) - (setq width (max width min-width))) - (when-let* ((max-width (and (vtable-column-max-width column) - (vtable--compute-width - table (vtable-column-max-width column))))) - (setq width (min width max-width))) - width)) - (vtable-columns table)) - 'vector)) + "Compute the display widths for TABLE. +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." + (let* ((n-0cols 0) ; Count the number of zero-width columns. + (widths (seq-map-indexed + (lambda (column index) + (let ((width + (or + ;; Explicit widths. + (and (vtable-column-width column) + (vtable--compute-width table (vtable-column-width column))) + ;; If the vtable is empty and no explicit width is given, + ;; set its width to 0 and deal with it below. + (when (null cache) + (setq n-0cols (1+ n-0cols)) + 0) + ;; Otherwise, compute based on the displayed widths of the + ;; data. + (seq-max (seq-map (lambda (elem) + (nth 1 (elt (cdr elem) index))) + cache))))) + ;; Let min-width/max-width specs have their say. + (when-let* ((min-width (and (vtable-column-min-width column) + (vtable--compute-width + table (vtable-column-min-width column))))) + (setq width (max width min-width))) + (when-let* ((max-width (and (vtable-column-max-width column) + (vtable--compute-width + table (vtable-column-max-width column))))) + (setq width (min width max-width))) + width)) + (vtable-columns table)))) + ;; If there are any zero-width columns, divide the remaining window + ;; width evenly over them. + (when (> n-0cols 0) + (let* ((combined-width (apply #'+ widths)) + (default-width (/ (- (window-width nil t) combined-width) n-0cols))) + (setq widths (mapcar (lambda (width) + (if (zerop width) + default-width + width)) + widths)))) + (seq-into widths 'vector))) (defun vtable--compute-cache (table) (seq-map commit 764db76072847d2650f5b07349723a2802ccd45e Author: Eli Zaretskii Date: Sat Nov 9 12:02:05 2024 +0200 Add dark color scheme to emacs.metainfo.xml * etc/emacs.metainfo.xml: Add dark color scheme. Patch by Peter Oliver (bug#74123). diff --git a/etc/emacs.metainfo.xml b/etc/emacs.metainfo.xml index 7e97df926be..526fb5b0610 100644 --- a/etc/emacs.metainfo.xml +++ b/etc/emacs.metainfo.xml @@ -48,6 +48,7 @@ emacs-devel_AT_gnu.org - #7f5ab6 + #7f5ab6 + #624195 commit 1f3434a84c13d3fbc55e8a7ace53bdfd61748db5 Author: Peter Oliver Date: Wed Oct 30 22:15:59 2024 +0000 Add more fields to AppStream metadata in emacs.metainfo.xml * etc/emacs.metainfo.xml: Populate the vcs-browser and contribute URLs, as well as the branding color. (Bug#74123) diff --git a/etc/emacs.metainfo.xml b/etc/emacs.metainfo.xml index 80bbd690217..7e97df926be 100644 --- a/etc/emacs.metainfo.xml +++ b/etc/emacs.metainfo.xml @@ -33,6 +33,8 @@ https://www.gnu.org/software/emacs/documentation.html https://my.fsf.org/donate/ https://lists.gnu.org/mailman/listinfo/emacs-devel/ + https://git.savannah.gnu.org/cgit/emacs.git + https://www.gnu.org/software/emacs/manual/html_node/emacs/Contributing.html emacs.desktop emacs.service GNU @@ -45,4 +47,7 @@ emacs-devel_AT_gnu.org + + #7f5ab6 + commit b1be0f2ba6b05b7644080638ae26e619cbeac75c Author: Eli Zaretskii Date: Sat Nov 9 11:55:49 2024 +0200 Document issues with 'use-package's ':custom' and byte compilation * doc/misc/use-package.texi (User options): Warn against byte-compiling init files that use ':custom'. (Bug#73609) diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index da3deb081d9..0ac0341fdc7 100644 --- a/doc/misc/use-package.texi +++ b/doc/misc/use-package.texi @@ -1416,6 +1416,13 @@ for the same variable, as this risks having conflicting values in your use-package declaration and your @code{custom-file}, which can lead to problems that are both tricky and tedious to debug. +Also note that if you use @code{:custom} in a file that you +byte-compile, you could have some unexpected results if you later load +or @code{require} @file{use-package} (e.g., due to lazy loading): the +value of the corresponding user options could be reset back to their +initial values. We therefore recommend against byte-compiling files +that use @file{use-package} with @code{:custom} settings. + @node Faces @section Faces @cindex faces, setting commit 6cde51f1bbcfd55fe8d189b045247b9d80dee4ea Author: Michael Albinus Date: Sat Nov 9 10:29:42 2024 +0100 Tramp: Support different proxies for the same destination * doc/misc/tramp.texi (Ad-hoc multi-hops): New subsection "Using different proxies for the same destination". * etc/NEWS: Tramp supports different proxies for the same destination host name in parallel. Fix typos. * lisp/net/tramp-cmds.el (tramp-cleanup-connection): Fix docstring. * lisp/net/tramp.el (tramp-make-tramp-file-name): Don't call `tramp-add-hops' during file name completion. (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory): Use `tramp-cache-undefined' for an empty `tramp-default-proxies-alist'. (tramp-add-hops): Extend. Remove existing entries with same target and different proxy, if needed. (Bug#74219) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 96ec6d60b9e..a014319c02c 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3914,6 +3914,30 @@ shall be taken, add a proper rule to the user option @end lisp +@subsection Using different proxies for the same destination + +@strong{Note}: This feature is experimental, don't use it in +production systems! + +Sometimes, it is needed to specify different proxies for the same +destination host name. This can happen for the same destination when +the local host is located in different networks over the time. This +can also happen when the remote destination is specified by the remote +same file name, although different hosts are meant depending on the +used proxy. A typical example are docker containers, which run on +different hosts under the same docker name. + +When the user option @code{tramp-show-ad-hoc-proxies} is +non-@code{nil}, such ad-hoc multi-hop file names can be used in +parallel. In the following, on both remote hosts @samp{host1} and +@samp{host2} there is a docker container @samp{name}, respectively: + +@example +@trampfn{ssh@value{postfixhop}user1@@host1|docker,name,} +@trampfn{ssh@value{postfixhop}user2@@host2|docker,name,} +@end example + + @node Home directories @section Expanding @file{~} to home directory diff --git a/etc/NEWS b/etc/NEWS index 19b8b7bb70b..689f85270c9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -183,8 +183,8 @@ Input methods are now implemented for Haudenosaunee languages in the Northern Iroquoian language family: 'mohawk-postfix' (Mohawk [Kanien’kéha / Onkwehonwehnéha]), 'oneida-postfix' (Oneida [Onʌyota:ká: / Ukwehuwehnéha]), 'cayuga-postfix' (Cayuga [Gayogo̱ho:nǫhnéha:ˀ]), -'onondaga-postfix (Onondaga [[Onųdaʔgegáʔ]), and `seneca-postfix' -[Onödowá’ga:’]). Additionally, there is a general-purpose +'onondaga-postfix' (Onondaga [Onųdaʔgegáʔ]), and 'seneca-postfix' +(Seneca [Onödowá’ga:’]). Additionally, there is a general-purpose 'haudenosaunee-postfix' input method to facilitate writing in the orthographies of the five languages simultaneously. @@ -267,7 +267,7 @@ It removes all the buttons in the specified region. This command scrolls the screen so that only the current prompt is visible, optionally erasing all the previous input/output as well. Previously, the Eshell built-in command 'eshell/clear' supported this -(e.g. to call it via 'M-x'), but this new command behaves more +(e.g., to call it via 'M-x'), but this new command behaves more consistently if you have a partially-typed command at the Eshell prompt. --- @@ -486,6 +486,19 @@ The host name for Kubernetes connections can be of kind used. This overrides the setting in 'tramp-kubernetes-namespace', if any. ++++ +*** Different proxies for the same destination host name can be specified. +A typical example are docker containers, which run on different hosts +under the same docker name. When the user option +'tramp-show-ad-hoc-proxies' is non-nil, such ad-hoc multi-hop file names +can be used in parallel. Example: on both remote hosts "host1" and +"host2" there is a docker container "name", respectively: + + /ssh:user1@host1|docker:name: + /ssh:user2@host2|docker:name: + +This feature is experimental. + ** Diff --- @@ -562,17 +575,17 @@ be set as a connection-local variable. --- *** New user option 'dired-hide-details-hide-absolute-location'. -When dired's 'dired-hide-details-mode' is enabled, also hide the +When Dired's 'dired-hide-details-mode' is enabled, also hide the 'default-directory' absolute location, typically displayed as the first -line in a dired buffer. +line in a Dired buffer. -With dired-hide-details-hide-absolute-location: +With 'dired-hide-details-hide-absolute-location': - project: (100 GiB available) + project: (100 GiB available) -Without dired-hide-details-hide-absolute-location: +Without 'dired-hide-details-hide-absolute-location': - /absolute/path/to/my/important/project: (100 GiB available) + /absolute/path/to/my/important/project: (100 GiB available) ** Grep @@ -622,7 +635,7 @@ The hardcoded '^' shortcut gets you back to the previous menu. --- *** New user option 'tmm-shortcut-inside-entry'. When non-nil, highlight the character shortcut in the menu entry's -string instead of preprending it and `tmm-mid-prompt' to said entry. +string instead of preprending it and 'tmm-mid-prompt' to said entry. ** Foldout @@ -655,8 +668,8 @@ of seconds. Crossfading can be toggled using the command *** New user option 'vc-allow-rewriting-published-history'. Some VCS commands can change your copy of published change history without warning. In VC we try to detect before that happens, and stop. -You can customize this variable to permit rewriting history -even though Emacs thinks it is dangerous. +You can customize this option to permit rewriting history even though +Emacs thinks it is dangerous. --- *** 'vc-clone' is now an interactive command. @@ -846,7 +859,7 @@ variable 'w32-inhibit-dwrite' to t. Also see 'w32-dwrite-available' and 'w32-dwrite-reinit' to check availability and to configure the DirectWrite rendering parameters. -To show color Emoji in Emacs, customize the default fontset to use a +To show color Emojis in Emacs, customize the default fontset to use a color Emoji font installed on your system for the 'emoji' script. +++ diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 1b90ba6540b..f2ecf8173be 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -118,11 +118,11 @@ Each function is called with the current vector as argument.") (defun tramp-cleanup-connection (vec &optional keep-debug keep-password keep-processes) "Flush all connection related objects. -This includes password cache, file cache, connection cache, -buffers, processes. KEEP-DEBUG non-nil preserves the debug -buffer. KEEP-PASSWORD non-nil preserves the password cache. -KEEP-PROCESSES non-nil preserves the asynchronous processes. -When called interactively, a Tramp connection has to be selected." +This includes password cache, file cache, connection cache, buffers, +processes. KEEP-DEBUG non-nil preserves the debug and trace buffer. +KEEP-PASSWORD non-nil preserves the password cache. KEEP-PROCESSES +non-nil preserves the asynchronous processes. When called +interactively, a Tramp connection has to be selected." (declare (completion tramp-active-command-completion-p)) (interactive ;; When interactive, select the Tramp remote identification. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a137b5aeadc..0a61ca7e40d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1886,7 +1886,8 @@ expected to be a string, which will be used." ;; Assure that the hops are in `tramp-default-proxies-alist'. ;; In tramp-archive.el, the slot `hop' is used for the archive ;; file name. - (unless (string-equal method tramp-archive-method) + (unless (or minibuffer-completing-file-name + (string-equal method tramp-archive-method)) (tramp-add-hops (car args))))) (t (setq method (nth 0 args) @@ -4177,7 +4178,7 @@ Let-bind it when necessary.") ;; the empty string. Suppress adding a hop to ;; `tramp-default-proxies-alist' due to non-expanded default values. (let ((v (tramp-dissect-file-name file t)) - tramp-default-proxies-alist) + (tramp-default-proxies-alist tramp-cache-undefined)) ;; Run the command on the localname portion only unless we are in ;; completion mode. (tramp-make-tramp-file-name @@ -4271,7 +4272,7 @@ Let-bind it when necessary.") ;; the remote file name parts. Suppress adding a hop to ;; `tramp-default-proxies-alist' due to non-expanded default values. (let ((v (tramp-dissect-file-name file t)) - tramp-default-proxies-alist) + (tramp-default-proxies-alist tramp-cache-undefined)) ;; Run the command on the localname portion only. If this returns ;; nil, mark also the localname part of `v' as nil. (tramp-make-tramp-file-name @@ -4912,21 +4913,37 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") (defun tramp-add-hops (vec) "Add ad-hoc proxy definitions to `tramp-default-proxies-alist'." - (when-let* ((hops (tramp-file-name-hop vec)) + ;; `tramp-default-proxies-alist' is bound to `tramp-cache-undefined' + ;; in `tramp-handle-file-name-as-directory' and + ;; `tramp-handle-file-name-directory' suppressing to add a hop. + (when-let* (((not (eq tramp-default-proxies-alist tramp-cache-undefined))) + (hops (tramp-file-name-hop vec)) (item vec)) (let (signal-hook-function changed) (dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 'omit))) (let* ((host-port (tramp-file-name-host-port item)) + (host-port (and (stringp host-port) + (rx bol (literal host-port) eol))) (user-domain (tramp-file-name-user-domain item)) + (user-domain (and (stringp user-domain) + (rx bol (literal user-domain) eol))) (proxy (concat tramp-prefix-format proxy tramp-postfix-host-format)) (entry - (list (and (stringp host-port) - (rx bol (literal host-port) eol)) - (and (stringp user-domain) - (rx bol (literal user-domain) eol)) - (propertize proxy 'tramp-ad-hoc t)))) + (list host-port user-domain (propertize proxy 'tramp-ad-hoc t)))) + ;; Remove superfluous entries. + (when tramp-show-ad-hoc-proxies + (dolist (entry1 tramp-default-proxies-alist) + (when (and (equal host-port (car entry1)) + (equal user-domain (cadr entry1)) + (not (equal proxy (caddr entry1)))) + (tramp-message + vec 5 "Remove %S from `tramp-default-proxies-alist'" entry1) + (tramp-cleanup-connection + vec 'keep-debug 'keep-password 'keep-processes) + (setq tramp-default-proxies-alist + (delete entry1 tramp-default-proxies-alist))))) ;; Add the hop. (unless (member entry tramp-default-proxies-alist) (tramp-message vec 5 "Add %S to `tramp-default-proxies-alist'" entry) commit 200214ca68f00722bf906bbf2a2afa81d139d5dc Author: Ethan Kong Date: Sat Oct 19 12:43:27 2024 +0800 Fix 'internal_equal' so that it uses at most one hash table The old implementation passed the hash table by value in recursive tests, which would cause each recursive level to initialize its own hash table, causing excess memory usage. * src/fns.c (internal_equal): Delegate to 'internal_equal_1'. (internal_equal_1): New function; body from old 'internal_equal'. Pass the hash table argument by reference instead of by value. (Bug#73883) diff --git a/src/fns.c b/src/fns.c index 2de04d06519..ef6922c137b 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2823,8 +2823,8 @@ static ptrdiff_t hash_lookup_with_hash (struct Lisp_Hash_Table *h, if EQUAL_KIND == EQUAL_NO_QUIT. */ static bool -internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, - int depth, Lisp_Object ht) +internal_equal_1 (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, + int depth, Lisp_Object *ht) { tail_recurse: if (depth > 10) @@ -2832,13 +2832,13 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, eassert (equal_kind != EQUAL_NO_QUIT); if (depth > 200) error ("Stack overflow in equal"); - if (NILP (ht)) - ht = CALLN (Fmake_hash_table, QCtest, Qeq); + if (NILP (*ht)) + *ht = CALLN (Fmake_hash_table, QCtest, Qeq); switch (XTYPE (o1)) { case Lisp_Cons: case Lisp_Vectorlike: { - struct Lisp_Hash_Table *h = XHASH_TABLE (ht); + struct Lisp_Hash_Table *h = XHASH_TABLE (*ht); hash_hash_t hash = hash_from_key (h, o1); ptrdiff_t i = hash_lookup_with_hash (h, o1, hash); if (i >= 0) @@ -2888,8 +2888,8 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, { if (! CONSP (o2)) return false; - if (! internal_equal (XCAR (o1), XCAR (o2), - equal_kind, depth + 1, ht)) + if (! internal_equal_1 (XCAR (o1), XCAR (o2), + equal_kind, depth + 1, ht)) return false; o2 = XCDR (o2); if (EQ (XCDR (o1), o2)) @@ -2964,7 +2964,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, Lisp_Object v1, v2; v1 = AREF (o1, i); v2 = AREF (o2, i); - if (!internal_equal (v1, v2, equal_kind, depth + 1, ht)) + if (!internal_equal_1 (v1, v2, equal_kind, depth + 1, ht)) return false; } return true; @@ -2985,6 +2985,13 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, return false; } +static bool +internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, + int depth, Lisp_Object ht) +{ + return internal_equal_1 (o1, o2, equal_kind, depth, &ht); +} + /* Return -1/0/1 for the lexicographic relation between bool-vectors. */ static int bool_vector_cmp (Lisp_Object a, Lisp_Object b) commit 775970a7831de930cd25ee592fb40004b1c2bc24 Author: Eli Zaretskii Date: Fri Nov 8 10:03:35 2024 +0200 ; * src/ftcrfont.c (ftcrhbfont_end_hb_font): Improve commentary (bug#73752). diff --git a/src/ftcrfont.c b/src/ftcrfont.c index c2e6785a76a..32f77b03d37 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -702,8 +702,12 @@ ftcrhbfont_end_hb_font (struct font *font, hb_font_t *hb_font) eassert (hb_font == ftcrfont_info->hb_font); /* ftcrfont_info->hb_font holds a reference to the FT_Face returned by - cairo_ft_scaled_font_lock_face. Keeping it around after the - matching unlock call would violate the API contract (Bug#73752). */ + cairo_ft_scaled_font_lock_face. Keeping it around after the matching + unlock call would violate the API contract, and cause corrupted + display of composed characters (Bug#73752). We destroy and NULLify + hb_font here, which will then cause fthbfont_begin_hb_font, called by + ftcrhbfont_begin_hb_font, to recreate hb_font anew, taking into + consideration any scale changes in FT_Face. */ hb_font_destroy (ftcrfont_info->hb_font); ftcrfont_info->hb_font = NULL; commit 9149aa89ee860627cc91e27c8659ad6f4efcfcd8 Author: Tim Ruffing Date: Thu Nov 7 03:09:09 2024 +0100 Fix display of compositions when font style changes (Cairo backend) * src/ftcrfont.c (ftcrhbfont_end_hb_font): Don't persist the result of 'cairo_ft_scaled_font_lock_face' in violation of the API contract. (Bug#73752) diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 5ee375c782b..c2e6785a76a 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -700,6 +700,13 @@ ftcrhbfont_end_hb_font (struct font *font, hb_font_t *hb_font) struct font_info *ftcrfont_info = (struct font_info *) font; cairo_scaled_font_t *scaled_font = ftcrfont_info->cr_scaled_font; + eassert (hb_font == ftcrfont_info->hb_font); + /* ftcrfont_info->hb_font holds a reference to the FT_Face returned by + cairo_ft_scaled_font_lock_face. Keeping it around after the + matching unlock call would violate the API contract (Bug#73752). */ + hb_font_destroy (ftcrfont_info->hb_font); + ftcrfont_info->hb_font = NULL; + cairo_ft_scaled_font_unlock_face (scaled_font); ftcrfont_info->ft_size = NULL; } commit 3bf00777be1e28d3d0e49692071825580f472037 Author: Eli Zaretskii Date: Thu Nov 7 19:34:43 2024 +0200 ; * src/xdisp.c (face_before_or_after_it_pos): Fix thinko (bug#74241). diff --git a/src/xdisp.c b/src/xdisp.c index a1319e76f49..bc5738e89b7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4970,7 +4970,7 @@ face_before_or_after_it_pos (struct it *it, bool before_p) /* For composition, we must check the position after the composition. */ pos.charpos += it->cmp_it.nchars; - pos.bytepos += it->len; + pos.bytepos += it->cmp_it.nbytes; } else INC_TEXT_POS (pos, it->multibyte_p); commit e88309eef30abca327c845fe4133d758d33cfb6b Author: Mattias Engdegård Date: Wed Nov 6 13:29:23 2024 +0100 Fix wrong value of `when` and `unless` with empty body (bug#74215) * lisp/subr.el (when, unless): Return nil when the body is empty. Reported by Brennan Vincent. * test/lisp/subr-tests.el (subr-test-when): Add test cases. (cherry picked from commit 9ee9154247454c18f9f75d0d32592b817d7e977a) diff --git a/lisp/subr.el b/lisp/subr.el index b849d8d1b16..465795c7555 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -299,7 +299,7 @@ value of last one, or nil if there are none." (if body (list 'if cond (cons 'progn body)) (macroexp-warn-and-return (format-message "`when' with empty body") - cond '(empty-body when) t))) + (list 'progn cond nil) '(empty-body when) t))) (defmacro unless (cond &rest body) "If COND yields nil, do BODY, else return nil. @@ -309,7 +309,7 @@ value of last one, or nil if there are none." (if body (cons 'if (cons cond (cons nil body))) (macroexp-warn-and-return (format-message "`unless' with empty body") - cond '(empty-body unless) t))) + (list 'progn cond nil) '(empty-body unless) t))) (defsubst subr-primitive-p (object) "Return t if OBJECT is a built-in primitive written in C. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 6f28e057342..e12e3c62e0c 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -454,7 +454,11 @@ x))) (should (= x 2))) (should (equal (macroexpand-all '(when a b c d)) - '(if a (progn b c d))))) + '(if a (progn b c d)))) + (with-suppressed-warnings ((empty-body when unless)) + (should (equal (when t) nil)) + (should (equal (unless t) nil)) + (should (equal (unless nil) nil)))) (ert-deftest subr-test-xor () "Test `xor'." commit 3231af3727b450404efd6f49ddf5c95c5a8cbb0f Author: Robert Pluim Date: Tue Nov 5 13:51:21 2024 +0100 Improve 'open-network-stream' documentation. * doc/lispref/processes.texi (Network): Correct explanation of ':warn-unless-encrypted'. Document ':error' return keyword. * lisp/net/network-stream.el (open-network-stream): Improve ':return-list' documentation. Document ':error'. Correct explanation of ':warn-unless-encrypted'. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 53468e0d252..2c19275f946 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2686,10 +2686,12 @@ If non-@code{nil}, do opportunistic @acronym{STARTTLS} upgrades even if Emacs doesn't have built-in @acronym{TLS} support. @item :warn-unless-encrypted @var{boolean} -If non-@code{nil}, and @code{:return-value} is also non-@code{nil}, -Emacs will warn if the connection isn't encrypted. This is useful for -protocols like @acronym{IMAP} and the like, where most users would -expect the network traffic to be encrypted. +If non-@code{nil}, warn the user if the final connection type is not +encrypted. This is useful for protocols like @acronym{IMAP} and the +like, where most users would expect the network traffic to be encrypted. +This may be due to @acronym{STARTTLS} upgrade failure, specifying +@code{:return-list} non-@code{nil} allows you to capture any error +encountered. @vindex network-stream-use-client-certificates @item :client-certificate @var{list-or-t} @@ -2715,6 +2717,9 @@ If non-@code{nil}, the greeting string returned by the host. If non-@code{nil}, the host's capability string. @item :type @var{symbol} The connection type: @samp{plain} or @samp{tls}. +@item :error @var{symbol} +A string describing any error encountered when perfoming +@acronym{STARTTLS} upgrade. @end table @item :shell-command @var{string-or-nil} diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index dcb3ad61f6d..89d3e4f19c1 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -117,15 +117,18 @@ values: used to decode and encode the data which the process reads and writes. See `make-network-process' for details. -:return-list specifies this function's return value. - If omitted or nil, return a process object. A non-nil means to - return (PROC . PROPS), where PROC is a process object and PROPS - is a plist of connection properties, with these keywords: +:return-list controls the form of the function's return value. + If omitted or nil, return a process object. Anything else means to + return (PROC . PROPS), where PROC is a process object, and PROPS is a + plist of connection properties, which may include the following + keywords: :greeting -- the greeting returned by HOST (a string), or nil. :capabilities -- a string representing HOST's capabilities, or nil if none could be found. :type -- the resulting connection type; `plain' (unencrypted) or `tls' (TLS-encrypted). + :error -- A string describing any error when attempting + to negotiate STARTTLS. :end-of-command specifies a regexp matching the end of a command. @@ -164,8 +167,9 @@ writes. See `make-network-process' for details. :use-starttls-if-possible is a boolean that says to do opportunistic STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality. -:warn-unless-encrypted is a boolean which, if :return-list is -non-nil, is used warn the user if the connection isn't encrypted. +:warn-unless-encrypted, if non-nil, warn the user if the connection +isn't encrypted (i.e. STARTTLS failed). Additionally, setting +:return-list non-nil allows capturing any error response. :nogreeting is a boolean that can be used to inhibit waiting for a greeting from the server. commit fb55431c44ec00b05122eaa09d310c1dcf2684b1 Author: Robert Pluim Date: Tue Nov 5 12:33:49 2024 +0100 ; Fix typos in case-conversion descriptions * doc/lispref/nonascii.texi (Character Properties): Fix typos. * doc/lispref/strings.texi (Case Conversion): Fix typos. (Case Tables): Fix typos. diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index c55e5a67693..f4f65e2020f 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -631,30 +631,30 @@ is @code{nil}, which means the character itself. @item special-uppercase Corresponds to Unicode language- and context-independent special upper-casing rules. The value of this property is a string (which may be empty). For -example mapping for U+00DF @sc{latin small letter sharp s} is +example for U+00DF @sc{latin small letter sharp s} the value is @code{"SS"}. This mapping overrides the @code{uppercase} property, and thus the current case table. For characters with no special mapping, -the value is @code{nil}, which means @code{uppercase} property needs to +the value is @code{nil}, which means the @code{uppercase} property needs to be consulted instead. @item special-lowercase Corresponds to Unicode language- and context-independent special lower-casing rules. The value of this property is a string (which may -be empty). For example mapping for U+0130 @sc{latin capital letter i -with dot above} the value is @code{"i\u0307"} (i.e. 2-character string +be empty). For example for U+0130 @sc{latin capital letter i +with dot above} the value is @code{"i\u0307"} (i.e. a 2-character string consisting of @sc{latin small letter i} followed by U+0307 @sc{combining dot above}). This mapping overrides the @code{lowercase} property, and thus the current case table. For characters with no -special mapping, the value is @code{nil}, which means @code{lowercase} +special mapping, the value is @code{nil}, which means the @code{lowercase} property needs to be consulted instead. @item special-titlecase Corresponds to Unicode unconditional special title-casing rules. The value of -this property is a string (which may be empty). For example mapping for +this property is a string (which may be empty). For example for U+FB01 @sc{latin small ligature fi} the value is @code{"Fi"}. This mapping overrides the @code{titlecase} property, and thus the current case table. For characters with no special mapping, the value is -@code{nil}, which means @code{titlecase} property needs to be consulted +@code{nil}, which means the @code{titlecase} property needs to be consulted instead. @end table diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 09f5bdc803b..aed371f5704 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -1593,7 +1593,7 @@ be made. Other characters can also have special case-conversion rules. They all have non-@code{nil} character properties @code{special-uppercase}, -@code{special-lowercase} or @code{special-titlecase} (@pxref{Character +@code{special-lowercase}, or @code{special-titlecase} (@pxref{Character Properties}) defined by the Unicode Standard. These properties define special case-conversion rules which override the current case table (@pxref{Case Tables}). @@ -1640,11 +1640,11 @@ maps for both lower case and upper case. Some characters have special case-conversion rules defined for them, which by default override the current case table. These characters have non-@code{nil} character properties @code{special-uppercase}, -@code{special-lowercase} or @code{special-titlecase} (@pxref{Character +@code{special-lowercase}, or @code{special-titlecase} (@pxref{Character Properties}) defined by the Unicode Standard. An example is U+00DF LATIN SMALL LETTER SHARP S, @ss{}, which by default up-cases to the string @code{"SS"}, not to U+1E9E LATIN CAPITAL LETTER SHARP S@. To -force these characters follow the case-table conversions, set the +force these characters to follow the case-table conversions, set the corresponding Unicode property to @code{nil}: @example commit 83f095d1fd4be8be5db61fd6a94fc6203cc78b2f Author: Eli Zaretskii Date: Mon Nov 4 21:34:25 2024 +0200 ; Fix typo and indexing in the ELisp manual * doc/lispref/display.texi (Image Descriptors): Fix typo and indexing. (Defining Images): Fix indexing. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index afb1272ae41..59d39837cc5 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -6020,8 +6020,9 @@ is platform dependent, but should be equivalent to bilinear filtering. Disabling smoothing will use the nearest neighbor algorithm. +@vindex image-transform-smoothing If this property is not specified, @code{create-image} will use the -@code{image-transform-smoothing} user option to say whether scaling +@code{image-transform-smoothing} user option to say whether smoothing should be done or not. This option can be @code{nil} (no smoothing), @code{t} (use smoothing) or a predicate function that's called with the image object as the only parameter, and should return either @@ -7022,12 +7023,13 @@ Here is an example of using @code{image-load-path-for-library}: @end example @end defun -@vindex image-scaling-factor +@vindex image-scaling-factor, and automatic image scaling Images are automatically scaled when created based on the @code{image-scaling-factor} variable. The value is either a floating point number (where numbers higher than 1 means to increase the size and lower means to shrink the size), or the symbol @code{auto}, which -will compute a scaling factor based on the font pixel size. +will compute a scaling factor based on the font pixel size. @xref{Image +Descriptors}. @node Showing Images @subsection Showing Images commit 37b1799c9e5677db35ac509729a29fb7cd44cf39 Author: Michael Albinus Date: Mon Nov 4 14:24:21 2024 +0100 ; Instrument proced-tests.el further * test/lisp/proced-tests.el (proced--assert-process-valid-cpu-refinement): Explain also Lisp errors. diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el index 9036c15271c..3dc7e065afa 100644 --- a/test/lisp/proced-tests.el +++ b/test/lisp/proced-tests.el @@ -50,7 +50,11 @@ (defun proced--assert-process-valid-cpu-refinement (cpu) "Fail unless the process at point could be present after a refinement using CPU." (proced--move-to-column "%CPU") - (>= (thing-at-point 'number) cpu)) + (condition-case err + (>= (thing-at-point 'number) cpu) + (error + (ert-fail + (list err (proced--assert-process-valid-cpu-refinement-explainer cpu)))))) (defun proced--assert-process-valid-cpu-refinement-explainer (cpu) "Explain the result of `proced--assert-process-valid-cpu-refinement'. commit 03fa832b4dcc47276894d90f3323bca31eb0633e Author: Michael Albinus Date: Sun Nov 3 15:48:19 2024 +0100 Improve Tramp documentation on direct async processes * doc/misc/tramp.texi (Remote processes): Add another example enabling direct async processes based on method name. (Bug#74105) * etc/NEWS: Rephrase Tramp entry on direct async processes. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 69572a139ff..9895b3c6fce 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -4549,6 +4549,18 @@ which must be set to a non-@code{nil} value. Example: @end group @end lisp +This enables direct async processes for the host @samp{remotehost}. +If you want to enable direct async processes for all remote hosts +connected via the same method (e.g., @option{ssh}), use instead + +@lisp +@group +(connection-local-set-profiles + '(:application tramp :protocol "ssh") + 'remote-direct-async-process) +@end group +@end lisp + Using direct asynchronous processes in @value{tramp} is not possible, if the remote host is connected via multiple hops (@pxref{Multi-hops}). In this case, @value{tramp} falls back to its diff --git a/etc/NEWS b/etc/NEWS index ebb9d49d560..fbc29206039 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1413,10 +1413,12 @@ method but "sudo" can be configured with user option +++ *** Direct asynchronous processes are indicated by a connection-local variable. If direct asynchronous processes shall be used, set the connection-local -variable 'tramp-direct-async-process' to a non-nil value. This has been -changed, in previous Emacs versions this was indicated by the now -deprecated connection property "direct-async-process". See the Tramp -manual "(tramp) Improving performance of asynchronous remote processes". +variable 'tramp-direct-async-process' to a non-nil value. In previous +Emacs versions this was indicated by the connection property +"direct-async-process". That connection property (though not connection +properties and 'tramp-connection-properties' in general) is now +deprecated. See the Tramp manual "(tramp) Improving performance of +asynchronous remote processes". --- *** Direct asynchronous processes use 'tramp-remote-path'.