commit 360a68ed70fd666b0d6bafa8dee0b5636a490a8c Author: David Ponce Date: Mon Oct 26 18:20:57 2026 +0100 Consolidate calculation of some frame parameters (Bug#81916) * src/frame.c (frame_get_param_value): Consolidate calculation of 'width', 'height' and 'visibility' parameters from their corresponding frame slots (Bug#81916). diff --git a/src/frame.c b/src/frame.c index c83bdd49faf..79eb9c47648 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4266,26 +4266,11 @@ frame_get_param_value (struct frame *f, Lisp_Object parameter) case NAME: return f->name; case WIDTH: - /* It's questionable whether here we should report the value - of f->new_width (and f->new_height below) but we've done - that in the past, so let's keep it. Note that a value of - -1 for either of these means that no new size was - requested. But check f->new_size before to make sure that - f->new_width and f->new_height are not ones requested by - adjust_frame_size. */ - { - int width = ((f->new_size_p && f->new_width >= 0) - ? f->new_width / FRAME_COLUMN_WIDTH (f) - : FRAME_COLS(f)); - return make_fixnum (width); - } + /* Same code as Fframe_text_cols. */ + return make_fixnum (FRAME_COLS (f)); case HEIGHT: - { - int height = ((f->new_size_p && f->new_height >= 0) - ? f->new_height / FRAME_LINE_HEIGHT (f) - : FRAME_LINES (f)); - return make_fixnum (height); - } + /* Same code as Fframe_text_lines. */ + return make_fixnum (FRAME_LINES (f)); case MODELINE: return (FRAME_WANTS_MODELINE_P (f) ? Qt : Qnil); case UNSPLITTABLE: @@ -4295,12 +4280,7 @@ frame_get_param_value (struct frame *f, Lisp_Object parameter) case BURIED_BUFFER_LIST: return f->buried_buffer_list; case VISIBILITY: - if (FRAME_WINDOW_P (f)) - return (FRAME_VISIBLE_P (f) - ? Qt - : (FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); - else - return (FRAME_VISIBLE_P (f) ? Qt : Qnil); + return frame_visible_p (f); /* Convert graphic frame parameters. */ #ifdef HAVE_WINDOW_SYSTEM commit 0a2b16c6b8598a791c21d1b767b4743b1e9e4bfe Author: Eli Zaretskii Date: Mon Oct 26 19:13:18 2026 +0200 Don't accidentally turn on whitespace-mode in image buffers * lisp/whitespace.el (whitespace-global-modes): Don't turn on the global mode in 'image-mode' buffers. (Bug#82060) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index eae11f07984..274d164c870 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -886,7 +886,7 @@ This variable is used when `whitespace-style' includes `tab-mark', (character :tag "Char"))))))) -(defcustom whitespace-global-modes t +(defcustom whitespace-global-modes '(not image-mode) "Modes for which global `whitespace-mode' is automatically turned on. Global `whitespace-mode' is controlled by the command @@ -917,7 +917,8 @@ Use `whitespace-global-mode-buffers' to customize this behavior." :value (not) (const :tag "Except" not) (repeat :inline t - (symbol :tag "Mode"))))) + (symbol :tag "Mode")))) + :version "32.1") (defcustom whitespace-global-mode-buffers (list (rx bos "*scratch*" eos)) "Buffer name regexps where global `whitespace-mode' can be auto-enabled. commit 195537f25d2aa4d7710de5d9eda3174b4916fd7d Author: Martin Rudalics Date: Mon Oct 26 18:04:55 2026 +0100 Make FRAME argument optional for 'frame-visible-p' (Bug#81916) * src/frame.c (frame_visible_p): New function. (Fframe_visible_p): Make FRAME argument optional. Call frame_visible_p. * doc/lispref/frames.texi (Visibility of Frames): Describe FRAME argument for the functions of this section. diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 242b4c8a455..2119d3607b8 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -3611,7 +3611,10 @@ for the first time and whenever it changes its state of visibility from frame is and becomes @dfn{unmapped} whenever it changes its status from @code{visible} to @code{iconified} or @code{invisible}. -@defun frame-visible-p frame +In all functions described in this section the optional @var{frame} +argument has to specify a live frame and defaults to the selected one. + +@defun frame-visible-p &optional frame This function returns the visibility status of frame @var{frame}. The value is @code{t} if @var{frame} is visible, @code{nil} if it is invisible, and @code{icon} if it is iconified. diff --git a/src/frame.c b/src/frame.c index 67a07667d45..c83bdd49faf 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3626,23 +3626,24 @@ for how to proceed. */) return Qnil; } -DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p, - 1, 1, 0, +/* Return t if frame F is "visible", 'icon' if F is iconified, nil + otherwise. */ +static Lisp_Object +frame_visible_p (struct frame *f) +{ + return FRAME_VISIBLE_P (f) ? Qt : FRAME_ICONIFIED_P (f) ? Qicon : Qnil; +} + +DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p, 0, 1, 0, doc: /* Return t if FRAME is \"visible\" (actually in use for display). +FRAME must specify a live frame and defaults to the selected one. Return the symbol `icon' if FRAME is iconified or \"minimized\". Return nil if FRAME was made invisible, via `make-frame-invisible'. On graphical displays, invisible frames are not updated and are usually not displayed at all, even in a window system's \"taskbar\". */) (Lisp_Object frame) { - CHECK_LIVE_FRAME (frame); - struct frame *f = XFRAME (frame); - - if (FRAME_VISIBLE_P (f)) - return Qt; - if (FRAME_ICONIFIED_P (f)) - return Qicon; - return Qnil; + return frame_visible_p (decode_live_frame (frame)); } DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list, commit 2b555e1230ae78be7f4646185d4a1fd81f1905c5 Author: Eli Zaretskii Date: Mon Oct 26 18:55:51 2026 +0200 Fix decoding of DOS CRLF EOL format upon reverting a buffer This fixes the case when there's a lone CR at the very end of a buffer into which we read the file in chunks, and its paired LF was not yet read. * src/coding.c (decode_eol): Handle the case of a lone CR at end of buffer, by delaying its decoding to the next buffer-full. (Bug#82053) diff --git a/src/coding.c b/src/coding.c index 7d2c7040ab8..5d88568267d 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6843,6 +6843,46 @@ decode_eol (struct coding_system *coding) } coding->produced -= n; coding->produced_char -= n; + /* Handle the case of a lone CR at end of buffer that is not the + final chunk of the text we need to decode: we want to leave + such a CR to the next chunk, in case it begins with an LF. */ + if (!(coding->mode & CODING_MODE_LAST_BLOCK) + && FETCH_BYTE (pos_end) == '\r') + { + /* With UTF-16, we could have one byte of carryover that + belongs to the next LF. */ + if (EQ (CODING_ATTR_TYPE (CODING_ID_ATTRS (coding->id)), Qutf_16) + && coding->carryover_bytes <= 1) + { + /* Pretend we didn't process that CR, by pushing it back + in the correct byte order. */ + if (CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian) + { + coding->carryover[coding->carryover_bytes++] = '\0'; + coding->carryover[coding->carryover_bytes++] = '\r'; + } + else + { + coding->carryover[coding->carryover_bytes++] = '\r'; + coding->carryover[coding->carryover_bytes++] = '\0'; + } + coding->consumed -= 2; + coding->consumed_char--; + } + else if (coding->carryover_bytes == 0) + { + /* Pretend we didn't process that CR. */ + coding->carryover[coding->carryover_bytes++] = '\r'; + coding->consumed--; + coding->consumed_char--; + } + coding->produced--; + coding->produced_char--; + /* Delete that CR from the destination buffer. */ + pos = coding->dst_pos + coding->produced_char; + del_range_2 (pos, pos_end, pos + 1, pos_end + 1, 0); + record_conversion_result (coding, CODING_RESULT_INSUFFICIENT_SRC); + } } } commit d595c697966280250417b035585e891b4cbe7bc8 Author: Eli Zaretskii Date: Mon Oct 26 18:05:56 2026 +0200 ; Skip a new VC test on MS-Windows * test/lisp/vc/vc-tests/vc-test-misc.el (vc-test-dired-rename-file-between-repos): Skip the new test on MS-Windows. diff --git a/test/lisp/vc/vc-tests/vc-test-misc.el b/test/lisp/vc/vc-tests/vc-test-misc.el index b45eaebb166..8281c83f439 100644 --- a/test/lisp/vc/vc-tests/vc-test-misc.el +++ b/test/lisp/vc/vc-tests/vc-test-misc.el @@ -790,22 +790,24 @@ See bug#80803 and bug#80967." '(nil unregistered)))) (reset) - ;; Test moving a symbolic link. - (create-repo 'Git git1 "foo.txt") - (let ((default-directory git1)) - (make-symbolic-link "foo.txt" "link") - (vc-register '(Git ("link"))) - (vc-checkin '("link") 'Git) - (insert "Link creation") - (log-edit-done)) - (create-repo 'Git git2 "bar.txt") - (do-rename "git1/" "link" "../git2/baz.txt" nil) - (let ((default-directory git1)) - (should (eq (vc-state "link" 'Git) 'removed)) - (should-not (file-exists-p "link"))) - (let ((default-directory git2)) - (should (file-symlink-p "baz.txt")) - (should (eq (vc-state "baz.txt" 'Git) 'added))))))))) + ;; Test moving a symbolic link. Symlinks are unreliable on + ;; MS-Windows, so skip this in that case. + (unless (eq system-type 'windows-nt) + (create-repo 'Git git1 "foo.txt") + (let ((default-directory git1)) + (make-symbolic-link "foo.txt" "link") + (vc-register '(Git ("link"))) + (vc-checkin '("link") 'Git) + (insert "Link creation") + (log-edit-done)) + (create-repo 'Git git2 "bar.txt") + (do-rename "git1/" "link" "../git2/baz.txt" nil) + (let ((default-directory git1)) + (should (eq (vc-state "link" 'Git) 'removed)) + (should-not (file-exists-p "link"))) + (let ((default-directory git2)) + (should (file-symlink-p "baz.txt")) + (should (eq (vc-state "baz.txt" 'Git) 'added)))))))))) (provide 'vc-test-misc) ;;; vc-test-misc.el ends here commit 1dabac5d402fdd7448c7258710d09303d593285e Author: Sean Whitton Date: Mon Oct 26 11:36:02 2026 +0000 dired-rename-file: Handle VC-committed symbolic links better * lisp/dired-aux.el (dired-rename-file): Don't copy the target of a symlink between repositories. * test/lisp/vc/vc-tests/vc-test-misc.el (vc-test-dired-rename-file-between-repos): Test this case. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 6f46793387a..9afb4a539ec 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2397,10 +2397,17 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (throw 'done nil))) t)) (rename-file file newname ok-if-already-exists) - (if file-is-dir-p - (copy-directory file newname t) - (copy-file file newname ok-if-already-exists t t t)) - (vc-delete-file file 'noconfirm)) + (let ((target (file-attribute-type + (file-attributes file)))) + (cond ((stringp target) + (make-symbolic-link target newname + ok-if-already-exists)) + (file-is-dir-p + (copy-directory file newname t)) + (t + (copy-file file newname + ok-if-already-exists t t t))) + (vc-delete-file file 'noconfirm))) (when newname-backend (let ((newname (expand-file-name newname newname-root)) (default-directory newname-root)) diff --git a/test/lisp/vc/vc-tests/vc-test-misc.el b/test/lisp/vc/vc-tests/vc-test-misc.el index 1e1f9c6a0c5..b45eaebb166 100644 --- a/test/lisp/vc/vc-tests/vc-test-misc.el +++ b/test/lisp/vc/vc-tests/vc-test-misc.el @@ -787,7 +787,25 @@ See bug#80803 and bug#80967." (let ((default-directory git2)) (should (file-exists-p "sub/bar.txt")) (should (memq (vc-state "sub/bar.txt" 'Git) - '(nil unregistered)))))))))) + '(nil unregistered)))) + (reset) + + ;; Test moving a symbolic link. + (create-repo 'Git git1 "foo.txt") + (let ((default-directory git1)) + (make-symbolic-link "foo.txt" "link") + (vc-register '(Git ("link"))) + (vc-checkin '("link") 'Git) + (insert "Link creation") + (log-edit-done)) + (create-repo 'Git git2 "bar.txt") + (do-rename "git1/" "link" "../git2/baz.txt" nil) + (let ((default-directory git1)) + (should (eq (vc-state "link" 'Git) 'removed)) + (should-not (file-exists-p "link"))) + (let ((default-directory git2)) + (should (file-symlink-p "baz.txt")) + (should (eq (vc-state "baz.txt" 'Git) 'added))))))))) (provide 'vc-test-misc) ;;; vc-test-misc.el ends here commit 1a13e1f1bcdf2eb95445f1e2cff4e367ea862247 Author: Sean Whitton Date: Mon Oct 26 10:37:33 2026 +0000 ; Fix comment again, based on my testing. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index beec82ccd7b..6f46793387a 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2387,8 +2387,8 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (error "Please commit or undo your changes before moving %s" file)) (let ((already-exists (file-exists-p newname))) - ;; The delete commands for several VCS (at least Bzr, Git - ;; and Mercurial) will fail if asked to remove a directory + ;; The delete commands for several VCS (at least Git and + ;; Mercurial) will fail if asked to remove a directory ;; containing only untracked files. See `vc-rename-file' ;; which resolves a similar issue in the same way. (if (and file-is-dir-p commit c04f343798370a1306c6663e38ccddde89101182 Author: Sean Whitton Date: Mon Oct 26 10:31:19 2026 +0000 dired-rename-file: Pass all copy preservation options * lisp/dired-aux.el (dired-rename-file): Pass all preservation options to copy-directory and copy-file. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 79cbf1dbc96..beec82ccd7b 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2398,8 +2398,8 @@ unless OK-IF-ALREADY-EXISTS is non-nil." t)) (rename-file file newname ok-if-already-exists) (if file-is-dir-p - (copy-directory file newname) - (copy-file file newname ok-if-already-exists)) + (copy-directory file newname t) + (copy-file file newname ok-if-already-exists t t t)) (vc-delete-file file 'noconfirm)) (when newname-backend (let ((newname (expand-file-name newname newname-root)) commit 402482ada962016903364c4624aed30af90ce8e3 Author: Sean Whitton Date: Mon Oct 26 10:25:35 2026 +0000 dired-rename-file: Don't allow moving edited files between repos * lisp/dired-aux.el (dired-rename-file): Don't allow moving edited files between repositories. * test/lisp/vc/vc-tests/vc-test-misc.el (vc-test-dired-rename-file-between-repos): Test this case. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 37702a8b471..79cbf1dbc96 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2383,6 +2383,9 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (file-name-directory newname))))) (if (equal file-root newname-root) (vc-rename-file file newname ok-if-already-exists) + (when (eq (vc-state file) 'edited) + (error "Please commit or undo your changes before moving %s" + file)) (let ((already-exists (file-exists-p newname))) ;; The delete commands for several VCS (at least Bzr, Git ;; and Mercurial) will fail if asked to remove a directory diff --git a/test/lisp/vc/vc-tests/vc-test-misc.el b/test/lisp/vc/vc-tests/vc-test-misc.el index 75ee57117c9..1e1f9c6a0c5 100644 --- a/test/lisp/vc/vc-tests/vc-test-misc.el +++ b/test/lisp/vc/vc-tests/vc-test-misc.el @@ -700,6 +700,14 @@ See bug#80803 and bug#80967." (should (eq (vc-state "foo.txt" 'Git) 'removed))) (reset) + ;; Try to move an edited file. + (create-repo 'Git git1 "foo.txt") + (create-repo 'Git git2 "bar.txt") + (write-region "foo" nil "git1/foo.txt") + (should-error (do-rename "git1/" "foo.txt" + "../git2/baz.txt" nil)) + (reset) + ;; Test moving between repos with the same backend. (create-repo 'Git git1 "foo.txt") (create-repo 'Git git2 "bar.txt") commit 65aecf7b3a90ec8f72aef1916db9f750faf6f382 Author: Sean Whitton Date: Mon Oct 26 09:50:15 2026 +0000 ; * lisp/dired-aux.el (dired-rename-file): Fix last change. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index ba41119e09e..37702a8b471 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2384,10 +2384,10 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (if (equal file-root newname-root) (vc-rename-file file newname ok-if-already-exists) (let ((already-exists (file-exists-p newname))) - ;; The rename commands for several VCS (at least Bzr, Git - ;; and Mercurial) will fail if asked to move a directory + ;; The delete commands for several VCS (at least Bzr, Git + ;; and Mercurial) will fail if asked to remove a directory ;; containing only untracked files. See `vc-rename-file' - ;; which resolves the same issue in the same way. + ;; which resolves a similar issue in the same way. (if (and file-is-dir-p (catch 'done (vc-file-tree-walk file (lambda (_) commit 4641194a7619bc08636f0621d69cf04b73267e50 Author: Sean Whitton Date: Mon Oct 26 09:43:18 2026 +0000 vc-annotate-show-log-revision-at-line: Pop to the buffer immediately * lisp/vc/vc-annotate.el (vc-annotate-show-log-revision-at-line): Pop to *vc-change-log* immediately if it exists. diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 42dbbbbe9d2..4cc8cf121ef 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -585,26 +585,23 @@ the file in question, search for the log entry required and move point." (let ((backend vc-annotate-backend) (log-buf (get-buffer "*vc-change-log*")) ;; No need to follow renames: we specify the historical file name. - vc-git-print-log-follow - pos) - (if (and - log-buf - ;; Look for a log buffer that already displays the correct file. - (with-current-buffer log-buf - (and (eq backend log-view-vc-backend) - (null (cdr log-view-vc-fileset)) - (string= (car log-view-vc-fileset) (cdr rev-at-line)) - ;; Check if the entry we require can be found. - (vc-call-backend - backend 'show-log-entry (car rev-at-line)) - (setq pos (point))))) - (progn - (pop-to-buffer log-buf) - (goto-char pos)) - ;; Ask the backend to display a single log entry. - (vc-print-log-internal - vc-annotate-backend (list (cdr rev-at-line)) - (car rev-at-line) t 1))))))) + vc-git-print-log-follow) + ;; Look for a log buffer that already displays the correct + ;; file. Pop to it immediately because the backend function + ;; might call `recenter-top-bottom'. If it turns out this log + ;; is useless and we have to call `vc-print-log-internal', the + ;; buffer will be reused, so it's fine that we popped to it. + (unless (and log-buf + (with-current-buffer (pop-to-buffer log-buf) + (and (eq backend log-view-vc-backend) + (null (cdr log-view-vc-fileset)) + (equal (car log-view-vc-fileset) + (cdr rev-at-line)) + (vc-call-backend backend 'show-log-entry + (car rev-at-line))))) + (vc-print-log-internal vc-annotate-backend + (list (cdr rev-at-line)) + (car rev-at-line) t 1))))))) (defun vc-annotate-show-diff-revision-at-line-internal (filediff) (defvar vc-allow-async-diff)