commit a7d2aa7e0c1a0984d6d1a3563b407efda123d6ae (HEAD, refs/remotes/origin/master) Author: Stephen Gildea Date: Wed Mar 19 21:03:54 2025 -0700 ; * etc/symbol-releases.eld: Add time-stamp, from my notes diff --git a/etc/symbol-releases.eld b/etc/symbol-releases.eld index 9732f60fc16..ca0f98b86f7 100644 --- a/etc/symbol-releases.eld +++ b/etc/symbol-releases.eld @@ -50,6 +50,8 @@ ("22.1" fun version<=) ("22.1" fun read-number) ("21.1" var text-property-default-nonsticky) + ("20.3" var time-stamp-pattern) + ("19.16" fun time-stamp) ;; Since much of early Emacs source history is lost, these versions are ;; conservative estimates: the actual version of first appearance may very commit f38f4588d7bb5dee9f6a5adc1b29bd457c70c7b2 Author: Po Lu Date: Thu Mar 20 10:21:03 2025 +0800 ; * java/org/gnu/emacs/EmacsInputConnection.java: Fix commentary typo. diff --git a/java/org/gnu/emacs/EmacsInputConnection.java b/java/org/gnu/emacs/EmacsInputConnection.java index dafeebca4d6..b872212d9eb 100644 --- a/java/org/gnu/emacs/EmacsInputConnection.java +++ b/java/org/gnu/emacs/EmacsInputConnection.java @@ -83,9 +83,9 @@ public final class EmacsInputConnection implements InputConnection extractAbsoluteOffsets = syncAfterCommit = true; /* The Samsung and Vivo keyboards take `selectionStart' at face - value if some text is returned, and also searches for words - solely within that text. However, when no text is returned, it - falls back to getTextAfterCursor and getTextBeforeCursor. */ + value if some text is returned, and also search for words solely + within that text. However, when no text is returned, it falls + back to getTextAfterCursor and getTextBeforeCursor. */ if (Build.MANUFACTURER.equalsIgnoreCase ("Samsung") || Build.MANUFACTURER.equalsIgnoreCase ("Vivo")) extractAbsoluteOffsets = true; commit 3488ae7c5295bb2385d65f1e7e470bd727f6b408 Author: Stefan Kangas Date: Thu Mar 20 02:38:58 2025 +0100 Recenter calendar-chinese-year-cache on 2028 * lisp/calendar/cal-china.el (calendar-chinese-year-cache): Recenter on 2028. diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el index 0671b3a16d3..776d1d287bf 100644 --- a/lisp/calendar/cal-china.el +++ b/lisp/calendar/cal-china.el @@ -298,38 +298,7 @@ Gregorian year Y-1 to the Chinese month of the solstice of Gregorian year Y." (defvar calendar-chinese-year-cache ;; Maintainers: delete existing value, position point at start of ;; empty line, then call M-: (calendar-chinese-year-cache-init N) - '((2005 (12 731956) (1 731986) (2 732015) (3 732045) (4 732074) (5 732104) - (6 732133) (7 732163) (8 732193) (9 732222) (10 732252) (11 732281)) - (2006 (12 732311) (1 732340) (2 732370) (3 732399) (4 732429) (5 732458) - (6 732488) (7 732517) (7.5 732547) (8 732576) (9 732606) (10 732636) - (11 732665)) - (2007 (12 732695) (1 732725) (2 732754) (3 732783) (4 732813) (5 732842) - (6 732871) (7 732901) (8 732930) (9 732960) (10 732990) (11 733020)) - (2008 (12 733049) (1 733079) (2 733109) (3 733138) (4 733167) (5 733197) - (6 733226) (7 733255) (8 733285) (9 733314) (10 733344) (11 733374)) - (2009 (12 733403) (1 733433) (2 733463) (3 733493) (4 733522) (5 733551) - (5.5 733581) (6 733610) (7 733639) (8 733669) (9 733698) (10 733728) - (11 733757)) - (2010 (12 733787) (1 733817) (2 733847) (3 733876) (4 733906) (5 733935) - (6 733965) (7 733994) (8 734023) (9 734053) (10 734082) (11 734112)) - (2011 (12 734141) (1 734171) (2 734201) (3 734230) (4 734260) (5 734290) - (6 734319) (7 734349) (8 734378) (9 734407) (10 734437) (11 734466)) - (2012 (12 734496) (1 734525) (2 734555) (3 734584) (4 734614) (4.5 734644) - (5 734673) (6 734703) (7 734732) (8 734762) (9 734791) (10 734821) - (11 734850)) - (2013 (12 734880) (1 734909) (2 734939) (3 734968) (4 734998) (5 735027) - (6 735057) (7 735087) (8 735116) (9 735146) (10 735175) (11 735205)) - (2014 (12 735234) (1 735264) (2 735293) (3 735323) (4 735352) (5 735382) - (6 735411) (7 735441) (8 735470) (9 735500) (9.5 735530) (10 735559) - (11 735589)) - (2015 (12 735618) (1 735648) (2 735677) (3 735707) (4 735736) (5 735765) - (6 735795) (7 735824) (8 735854) (9 735884) (10 735914) (11 735943)) - (2016 (12 735973) (1 736002) (2 736032) (3 736061) (4 736091) (5 736120) - (6 736149) (7 736179) (8 736208) (9 736238) (10 736268) (11 736297)) - (2017 (12 736327) (1 736357) (2 736386) (3 736416) (4 736445) (5 736475) - (6 736504) (6.5 736533) (7 736563) (8 736592) (9 736622) (10 736651) - (11 736681)) - (2018 (12 736711) (1 736741) (2 736770) (3 736800) (4 736829) (5 736859) + '((2018 (12 736711) (1 736741) (2 736770) (3 736800) (4 736829) (5 736859) (6 736888) (7 736917) (8 736947) (9 736976) (10 737006) (11 737035)) (2019 (12 737065) (1 737095) (2 737125) (3 737154) (4 737184) (5 737213) (6 737243) (7 737272) (8 737301) (9 737331) (10 737360) (11 737389)) @@ -347,7 +316,37 @@ Gregorian year Y-1 to the Chinese month of the solstice of Gregorian year Y." (6 739073) (7 739102) (8 739132) (9 739162) (10 739191) (11 739221)) (2025 (12 739251) (1 739280) (2 739310) (3 739339) (4 739369) (5 739398) (6 739427) (6.5 739457) (7 739486) (8 739516) (9 739545) (10 739575) - (11 739605))) + (11 739605)) + (2026 (12 739635) (1 739664) (2 739694) (3 739723) (4 739753) (5 739782) + (6 739811) (7 739841) (8 739870) (9 739899) (10 739929) (11 739959)) + (2027 (12 739989) (1 740018) (2 740048) (3 740078) (4 740107) (5 740137) + (6 740166) (7 740195) (8 740225) (9 740254) (10 740283) (11 740313)) + (2028 (12 740343) (1 740372) (2 740402) (3 740432) (4 740462) (5 740491) + (5.5 740521) (6 740550) (7 740579) (8 740609) (9 740638) (10 740667) + (11 740697)) + (2029 (12 740727) (1 740756) (2 740786) (3 740816) (4 740845) (5 740875) + (6 740904) (7 740934) (8 740963) (9 740993) (10 741022) (11 741051)) + (2030 (12 741081) (1 741111) (2 741140) (3 741170) (4 741199) (5 741229) + (6 741259) (7 741288) (8 741318) (9 741347) (10 741377) (11 741406)) + (2031 (12 741436) (1 741465) (2 741494) (3 741524) (3.5 741554) (4 741583) + (5 741613) (6 741642) (7 741672) (8 741702) (9 741731) (10 741761) + (11 741790)) + (2032 (12 741820) (1 741849) (2 741879) (3 741908) (4 741937) (5 741967) + (6 741996) (7 742026) (8 742056) (9 742085) (10 742115) (11 742145)) + (2033 (12 742174) (1 742204) (2 742233) (3 742263) (4 742292) (5 742321) + (6 742351) (7 742380) (8 742410) (9 742439) (10 742469) (11 742499)) + (2034 (11.5 742529) (12 742558) (1 742588) (2 742617) (3 742647) (4 742676) + (5 742705) (6 742735) (7 742764) (8 742794) (9 742823) (10 742853) + (11 742883)) + (2035 (12 742912) (1 742942) (2 742972) (3 743001) (4 743031) (5 743060) + (6 743089) (7 743119) (8 743148) (9 743177) (10 743207) (11 743237)) + (2036 (12 743266) (1 743296) (2 743326) (3 743356) (4 743385) (5 743415) + (6 743444) (6.5 743473) (7 743503) (8 743532) (9 743561) (10 743591) + (11 743620)) + (2037 (12 743650) (1 743680) (2 743710) (3 743740) (4 743769) (5 743799) + (6 743828) (7 743857) (8 743887) (9 743916) (10 743945) (11 743975)) + (2038 (12 744004) (1 744034) (2 744064) (3 744094) (4 744123) (5 744153) + (6 744182) (7 744212) (8 744241) (9 744271) (10 744300) (11 744329))) "Alist of Chinese year structures as determined by `chinese-year'. The default can be nil, but some values are precomputed for efficiency.") commit 03053baebee8a89f1b1d470a6173b9f1e80f0b39 Author: Stefan Kangas Date: Wed Mar 19 21:24:56 2025 +0100 ; Improve documentation of incf and decf * doc/lispref/variables.texi (Setting Generalized Variables): Mention incf and decf. * lisp/emacs-lisp/gv.el (incf, decf): Add references to Info manual documentation on generalized variables. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 39f3095bb9c..f0ba2c329ce 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2920,6 +2920,10 @@ the list stored in @var{place}. It is analogous to @code{(setf subforms. Note that @code{push} and @code{pop} on an @code{nthcdr} place can be used to insert or delete at any position in a list. +Similarly, the macros @code{incf} and @code{decf} (@pxref{Arithmetic +Operations}) can be used to increment or decrement generalized +variables that are numbers. + The @file{cl-lib} library defines various extensions for generalized variables, including additional @code{setf} places. @xref{Generalized Variables,,, cl, Common Lisp Extensions}. diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 8e69c8d0447..b44f7dc87f3 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -317,11 +317,14 @@ The return value is the last VAL in the list. ;;;###autoload (defmacro incf (place &optional delta) - "Increment PLACE by DELTA (default to 1). + "Increment generalized variable PLACE by DELTA (default to 1). The DELTA is first added to PLACE, and then stored in PLACE. Return the incremented value of PLACE. +For more information about generalized variables, see Info node +`(elisp) Generalized Variables'. + See also `decf'." (declare (debug (gv-place &optional form))) (gv-letplace (getter setter) place @@ -329,11 +332,14 @@ See also `decf'." ;;;###autoload (defmacro decf (place &optional delta) - "Decrement PLACE by DELTA (default to 1). + "Decrement generalized variable PLACE by DELTA (default to 1). The DELTA is first subtracted from PLACE, and then stored in PLACE. Return the decremented value of PLACE. +For more information about generalized variables, see Info node +`(elisp) Generalized Variables'. + See also `incf'." (declare (debug (gv-place &optional form))) (gv-letplace (getter setter) place commit 1fca171addd830fab78fb7cc1c73c43cd7d7a2e9 Author: Stefan Kangas Date: Wed Mar 19 21:02:30 2025 +0100 ; Delete duplicate variable definition * lisp/doc-view.el (doc-view--current-cache-dir): Delete duplicate variable definition. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9cc55529440..0a6bfea22cb 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -321,9 +321,6 @@ stylesheet is switched, or its contents modified." :version "29.1" :set #'doc-view-custom-set-epub-user-stylesheet) -(defvar-local doc-view--current-cache-dir nil - "Only used internally.") - (defun doc-view-custom-set-epub-font-size (option-name new-value) (set-default option-name new-value) (doc-view--epub-reconvert)) commit 5432331a62522c096246ef995a5b41dc067d25a9 Author: Stefan Monnier Date: Wed Mar 19 15:47:11 2025 -0400 indent.erts (Code): Don't modify the global state * test/lisp/progmodes/java-ts-mode-resources/indent.erts (Code): Use `setq-local` and correspondingly move the remaining assignment after activating the major mode. diff --git a/test/lisp/progmodes/java-ts-mode-resources/indent.erts b/test/lisp/progmodes/java-ts-mode-resources/indent.erts index 180f4358a0a..bc0ba3b9373 100644 --- a/test/lisp/progmodes/java-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/java-ts-mode-resources/indent.erts @@ -1,8 +1,8 @@ Code: (lambda () - (setq java-ts-mode-indent-offset 4) (java-ts-mode) - (setq indent-tabs-mode nil) + (setq-local java-ts-mode-indent-offset 4) + (setq-local indent-tabs-mode nil) (indent-region (point-min) (point-max))) Point-Char: | commit beeece4712c464a6eb62c8e9b72c6f7515614f6c Author: Stefan Kangas Date: Wed Mar 19 20:44:19 2025 +0100 ; Don't set symbol-packages in tty-tip.el diff --git a/lisp/tty-tip.el b/lisp/tty-tip.el index d738ff9ed92..254591f6b7c 100644 --- a/lisp/tty-tip.el +++ b/lisp/tty-tip.el @@ -1,4 +1,4 @@ -;;; tty-tip.el --- Display help in kind of tooltips on ttys -*- lexical-binding: t; symbol-packages: t; -*- +;;; tty-tip.el --- Display help in kind of tooltips on ttys -*- lexical-binding: t -*- ;; Copyright (C) 2024-2025 Free Software Foundation, Inc. commit 7016d1c8e3c16e8bfb61ce8ef96d85490a00c2eb Author: Juri Linkov Date: Wed Mar 19 21:09:10 2025 +0200 * lisp/files.el (save-some-buffers-action-alist): Fix 'view-mode'. Use 'view-mode-enter' instead of 'view-buffer' to ignore the 'special' mode-class that prevents some modes from binding 'q' to 'exit-action' that should call 'exit-recursive-edit' (bug#76745). diff --git a/lisp/files.el b/lisp/files.el index f85021f0d69..461960d6f2b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6288,7 +6288,10 @@ Before and after saving the buffer, this function runs (if (not enable-recursive-minibuffers) (progn (display-buffer buf) (setq other-window-scroll-buffer buf)) - (view-buffer buf (lambda (_) (exit-recursive-edit))) + ;; Like 'view-buffer' but ignore 'special' mode-class + ;; because 'q' should call 'exit-action' in any case: + (switch-to-buffer buf) + (view-mode-enter nil (lambda (_) (exit-recursive-edit))) (recursive-edit)) ;; Return nil to ask about BUF again. nil) @@ -6307,7 +6310,10 @@ Before and after saving the buffer, this function runs (if (not enable-recursive-minibuffers) (progn (display-buffer diffbuf) (setq other-window-scroll-buffer diffbuf)) - (view-buffer diffbuf (lambda (_) (exit-recursive-edit))) + ;; Like 'view-buffer' but ignore 'special' mode-class + ;; because 'q' should call 'exit-action' in any case: + (switch-to-buffer diffbuf) + (view-mode-enter nil (lambda (_) (exit-recursive-edit))) (recursive-edit)))) ;; Return nil to ask about BUF again. nil) commit a77f10305c9ad0354987b09ec9a967021bb47d93 Author: Philip Kaludercic Date: Wed Mar 19 18:33:01 2025 +0100 ; Avoid scraping non-readable files for maintainers * lisp/mail/emacsbug.el (submit-emacs-patch): Check if a file mentioned in a patch can be opened. (Bug#77083) diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index babfd2e68ae..ad6f1b7a58b 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -543,10 +543,11 @@ Message buffer where you can explain more about the patch." (with-temp-buffer (insert-file-contents file) (while (search-forward-regexp "^\\+\\{3\\} ./\\(.*\\)" nil t) - (push (expand-file-name - (match-string-no-properties 1) - source-directory) - files))) + (let ((file (expand-file-name + (match-string-no-properties 1) + source-directory))) + (when (file-readable-p file) + (push file files))))) (mapcan (lambda (patch) (seq-remove commit cf5aaae90bd3961171e9edef6ee1f97b98c266a6 Author: shipmints Date: Wed Mar 19 16:58:55 2025 +0100 Promote bookmark-handler prop 'bookmark-inhibit to list (bug#65039) * lisp/bookmark.el (bookmark-insert): * lisp/shell.el (#'shell-bookmark-jump): The bookmark-handler property 'bookmark-inhibit is now a list. diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 99bb26e83cc..0de42bcea51 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1523,8 +1523,8 @@ name." (defun bookmark-insert (bookmark-name) "Insert the text of the file pointed to by bookmark BOOKMARK-NAME. BOOKMARK-NAME is a bookmark name (a string), not a bookmark record. -Refuse to insert bookmarks whose handlers have the property -`bookmark-inhibit' eq `insert'. +Refuse to insert bookmarks if its handler's property `bookmark-inhibit', +which is a list, contains `insert'. You may have a problem using this function if the value of variable `bookmark-alist' is nil. If that happens, you need to load in some @@ -1533,9 +1533,9 @@ this." (interactive (list (bookmark-completing-read "Insert bookmark contents"))) (bookmark-maybe-historicize-string bookmark-name) (bookmark-maybe-load-default-file) - (if (eq 'insert (get (or (bookmark-get-handler bookmark-name) - #'bookmark-default-handler) - 'bookmark-inhibit)) + (if (memq 'insert (get (or (bookmark-get-handler bookmark-name) + #'bookmark-default-handler) + 'bookmark-inhibit)) (error "Insert not supported for bookmark %s" bookmark-name) (let ((orig-point (point)) (str-to-insert diff --git a/lisp/shell.el b/lisp/shell.el index a35a0840651..09d4161ba7a 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1985,7 +1985,7 @@ be created if necessary, and new remote connections are inhibited." (delq (assoc "7" ansi-osc-handlers) ; ansi-osc-directory-tracker ansi-osc-handlers)))))) (put #'shell-bookmark-jump 'bookmark-handler-type "Shell") -(put #'shell-bookmark-jump 'bookmark-inhibit 'insert) +(put #'shell-bookmark-jump 'bookmark-inhibit '(insert)) (provide 'shell) commit f6632114fe661930c45b5e9c1bf66644be095ff9 Author: Michael Albinus Date: Wed Mar 19 14:40:54 2025 +0100 ; Tramp: fixes resulting from test campaign * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Handle symlinks. * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file): STDERR is not implemented. * lisp/net/tramp.el (tramp-skeleton-process-file): Raise a warning if STDERR is not implemented. (tramp-handle-shell-command): Respect `async-shell-command-display-buffer'. * test/lisp/net/tramp-tests.el (tramp-test28-process-file): Adapt test. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index eff7a2d9ff8..d1f806bf7c6 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1051,100 +1051,106 @@ file names." (progn (copy-directory filename newname keep-date t) (when (eq op 'rename) (delete-directory filename 'recursive))) + (if (file-symlink-p filename) + (progn + (make-symbolic-link + (file-symlink-p filename) newname ok-if-already-exists) + (when (eq op 'rename) (delete-file filename))) + + (let ((t1 (tramp-tramp-file-p filename)) + (t2 (tramp-tramp-file-p newname)) + (equal-remote (tramp-equal-remote filename newname)) + (volatile + (and (eq op 'rename) (tramp-gvfs-file-name-p filename) + (equal + (cdr + (assoc + "standard::is-volatile" + (tramp-gvfs-get-file-attributes filename))) + "TRUE"))) + ;; "gvfs-rename" is not trustworthy. + (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move")) + (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) + + (with-parsed-tramp-file-name (if t1 filename newname) nil + (tramp-barf-if-file-missing v filename + (when (and (not ok-if-already-exists) (file-exists-p newname)) + (tramp-error v 'file-already-exists newname)) + (when (and (file-directory-p newname) + (not (directory-name-p newname))) + (tramp-error v 'file-error "File is a directory %s" newname)) + (when (file-regular-p newname) + (delete-file newname)) - (let ((t1 (tramp-tramp-file-p filename)) - (t2 (tramp-tramp-file-p newname)) - (equal-remote (tramp-equal-remote filename newname)) - (volatile - (and (eq op 'rename) (tramp-gvfs-file-name-p filename) - (equal - (cdr - (assoc - "standard::is-volatile" - (tramp-gvfs-get-file-attributes filename))) - "TRUE"))) - ;; "gvfs-rename" is not trustworthy. - (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move")) - (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) - - (with-parsed-tramp-file-name (if t1 filename newname) nil - (tramp-barf-if-file-missing v filename - (when (and (not ok-if-already-exists) (file-exists-p newname)) - (tramp-error v 'file-already-exists newname)) - (when (and (file-directory-p newname) - (not (directory-name-p newname))) - (tramp-error v 'file-error "File is a directory %s" newname)) - (when (file-regular-p newname) - (delete-file newname)) - - (cond - ;; We cannot rename volatile files, as used by Google-drive. - ((and (not equal-remote) volatile) - (prog1 (copy-file - filename newname ok-if-already-exists keep-date - preserve-uid-gid preserve-extended-attributes) - (delete-file filename))) - - ;; We cannot copy or rename directly. - ((or (and equal-remote - (tramp-get-connection-property v "direct-copy-failed")) - (and t1 (not (tramp-gvfs-file-name-p filename))) - (and t2 (not (tramp-gvfs-file-name-p newname)))) - (let ((tmpfile (tramp-compat-make-temp-file filename))) - (if (eq op 'copy) - (copy-file - filename tmpfile t keep-date preserve-uid-gid - preserve-extended-attributes) - (rename-file filename tmpfile t)) - (rename-file tmpfile newname ok-if-already-exists))) - - ;; Direct action. - (t (with-tramp-progress-reporter - v 0 (format "%s %s to %s" msg-operation filename newname) - (unless - (and (apply - #'tramp-gvfs-send-command v gvfs-operation - (append - (and (eq op 'copy) (or keep-date preserve-uid-gid) - '("--preserve")) - (list - (tramp-gvfs-url-file-name filename) - (tramp-gvfs-url-file-name newname)))) - ;; Some backends do not return a proper error - ;; code in case of direct copy/move. Apply - ;; sanity checks. - (or (not equal-remote) - (and - (tramp-gvfs-info newname) - (or (eq op 'copy) - (not (tramp-gvfs-info filename)))))) - - (if (or (not equal-remote) - (and equal-remote - (tramp-get-connection-property - v "direct-copy-failed"))) - ;; Propagate the error. - (with-current-buffer (tramp-get-connection-buffer v) - (goto-char (point-min)) - (tramp-error-with-buffer - nil v 'file-error - "%s failed, see buffer `%s' for details" - msg-operation (buffer-name))) - - ;; Some WebDAV server, like the one from QNAP, do - ;; not support direct copy/move. Try a fallback. - (tramp-set-connection-property v "direct-copy-failed" t) - (tramp-gvfs-do-copy-or-rename-file - op filename newname ok-if-already-exists keep-date - preserve-uid-gid preserve-extended-attributes)))) - - (when (and t1 (eq op 'rename)) - (with-parsed-tramp-file-name filename nil - (tramp-flush-file-properties v localname))) - - (when t2 - (with-parsed-tramp-file-name newname nil - (tramp-flush-file-properties v localname)))))))))) + (cond + ;; We cannot rename volatile files, as used by Google-drive. + ((and (not equal-remote) volatile) + (prog1 (copy-file + filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-extended-attributes) + (delete-file filename))) + + ;; We cannot copy or rename directly. + ((or (and equal-remote + (tramp-get-connection-property v "direct-copy-failed")) + (and t1 (not (tramp-gvfs-file-name-p filename))) + (and t2 (not (tramp-gvfs-file-name-p newname)))) + (let ((tmpfile (tramp-compat-make-temp-file filename))) + (if (eq op 'copy) + (copy-file + filename tmpfile t keep-date preserve-uid-gid + preserve-extended-attributes) + (rename-file filename tmpfile t)) + (rename-file tmpfile newname ok-if-already-exists))) + + ;; Direct action. + (t (with-tramp-progress-reporter + v 0 (format "%s %s to %s" msg-operation filename newname) + (unless + (and (apply + #'tramp-gvfs-send-command v gvfs-operation + (append + (and (eq op 'copy) (or keep-date preserve-uid-gid) + '("--preserve")) + (list + (tramp-gvfs-url-file-name filename) + (tramp-gvfs-url-file-name newname)))) + ;; Some backends do not return a proper + ;; error code in case of direct copy/move. + ;; Apply sanity checks. + (or (not equal-remote) + (and + (tramp-gvfs-info newname) + (or (eq op 'copy) + (not (tramp-gvfs-info filename)))))) + + (if (or (not equal-remote) + (and equal-remote + (tramp-get-connection-property + v "direct-copy-failed"))) + ;; Propagate the error. + (with-current-buffer (tramp-get-connection-buffer v) + (goto-char (point-min)) + (tramp-error-with-buffer + nil v 'file-error + "%s failed, see buffer `%s' for details" + msg-operation (buffer-name))) + + ;; Some WebDAV server, like the one from QNAP, + ;; do not support direct copy/move. Try a + ;; fallback. + (tramp-set-connection-property v "direct-copy-failed" t) + (tramp-gvfs-do-copy-or-rename-file + op filename newname ok-if-already-exists keep-date + preserve-uid-gid preserve-extended-attributes)))) + + (when (and t1 (eq op 'rename)) + (with-parsed-tramp-file-name filename nil + (tramp-flush-file-properties v localname))) + + (when t2 + (with-parsed-tramp-file-name newname nil + (tramp-flush-file-properties v localname))))))))))) (defun tramp-gvfs-handle-copy-file (filename newname &optional ok-if-already-exists keep-date diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 5796d124d43..3176236128a 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -251,6 +251,9 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-process-file (program &optional infile destination display &rest args) "Like `process-file' for Tramp files." + ;; STDERR is not impelmemted. + (when (consp destination) + (setcdr destination `(,tramp-cache-undefined))) (tramp-skeleton-process-file program infile destination display args (let ((coding-system-for-read 'utf-8-dos)) ; Is this correct? @@ -260,25 +263,18 @@ arguments to pass to the OPERATION." (tramp-unquote-shell-quote-argument localname) (mapconcat #'tramp-shell-quote-argument (cons program args) " "))) (when input (setq command (format "%s <%s" command input))) - (when stderr (setq command (format "%s 2>%s" command stderr))) - - (unwind-protect - (setq ret - (apply - #'tramp-call-process - v (tramp-get-method-parameter v 'tramp-login-program) - nil outbuf display - (tramp-expand-args - v 'tramp-login-args nil - ?h (or (tramp-file-name-host v) "") - ?u (or (tramp-file-name-user v) "") - ?p (or (tramp-file-name-port v) "") - ?a "-t" ?l command))) - - ;; Synchronize stderr. - (when tmpstderr - (tramp-cleanup-connection v 'keep-debug 'keep-password) - (tramp-fuse-unmount v)))))) + + (setq ret + (apply + #'tramp-call-process + v (tramp-get-method-parameter v 'tramp-login-program) + nil outbuf display + (tramp-expand-args + v 'tramp-login-args nil + ?h (or (tramp-file-name-host v) "") + ?u (or (tramp-file-name-user v) "") + ?p (or (tramp-file-name-port v) "") + ?a "-t" ?l command)))))) (defun tramp-sshfs-handle-rename-file (filename newname &optional ok-if-already-exists) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6f2d891db5d..366847e4e00 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3810,10 +3810,13 @@ BODY is the backend specific code." tmpstderr (tramp-make-tramp-file-name v stderr)))) ;; stderr to be discarded. ((null (cadr ,destination)) - (setq stderr (tramp-get-remote-null-device v))))) + (setq stderr (tramp-get-remote-null-device v))) + ((eq (cadr ,destination) tramp-cache-undefined) + ;; stderr is not impelmemted. + (tramp-warning v "%s" "STDERR not supported")))) ;; t (,destination - (setq outbuf (current-buffer)))) + (setq outbuf (current-buffer)))) ,@body @@ -5514,8 +5517,22 @@ support symbolic links." (insert-file-contents-literally error-file nil nil nil 'replace)) (delete-file error-file))))) - (display-buffer output-buffer '(nil (allow-no-window . t))))) - + (if async-shell-command-display-buffer + ;; Display buffer immediately. + (display-buffer output-buffer '(nil (allow-no-window . t))) + ;; Defer displaying buffer until first process output. + ;; Use disposable named advice so that the buffer is + ;; displayed at most once per process lifetime. + (let ((nonce (make-symbol "nonce"))) + (add-function + :before (process-filter p) + (lambda (proc _string) + (let ((buf (process-buffer proc))) + (when (buffer-live-p buf) + (remove-function (process-filter proc) + nonce) + (display-buffer buf '(nil (allow-no-window . t)))))) + `((name . ,nonce))))))) ;; Insert error messages if they were separated. (when (and error-file (not (process-live-p p))) (ignore-errors diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ccb3731fc09..0d853f1eab6 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5309,19 +5309,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; (delete-file tmp-name))) ;; Check remote and local STDERR. - (dolist (local '(nil t)) - (setq tmp-name (tramp--test-make-temp-name local quoted)) - (should-not - (zerop - (process-file "cat" nil `(t ,tmp-name) nil "/does-not-exist"))) - (with-temp-buffer - (insert-file-contents tmp-name) - (should - (string-match-p - (rx "cat:" (* nonl) " No such file or directory") - (buffer-string))) - (should-not (get-buffer-window (current-buffer) t)) - (delete-file tmp-name)))) + (unless (tramp--test-sshfs-p) + (dolist (local '(nil t)) + (setq tmp-name (tramp--test-make-temp-name local quoted)) + (should-not + (zerop + (process-file "cat" nil `(t ,tmp-name) nil "/does-not-exist"))) + (with-temp-buffer + (insert-file-contents tmp-name) + (should + (string-match-p + (rx "cat:" (* nonl) " No such file or directory") + (buffer-string))) + (should-not (get-buffer-window (current-buffer) t)) + (delete-file tmp-name))))) ;; Cleanup. (ignore-errors (kill-buffer buffer)) commit fa1cfcada0939e33d69696df6448b75b33ab656d Author: Martin Rudalics Date: Wed Mar 19 09:36:42 2025 +0100 On tty frames restrict number of menu bar lines (Bug#77015) * src/frame.c (set_menu_bar_lines): Make sure tty frames get only 0 or 1 menu bar line (Bug#77015). diff --git a/src/frame.c b/src/frame.c index e5177afa059..3d181312c10 100644 --- a/src/frame.c +++ b/src/frame.c @@ -210,22 +210,34 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) int olines = FRAME_MENU_BAR_LINES (f); int nlines = TYPE_RANGED_FIXNUMP (int, value) ? XFIXNUM (value) : 0; - /* Menu bars on child frames don't work on all platforms, which is - the reason why prepare_menu_bar does not update_menu_bar for - child frames (info from Martin Rudalics). This could be - implemented in ttys, but it's probably not worth it. */ - if (is_tty_child_frame (f)) + if (is_tty_frame (f)) { - FRAME_MENU_BAR_LINES (f) = 0; - FRAME_MENU_BAR_HEIGHT (f) = 0; - return; - } + /* Menu bars on child frames don't work on all platforms, which is + the reason why prepare_menu_bar does not update_menu_bar for + child frames (info from Martin Rudalics). This could be + implemented in ttys, but it's probably not worth it. */ + if (FRAME_PARENT_FRAME (f)) + FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) = 0; + else + { + /* Make only 0 or 1 menu bar line (Bug#77015). */ + FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) + = nlines > 0 ? 1 : 0; + if (FRAME_MENU_BAR_LINES (f) != olines) + { + windows_or_buffers_changed = 14; + change_frame_size + (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), + false, true, false); + } + } + } /* Right now, menu bars don't work properly in minibuf-only frames; most of the commands try to apply themselves to the minibuffer frame itself, and get an error because you can't switch buffers in or split the minibuffer window. */ - if (!FRAME_MINIBUF_ONLY_P (f) && nlines != olines) + else if (!FRAME_MINIBUF_ONLY_P (f) && nlines != olines) { windows_or_buffers_changed = 14; FRAME_MENU_BAR_LINES (f) = FRAME_MENU_BAR_HEIGHT (f) = nlines;