From c4a8572025e5eb7c2f8813dd647211e8870883f8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 31 Jul 2023 17:48:36 +0200 Subject: [PATCH 01/20] ; * etc/HISTORY: Fix Emacs 28.3 entry. --- etc/HISTORY | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/HISTORY b/etc/HISTORY index 70f8669cb29..f6df3e6fe60 100644 --- a/etc/HISTORY +++ b/etc/HISTORY @@ -228,7 +228,8 @@ GNU Emacs 28.1 (2022-04-04) emacs-28.1 GNU Emacs 28.2 (2022-09-12) emacs-28.2 -GNU Emacs 28.3 (2023-02-17) emacs-28.3 (was not actually released) +GNU Emacs 28.3 (2023-02-17) emacs-28.3-rc1 +Was not actually released. GNU Emacs 29.1 (2023-07-30) emacs-29.1 From 7bbd7cae0748958a623f23637b95a6fc9debb8b7 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 31 Jul 2023 17:49:21 +0200 Subject: [PATCH 02/20] Fix find-dired-with-command for remote directories * lisp/find-dired.el (find-dired-with-command): Use `start-file-process-shell-command'. (Bug#64897) --- lisp/find-dired.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/find-dired.el b/lisp/find-dired.el index af029fb2074..27f4a736e31 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -244,8 +244,8 @@ it finishes, type \\[kill-find]." (erase-buffer) (setq default-directory dir) ;; Start the find process. - (shell-command (concat command "&") (current-buffer)) - (let ((proc (get-buffer-process (current-buffer)))) + (let ((proc (start-file-process-shell-command + (buffer-name) (current-buffer) command))) ;; Initialize the process marker; it is used by the filter. (move-marker (process-mark proc) (point) (current-buffer)) (set-process-filter proc #'find-dired-filter) From 0c29f53ab8723dd5a9f31ce8a6e913cc08132e56 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 31 Jul 2023 21:50:45 +0300 Subject: [PATCH 03/20] Fix 'string-pixel-width' under 'line-prefix' * lisp/emacs-lisp/subr-x.el (string-pixel-width): Disable 'line-prefix' and 'wrap-prefix' to avoid their effect on the calculated string width. (Bug#64971) --- lisp/emacs-lisp/subr-x.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 8cdbdf1ef6a..b164071763b 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -322,12 +322,15 @@ as the new values of the bound variables in the recursive invocation." ;; Keeping a work buffer around is more efficient than creating a ;; new temporary buffer. (with-current-buffer (get-buffer-create " *string-pixel-width*") - ;; `display-line-numbers-mode' is enabled in internal buffers - ;; that breaks width calculation, so need to disable (bug#59311) + ;; If `display-line-numbers-mode' is enabled in internal + ;; buffers, it breaks width calculation, so disable it (bug#59311) (when (bound-and-true-p display-line-numbers-mode) (display-line-numbers-mode -1)) (delete-region (point-min) (point-max)) - (insert string) + ;; Disable line-prefix and wrap-prefix, for the same reason. + (setq line-prefix nil + wrap-prefix nil) + (insert (propertize string 'line-prefix nil 'wrap-prefix nil)) (car (buffer-text-pixel-size nil nil t))))) ;;;###autoload From 608a8757d9fa54bc2fd57180b0347931db9c46b0 Mon Sep 17 00:00:00 2001 From: Amritpal Singh Date: Fri, 2 Jun 2023 10:51:21 +0530 Subject: [PATCH 04/20] Support files compressed by 'pigz' * src/decompress.c (md5_gz_stream): Check 'stream.avail_in' as well. (Bug#63832) Copyright-paperwork-exempt: yes (cherry picked from commit 46b6d175054e8f6bf7cb45e112048c0cf02bfee9) --- src/decompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decompress.c b/src/decompress.c index 6ef17db07d6..162f6167b73 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -151,7 +151,7 @@ md5_gz_stream (FILE *source, void *resblock) return -1; accumulate_and_process_md5 (out, MD5_BLOCKSIZE - stream.avail_out, &ctx); - } while (!stream.avail_out); + } while (stream.avail_in && !stream.avail_out); } while (res != Z_STREAM_END); From da5e05a50e8713f5efb51567645822fa5bfdd6b7 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Mon, 31 Jul 2023 23:10:03 -0700 Subject: [PATCH 05/20] Fix handling of ".elpaignore" file when compiling packages * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Treat 'byte-compile-ignore-files' as a list of regexps per its docstring (bug#64985). --- lisp/emacs-lisp/bytecomp.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5df1205869c..65ccb60726f 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1922,6 +1922,8 @@ also be compiled." (emacs-lisp-compilation-mode)) (let ((directories (list default-directory)) (default-directory default-directory) + (ignore-files-regexp + (mapconcat #'identity byte-compile-ignore-files "\\|")) (skip-count 0) (fail-count 0) (file-count 0) @@ -1942,9 +1944,7 @@ also be compiled." (or (null arg) (eq 0 arg) (y-or-n-p (concat "Check " source "? "))) ;; Directory is requested to be ignored - (not (string-match-p - (regexp-opt byte-compile-ignore-files) - source)) + (not (string-match-p ignore-files-regexp source)) (setq directories (nconc directories (list source)))) ;; It is an ordinary file. Decide whether to compile it. (if (and (string-match emacs-lisp-file-regexp source) @@ -1954,9 +1954,7 @@ also be compiled." (not (auto-save-file-name-p source)) (not (member source (dir-locals--all-files directory))) ;; File is requested to be ignored - (not (string-match-p - (regexp-opt byte-compile-ignore-files) - source))) + (not (string-match-p ignore-files-regexp source))) (progn (cl-incf (pcase (byte-recompile-file source force arg) ('no-byte-compile skip-count) From 5c6a51668b0917aa1e014cbfa7bfcf703a4e7048 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Wed, 2 Aug 2023 11:05:37 -0700 Subject: [PATCH 06/20] ; * doc/misc/eshell.texi (Argument Modifiers): Fix typo in example. --- doc/misc/eshell.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index e659adfe83d..b5311e63a56 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -1625,7 +1625,7 @@ Treating the value as a file name, gets the directory name (the @item t Treating the value as a file name, gets the base name (the ``tail''). -For example, @samp{foo/bar/baz.el(:h)} expands to @samp{baz.el}. +For example, @samp{foo/bar/baz.el(:t)} expands to @samp{baz.el}. @item e Treating the value as a file name, gets the final extension of the From 6eddbfe33f2ff07f186da14f8974e742bf3ca2ae Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 3 Aug 2023 08:31:17 +0300 Subject: [PATCH 07/20] Clarify the meaning of the argument of ':align-to' space spec * doc/lispref/display.texi (Specified Space): Clarify the meaning and measurement of HPOS in ':align-to' space specs. (Bug#65015) --- doc/lispref/display.texi | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e229935170f..50a91066d1d 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5287,10 +5287,18 @@ the ``pixel width'' of a character is usually 1, but it could be more for TABs and double-width CJK characters.) @item :align-to @var{hpos} -Specifies that the space should be wide enough to reach @var{hpos}. -If @var{hpos} is a number, it is measured in units of the normal -character width. @var{hpos} can also be a @dfn{pixel width} -specification (@pxref{Pixel Specification}). +Specifies that the space should be wide enough to reach the column +@var{hpos}. If @var{hpos} is a number, it is a column number, and is +measured in units of the canonical character width (@pxref{Frame +Font}). @var{hpos} can also be a @dfn{pixel width} specification +(@pxref{Pixel Specification}). When the current line is wider than +the window, and is either displayed by one or more continuation lines, +or is truncated and possibly scrolled horizontally (@pxref{Horizontal +Scrolling}), @var{hpos} is measured from the beginning of the logical +line, not from the visual beginning of the screen line. This way, +alignment produced by @code{:align-to} is consistent with functions +that count columns, such as @code{current-column} and +@code{move-to-column} (@pxref{Columns}). @end table You should use one and only one of the above properties. You can From d005b2c89ce6075dca9a4b728e0dfef6f11e6118 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 1 Aug 2023 19:28:53 +0200 Subject: [PATCH 08/20] Fix link to info node in prin1 docstring * src/print.c (Fprin1): Fix linking to info node in docstring. (cherry picked from commit 4b73edb8d1da74fd1bda8894e982d9768fd1f18c) --- src/print.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/print.c b/src/print.c index e65b4c40b0e..8c61dbd53e1 100644 --- a/src/print.c +++ b/src/print.c @@ -759,8 +759,7 @@ For instance: (prin1 object nil \\='((length . 100) (circle . t))). -See the manual entry `(elisp)Output Overrides' for a list of possible -values. +See Info node `(elisp)Output Overrides' for a list of possible values. As a special case, OVERRIDES can also simply be the symbol t, which means "use default values for all the print-related settings". */) From db7d70d3cadd9f7825b8d279c512c03706ca580e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 3 Aug 2023 11:26:32 +0300 Subject: [PATCH 09/20] ; Add commentary to 'describe-function's completion * lisp/help-fns.el (help-fns--describe-function-or-command-prompt): Add a comment (bug#64902). --- lisp/help-fns.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 044bcf8b51f..068c3a5b559 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -229,6 +229,10 @@ interactive command." (lambda (f) (if want-command (commandp f) (or (fboundp f) (get f 'function-documentation)))) + ;; We use 'confirm' here, unlike in other describe-* + ;; commands, for cases like a function that is advised + ;; but not yet defined (e.g., if 'advice-add' is called + ;; before defining the function). 'confirm nil nil (and fn (symbol-name fn))))) (unless (equal val "") From 573fcf2712221f30274de0b217a5702250f43704 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 3 Aug 2023 11:31:41 +0300 Subject: [PATCH 10/20] Add new keyword to 'typescript-ts-mode' * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--keywords): Add "satisfies", a new operator in Typescript 4.9. (Bug#64924) --- lisp/progmodes/typescript-ts-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index d234bf2f6e6..96ea18523e3 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -142,7 +142,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." "export" "extends" "finally" "for" "from" "function" "get" "if" "implements" "import" "in" "instanceof" "interface" "is" "infer" "keyof" "let" "namespace" "new" "of" "private" "protected" - "public" "readonly" "return" "set" "static" "switch" + "public" "readonly" "return" "satisfies" "set" "static" "switch" "target" "throw" "try" "type" "typeof" "var" "void" "while" "with" "yield") "TypeScript keywords for tree-sitter font-locking.") From 04996b21241468979ac7f8b4a80563186bee9fad Mon Sep 17 00:00:00 2001 From: john muhl Date: Sun, 30 Jul 2023 13:43:10 -0500 Subject: [PATCH 11/20] Handle tabs in the SQL shown in the column listing * lisp/sqlite-mode.el (sqlite-mode-list-columns): Handle tabs. (Bug#64964) --- lisp/sqlite-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index c3047c786f7..8cb94485369 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -126,7 +126,7 @@ (forward-line 1) (if (looking-at " ") ;; Delete the info. - (delete-region (point) (if (re-search-forward "^[^ ]" nil t) + (delete-region (point) (if (re-search-forward "^[^ \t]" nil t) (match-beginning 0) (point-max))) ;; Insert the info. From 27ed565ec6163c499191b62a4cee10d99019aa38 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2023 23:41:11 -0400 Subject: [PATCH 12/20] * lisp/emacs-lisp/advice.el (defadvice): Mark as obsolete --- etc/NEWS | 4 ++++ lisp/emacs-lisp/advice.el | 1 + 2 files changed, 5 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 7b521f3e6fe..567f19012eb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -685,6 +685,10 @@ provokes an error if used numerically. * Lisp Changes in Emacs 30.1 +** 'defadvice' is marked as obsolete. +See (info "(elisp)Porting Old Advice") for help converting them +to use `advice-add` or `define-advice instead. + +++ ** New user option 'safe-local-variable-directories'. This user option names directories in which Emacs will treat all diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 56f0ae2212c..3265809f592 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -3131,6 +3131,7 @@ usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...) [DOCSTRING] [INTERACTIVE-FORM] BODY...)" (declare (doc-string 3) (indent 2) + (obsolete "use advice-add or define-advice" "30.1") (debug (&define name ;; thing being advised. (name ;; class is [&or "before" "around" "after" ;; "activation" "deactivation"] From e9672b147f2e1f4879752f882fb58c7dc7ce3e9b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2023 23:43:12 -0400 Subject: [PATCH 13/20] * lisp/progmodes/cc-mode.el (c-advise-fl-for-region): Fix compiler warning Make sure we macro-expand `defadvice` only when we want to use it. --- lisp/progmodes/cc-mode.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index dd699b9a119..a96863cd15e 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2723,18 +2723,18 @@ This function is called from `c-common-init', once per mode initialization." ;; Emacs < 22 and XEmacs (defmacro c-advise-fl-for-region (function) (declare (debug t)) - `(defadvice ,function (before get-awk-region activate) - ;; Make sure that any string/regexp is completely font-locked. - (when c-buffer-is-cc-mode - (save-excursion - (ad-set-arg 1 c-new-END) ; end - (ad-set-arg 0 c-new-BEG))))) ; beg + (unless (boundp 'font-lock-extend-after-change-region-function) + `(defadvice ,function (before get-awk-region activate) + ;; Make sure that any string/regexp is completely font-locked. + (when c-buffer-is-cc-mode + (save-excursion + (ad-set-arg 1 c-new-END) ; end + (ad-set-arg 0 c-new-BEG)))))) ; beg -(unless (boundp 'font-lock-extend-after-change-region-function) - (c-advise-fl-for-region font-lock-after-change-function) - (c-advise-fl-for-region jit-lock-after-change) - (c-advise-fl-for-region lazy-lock-defer-rest-after-change) - (c-advise-fl-for-region lazy-lock-defer-line-after-change)) +(c-advise-fl-for-region font-lock-after-change-function) +(c-advise-fl-for-region jit-lock-after-change) +(c-advise-fl-for-region lazy-lock-defer-rest-after-change) +(c-advise-fl-for-region lazy-lock-defer-line-after-change) ;; Connect up to `electric-indent-mode' (Emacs 24.4 and later). (defun c-electric-indent-mode-hook () From 12427976c8a8157fc2fe8ffa3a7fe157a8fe2e45 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 4 Aug 2023 06:19:57 +0200 Subject: [PATCH 14/20] * lisp/net/tramp.el (tramp-skeleton-write-region): Fix scoping. (Bug#65022) --- lisp/net/tramp.el | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 31b91b4e910..2fc54c5388b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3527,29 +3527,29 @@ BODY is the backend specific code." ;; Set the ownership. (when need-chown - (tramp-set-file-uid-gid filename uid gid))) + (tramp-set-file-uid-gid filename uid gid)) - ;; Set extended attributes. We ignore possible errors, - ;; because ACL strings could be incompatible. - (when attributes - (ignore-errors - (set-file-extended-attributes filename attributes))) + ;; Set extended attributes. We ignore possible errors, + ;; because ACL strings could be incompatible. + (when attributes + (ignore-errors + (set-file-extended-attributes filename attributes))) - ;; Unlock file. - (when file-locked - ;; `unlock-file' exists since Emacs 28.1. - (tramp-compat-funcall 'unlock-file lockname)) + ;; Unlock file. + (when file-locked + ;; `unlock-file' exists since Emacs 28.1. + (tramp-compat-funcall 'unlock-file lockname)) - ;; Sanity check. - (unless (equal curbuf (current-buffer)) - (tramp-error - v 'file-error - "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) + ;; Sanity check. + (unless (equal curbuf (current-buffer)) + (tramp-error + v 'file-error + "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) - (when (and (null noninteractive) - (or (eq ,visit t) (string-or-null-p ,visit))) - (tramp-message v 0 "Wrote %s" filename)) - (run-hooks 'tramp-handle-write-region-hook)))))) + (when (and (null noninteractive) + (or (eq ,visit t) (string-or-null-p ,visit))) + (tramp-message v 0 "Wrote %s" filename)) + (run-hooks 'tramp-handle-write-region-hook))))))) ;;; Common file name handler functions for different backends: From acfcf7f3690630344b090b4af6afa4d02d0147a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2023 09:34:55 +0300 Subject: [PATCH 15/20] Fix "Paste from Kill Menu" in non X toolkit builds * src/keymap.c (possibly_translate_key_sequence): Don't signal an error if 'key-valid-p' returns nil. Suggested by Stefan Monnier . (Bug#64927) --- src/keymap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/keymap.c b/src/keymap.c index 7f5777c9251..41ca43d6a95 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1065,8 +1065,12 @@ possibly_translate_key_sequence (Lisp_Object key, ptrdiff_t *length) xsignal2 (Qerror, build_string ("`key-valid-p' is not defined, so this syntax can't be used: %s"), key); + /* If key-valid-p is unhappy about KEY, we return it as-is. + This happens when menu items define as bindings strings that + should be inserted into the buffer, not commands. See + bug#64927, for example. */ if (NILP (call1 (Qkey_valid_p, AREF (key, 0)))) - xsignal2 (Qerror, build_string ("Invalid `key-parse' syntax: %S"), key); + return key; key = call1 (Qkey_parse, AREF (key, 0)); *length = CHECK_VECTOR_OR_STRING (key); if (*length == 0) From 0f183770c56fab7917fc975222f074ca7eb4a410 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 4 Aug 2023 09:41:30 +0300 Subject: [PATCH 16/20] Fix byte-compiled files that use 'bind-key' from use-package * lisp/use-package/bind-key.el (bind-key): Ensure 'bind-key' is loaded at run time. Patch by John Wiegley . (Bug#64901) --- lisp/use-package/bind-key.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index 0ab72eafce2..95dda958375 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el @@ -196,6 +196,7 @@ can safely be called at any time." (key-description ,namevar)) (if (symbolp ,keymap) ,keymap (quote ,keymap)))) (,bindingvar (lookup-key ,kmapvar ,keyvar))) + (require 'bind-key) ; ensure `personal-keybindings' is in scope (let ((entry (assoc ,kdescvar personal-keybindings)) (details (list ,command (unless (numberp ,bindingvar) From c75c7997197502189023c9f47140474fa7fd719e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 4 Aug 2023 09:50:43 +0200 Subject: [PATCH 17/20] ; Fix http/https thinko in org manual * doc/misc/org.org (External Links): Change an HTTPS link back to HTTP, as it's used as an example to show the supported protocols. Ref: https://lists.gnu.org/r/emacs-devel/2023-08/msg00018.html --- doc/misc/org.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/misc/org.org b/doc/misc/org.org index 5562a13a005..a4ce53cc6cb 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -3284,7 +3284,7 @@ options: | Link Type | Example | |------------+----------------------------------------------------------| -| http | =https://staff.science.uva.nl/c.dominik/= | +| http | =http://staff.science.uva.nl/c.dominik/= | | https | =https://orgmode.org/= | | doi | =doi:10.1000/182= | | file | =file:/home/dominik/images/jupiter.jpg= | From 44d7fd3805f5b1e0b571ece007abc466e1b39ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 4 Aug 2023 11:08:57 +0200 Subject: [PATCH 18/20] Don't allow the `eq` and `unbind` byte-ops to commute (bug#65017) * lisp/emacs-lisp/byte-opt.el (byte-after-unwind-ops): Cease sinking `eq` past `unwind`, because that optimised away the let-binding in (let ((symbols-with-pos-enabled nil)) (eq x y)) and `eq` is currently sensitive to `symbols-with-pos-enabled`. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--eq-symbols-with-pos-enabled): New test. --- lisp/emacs-lisp/byte-opt.el | 7 +++++- test/lisp/emacs-lisp/bytecomp-tests.el | 34 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c7d8531a870..12c2bc51b92 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -2141,7 +2141,7 @@ See Info node `(elisp) Integer Basics'." '(byte-constant byte-dup byte-stack-ref byte-stack-set byte-discard byte-discardN byte-discardN-preserve-tos byte-symbolp byte-consp byte-stringp byte-listp byte-numberp byte-integerp - byte-eq byte-not + byte-not byte-cons byte-list1 byte-list2 byte-list3 byte-list4 byte-listN byte-interactive-p) ;; How about other side-effect-free-ops? Is it safe to move an @@ -2149,6 +2149,11 @@ See Info node `(elisp) Integer Basics'." ;; No, it is not, because the unwind-protect forms can alter ;; the inside of the object to which nth would apply. ;; For the same reason, byte-equal was deleted from this list. + ;; + ;; In particular, `byte-eq' isn't here despite `eq' being nominally + ;; pure because it is currently affected by `symbols-with-pos-enabled' + ;; and so cannot be sunk past an unwind op that might end a binding of + ;; that variable. Yes, this is unsatisfactory. "Byte-codes that can be moved past an unbind.") (defconst byte-compile-side-effect-and-error-free-ops diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 593fd117685..246ffff532f 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -2001,6 +2001,40 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \ (backtrace-frame-args frame)) call)))))))))) +(ert-deftest bytecomp--eq-symbols-with-pos-enabled () + ;; Verify that we don't optimise away a binding of + ;; `symbols-with-pos-enabled' around an application of `eq' (bug#65017). + (let* ((sym-with-pos1 (read-positioning-symbols "sym")) + (sym-with-pos2 (read-positioning-symbols " sym")) ; <- space! + (without-pos-eq (lambda (a b) + (let ((symbols-with-pos-enabled nil)) + (eq a b)))) + (without-pos-eq-compiled (byte-compile without-pos-eq)) + (with-pos-eq (lambda (a b) + (let ((symbols-with-pos-enabled t)) + (eq a b)))) + (with-pos-eq-compiled (byte-compile with-pos-eq))) + (dolist (mode '(interpreted compiled)) + (ert-info ((symbol-name mode) :prefix "mode: ") + (ert-info ("disabled" :prefix "symbol-pos: ") + (let ((eq-fn (pcase-exhaustive mode + ('interpreted without-pos-eq) + ('compiled without-pos-eq-compiled)))) + (should (equal (funcall eq-fn 'sym 'sym) t)) + (should (equal (funcall eq-fn sym-with-pos1 'sym) nil)) + (should (equal (funcall eq-fn 'sym sym-with-pos1) nil)) + (should (equal (funcall eq-fn sym-with-pos1 sym-with-pos1) t)) + (should (equal (funcall eq-fn sym-with-pos1 sym-with-pos2) nil)))) + (ert-info ("enabled" :prefix "symbol-pos: ") + (let ((eq-fn (pcase-exhaustive mode + ('interpreted with-pos-eq) + ('compiled with-pos-eq-compiled)))) + (should (equal (funcall eq-fn 'sym 'sym) t)) + (should (equal (funcall eq-fn sym-with-pos1 'sym) t)) + (should (equal (funcall eq-fn 'sym sym-with-pos1) t)) + (should (equal (funcall eq-fn sym-with-pos1 sym-with-pos1) t)) + (should (equal (funcall eq-fn sym-with-pos1 sym-with-pos2) t)))))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: From 9026990c6685e87c328f4fcc575ef644c2f5595a Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Tue, 1 Aug 2023 18:56:33 +0200 Subject: [PATCH 19/20] Fix thumbnail update when thumb name is based on image content * lisp/image/image-dired-util.el (image-dired-update-thumbnail-at-point): New function to update thumbnail when original image contents changed. * lisp/image/image-dired-external.el (image-dired-rotate-original): Use it. * lisp/image/image-dired.el (image-dired-display-thumbs): Fix spacing while here. (Bug#61394) --- lisp/image/image-dired-external.el | 3 ++- lisp/image/image-dired-util.el | 17 +++++++++++++++++ lisp/image/image-dired.el | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el index 9f35e17a7e6..77352c25a3b 100644 --- a/lisp/image/image-dired-external.el +++ b/lisp/image/image-dired-external.el @@ -405,7 +405,8 @@ The new file will be named THUMBNAIL-FILE." (not image-dired-rotate-original-ask-before-overwrite)) (progn (copy-file image-dired-temp-rotate-image-file file t) - (image-dired-refresh-thumb)) + (image-dired-refresh-thumb) + (image-dired-update-thumbnail-at-point)) (image-dired-display-image file)))))) diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index 70911bce45a..53a5e274175 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -190,6 +190,23 @@ Should be used by commands in `image-dired-thumbnail-mode'." "Return non-nil if there is an `image-dired' thumbnail at point." (get-text-property (point) 'image-dired-thumbnail)) +(defun image-dired-update-thumbnail-at-point () + "Update the thumbnail at point if the original image file has been modified. +This function uncaches and removes the thumbnail file under the old name." + (when (image-dired-image-at-point-p) + (let* ((file (image-dired-original-file-name)) + (thumb (expand-file-name (image-dired-thumb-name file))) + (image (get-text-property (point) 'display))) + (when image + (let ((old-thumb (plist-get (cdr image) :file))) + ;; When 'image-dired-thumb-naming' is set to + ;; 'sha1-contents', 'thumb' and 'old-thumb' could be + ;; different file names. Update the thumbnail then. + (unless (string= thumb old-thumb) + (setf (plist-get (cdr image) :file) thumb) + (clear-image-cache old-thumb) + (delete-file old-thumb))))))) + (defun image-dired-window-width-pixels (window) "Calculate WINDOW width in pixels." (declare (obsolete window-body-width "29.1")) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 98596510ec1..33beb5b3e49 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -590,7 +590,7 @@ used or not. If non-nil, use `display-buffer' instead of `image-dired-previous-line-and-display' where we do not want the thumbnail buffer to be selected." (interactive "P" nil dired-mode) - (setq image-dired--generate-thumbs-start (current-time)) + (setq image-dired--generate-thumbs-start (current-time)) (let ((buf (image-dired-create-thumbnail-buffer)) files dired-buf) (if arg From 60e5f212182ca2f41f89a4315075e38433bc8ac0 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 4 Aug 2023 14:21:17 +0200 Subject: [PATCH 20/20] Add ruff and flake8 to python-check-command * lisp/progmodes/python.el (python-check-command): Add ruff and flake8. --- lisp/progmodes/python.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 52e5a36f4b0..1930f68617c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5214,11 +5214,13 @@ def __FFAP_get_module_path(objstr): (defcustom python-check-command (cond ((executable-find "pyflakes") "pyflakes") + ((executable-find "ruff") "ruff") + ((executable-find "flake8") "flake8") ((executable-find "epylint") "epylint") (t "pyflakes")) "Command used to check a Python file." :type 'string - :version "29.1") + :version "30.1") (defcustom python-check-buffer-name "*Python check: %s*"