commit 47837adf8c874356d598fb0a5224a137083d5be7 (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Wed Jun 4 09:49:01 2025 +0300 * lisp/tab-line.el: Remove unnecessary checks for nil event. (tab-line-hscroll-right, tab-line-hscroll-left) (tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab) (tab-line-close-tab, tab-line-close-other-tabs): Remove '(consp event)' to use the window returned by '(posn-window (tab-line-event-start event))' even in case when 'event' is nil. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 089e0b9aa17..b39d0d80cdf 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -862,8 +862,7 @@ the selected tab visible." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (consp event) - (posn-window (tab-line-event-start event))))) + (let ((window (posn-window (tab-line-event-start event)))) (tab-line-hscroll arg window) (force-mode-line-update window)))) @@ -872,8 +871,7 @@ Interactively, ARG is the prefix numeric argument and defaults to 1." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (consp event) - (posn-window (tab-line-event-start event))))) + (let ((window (posn-window (tab-line-event-start event)))) (tab-line-hscroll (- (or arg 1)) window) (force-mode-line-update window)))) @@ -954,27 +952,26 @@ switches to the previous buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (consp event) (posn-window (event-start event))))) - (with-selected-window (or window (selected-window)) - (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) - (previous-buffer arg t) - (let* ((buffers (seq-keep - (lambda (tab) (or (and (bufferp tab) tab) - (alist-get 'buffer tab))) - (funcall tab-line-tabs-function))) - (old-pos (seq-position buffers (current-buffer))) - (new-pos (when old-pos (- old-pos (or arg 1)))) - (new-pos (when new-pos - (if tab-line-switch-cycling - (mod new-pos (length buffers)) - (max new-pos 0)))) - (buffer (when new-pos (nth new-pos buffers)))) - (when (bufferp buffer) - (let ((switch-to-buffer-obey-display-actions nil)) - (switch-to-buffer buffer)))))))) + (with-selected-window (posn-window (event-start event)) + (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (previous-buffer arg t) + (let* ((buffers (seq-keep + (lambda (tab) (or (and (bufferp tab) tab) + (alist-get 'buffer tab))) + (funcall tab-line-tabs-function))) + (old-pos (seq-position buffers (current-buffer))) + (new-pos (when old-pos (- old-pos (or arg 1)))) + (new-pos (when new-pos + (if tab-line-switch-cycling + (mod new-pos (length buffers)) + (max new-pos 0)))) + (buffer (when new-pos (nth new-pos buffers)))) + (when (bufferp buffer) + (let ((switch-to-buffer-obey-display-actions nil)) + (switch-to-buffer buffer))))))) (defun tab-line-switch-to-next-tab (&optional event arg) - "Switch to the next ARGth tab's buffer. + "Switch to the next ARGth tab's buffer. When `tab-line-tabs-function' is `tab-line-tabs-window-buffers', its effect is the same as using the `next-buffer' command \(\\[next-buffer]). @@ -984,24 +981,23 @@ switches to the next buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (consp event) (posn-window (event-start event))))) - (with-selected-window (or window (selected-window)) - (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) - (next-buffer arg t) - (let* ((buffers (seq-keep - (lambda (tab) (or (and (bufferp tab) tab) - (alist-get 'buffer tab))) - (funcall tab-line-tabs-function))) - (old-pos (seq-position buffers (current-buffer))) - (new-pos (when old-pos (+ old-pos (or arg 1)))) - (new-pos (when new-pos - (if tab-line-switch-cycling - (mod new-pos (length buffers)) - (min new-pos (1- (length buffers)))))) - (buffer (when new-pos (nth new-pos buffers)))) - (when (bufferp buffer) - (let ((switch-to-buffer-obey-display-actions nil)) - (switch-to-buffer buffer)))))))) + (with-selected-window (posn-window (event-start event)) + (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (next-buffer arg t) + (let* ((buffers (seq-keep + (lambda (tab) (or (and (bufferp tab) tab) + (alist-get 'buffer tab))) + (funcall tab-line-tabs-function))) + (old-pos (seq-position buffers (current-buffer))) + (new-pos (when old-pos (+ old-pos (or arg 1)))) + (new-pos (when new-pos + (if tab-line-switch-cycling + (mod new-pos (length buffers)) + (min new-pos (1- (length buffers)))))) + (buffer (when new-pos (nth new-pos buffers)))) + (when (bufferp buffer) + (let ((switch-to-buffer-obey-display-actions nil)) + (switch-to-buffer buffer))))))) (defun tab-line-mouse-move-tab (event) "Move a tab to a different position on the tab line using mouse. @@ -1097,15 +1093,13 @@ right side of the tab. This command buries the buffer, so it goes out of sight of the tab line." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (consp event) - (tab-line-event-start event))) - (window (and posnp (posn-window posnp))) - (tab (if posnp + (let* ((posnp (tab-line-event-start event)) + (tab (if (consp event) (tab-line--get-tab-property 'tab (car (posn-string posnp))) (tab-line--current-tab))) (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))) (close-function (unless (bufferp tab) (cdr (assq 'close tab))))) - (with-selected-window (or window (selected-window)) + (with-selected-window (posn-window posnp) (cond ((functionp close-function) (funcall close-function)) @@ -1125,13 +1119,11 @@ sight of the tab line." It preforms the same actions on the closed tabs as in `tab-line-close-tab'." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (consp event) - (tab-line-event-start event))) - (window (and posnp (posn-window posnp))) - (keep-tab (if posnp + (let* ((posnp (tab-line-event-start event)) + (keep-tab (if (consp event) (tab-line--get-tab-property 'tab (car (posn-string posnp))) (tab-line--current-tab)))) - (with-selected-window (or window (selected-window)) + (with-selected-window (posn-window posnp) (dolist (tab (delete keep-tab (funcall tab-line-tabs-function))) (let ((buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))) (close-function (unless (bufferp tab) (cdr (assq 'close tab))))) commit d1fa5115123ec913c11f9e3ea43772855495f03a Author: Yuan Fu Date: Tue Jun 3 22:44:13 2025 -0700 ; Fix recent changes in typescript-ts-mode.el * lisp/progmodes/typescript-ts-mode.el: (typescript-ts--standalone-parent-p): Add a limit to the looking-back call. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 1a8de90c917..6c381c8d777 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -245,7 +245,7 @@ This is used for `treesit-simple-indent-standalone-predicate'." ;; chaining, allow a dot to be before the node. ((looking-back (rx bol (* whitespace) (? ".")) (line-beginning-position)) - (if (looking-back "\\." nil) + (if (looking-back "\\." (max (point-min) (1- (point)))) (1- (point)) (point)))))) commit a4a66d9628e7c75250424a8cdcadc42e34de3fa9 Author: Stefan Monnier Date: Tue Jun 3 17:13:51 2025 -0400 lisp/progmodes/sh-script.el (sh-popup-occur-buffer): Remove unused var diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index d10e9fbfb43..1d9c41bcd78 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1153,15 +1153,6 @@ and command `sh-reset-indent-vars-to-global-values'." :options '(sh-electric-here-document-mode) :group 'sh-script) -(defcustom sh-popup-occur-buffer nil - "Controls when `smie-config-guess' pops the `*indent*' buffer. -If t it is always shown. If nil, it is shown only when there -are conflicts." - :type '(choice - (const :tag "Only when there are conflicts." nil) - (const :tag "Always" t)) - :group 'sh-indentation) - (defcustom sh-basic-offset 4 "The default indentation increment. This value is used for the `+' and `-' symbols in an indentation variable." commit eb788fd8fd2026fa4d29b918ff95b12d8e3e0bab Author: Thierry Volpiatto Date: Tue Jun 3 16:03:27 2025 -0400 (lisp-imenu-generic-expression): Add `oclosure-define` * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add `oclosure-define` alongside the other type definition forms. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 006b713ae6e..e4dfc7c2f78 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -147,7 +147,7 @@ '(;; Elisp "defgroup" "deftheme" "define-widget" "define-error" - "defface" "cl-deftype" "cl-defstruct" + "defface" "cl-deftype" "cl-defstruct" "oclosure-define" ;; CL "deftype" "defstruct" "define-condition" "defpackage" commit 9fcea4a263a004e5a2996a0dae2305434ed423c5 Author: Eli Zaretskii Date: Tue Jun 3 19:32:29 2025 +0300 ; Fix recent changes in typescript-ts-mode.el * lisp/progmodes/typescript-ts-mode.el (typescript-ts--standalone-parent-p): Fix warning and punctuation in a comment. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 10be02b9995..1a8de90c917 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -241,11 +241,11 @@ This is used for `treesit-simple-indent-standalone-predicate'." "ternary_expression") nil) ;; If there's only whitespace before node, consider - ;; this node standalone. To support function + ;; this node standalone. To support function ;; chaining, allow a dot to be before the node. ((looking-back (rx bol (* whitespace) (? ".")) (line-beginning-position)) - (if (looking-back "\\.") + (if (looking-back "\\." nil) (1- (point)) (point)))))) commit 332f733d88bab937120fc4de5679db92d7636d15 Author: Juri Linkov Date: Tue Jun 3 18:49:31 2025 +0300 * lisp/tab-line.el: Use 'consp' on mouse events instead of 'listp'. (tab-line-hscroll-right, tab-line-hscroll-left, tab-line-new-tab) (tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab) (tab-line-close-tab, tab-line-close-other-tabs): Replace '(listp event)' with '(consp event)' that allows calling the functions non-interactively with nil event arguments. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 5be5b921035..089e0b9aa17 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -862,7 +862,7 @@ the selected tab visible." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (listp event) + (let ((window (and (consp event) (posn-window (tab-line-event-start event))))) (tab-line-hscroll arg window) (force-mode-line-update window)))) @@ -872,7 +872,7 @@ Interactively, ARG is the prefix numeric argument and defaults to 1." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (listp event) + (let ((window (and (consp event) (posn-window (tab-line-event-start event))))) (tab-line-hscroll (- (or arg 1)) window) (force-mode-line-update window)))) @@ -888,7 +888,7 @@ corresponding to the new buffer shown in the window." (if (functionp tab-line-new-tab-choice) (funcall tab-line-new-tab-choice) (let ((tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups)) - (if (and (listp event) + (if (and (consp event) (display-popup-menus-p) (not tty-menu-open-use-tmm)) (mouse-buffer-menu event) ; like (buffer-menu-open) @@ -954,7 +954,7 @@ switches to the previous buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (listp event) (posn-window (event-start event))))) + (let ((window (and (consp event) (posn-window (event-start event))))) (with-selected-window (or window (selected-window)) (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (previous-buffer arg t) @@ -984,7 +984,7 @@ switches to the next buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (listp event) (posn-window (event-start event))))) + (let ((window (and (consp event) (posn-window (event-start event))))) (with-selected-window (or window (selected-window)) (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (next-buffer arg t) @@ -1097,7 +1097,7 @@ right side of the tab. This command buries the buffer, so it goes out of sight of the tab line." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (listp event) + (let* ((posnp (and (consp event) (tab-line-event-start event))) (window (and posnp (posn-window posnp))) (tab (if posnp @@ -1125,7 +1125,7 @@ sight of the tab line." It preforms the same actions on the closed tabs as in `tab-line-close-tab'." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (listp event) + (let* ((posnp (and (consp event) (tab-line-event-start event))) (window (and posnp (posn-window posnp))) (keep-tab (if posnp commit 6b668c2213432db04d29d36b8bf25a8f3f853c62 Author: Juri Linkov Date: Tue Jun 3 18:41:01 2025 +0300 Restore c-ts-common-comment-setup in js-ts-mode and typescript-ts-mode. * lisp/progmodes/js.el (js-ts-mode): * lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Add 'c-ts-common-comment-setup' back removed in 8bccccedb65a since it does more than setting comment variables (bug#78680). diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 14d06f1171d..44a1714b02f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -4063,6 +4063,7 @@ See `treesit-thing-settings' for more information.") ;; Which-func. (setq-local which-func-imenu-joiner-function #'js--which-func-joiner) ;; Comment. + (c-ts-common-comment-setup) (setq-local comment-setup-function #'js--treesit-comment-setup) (setq-local comment-multi-line t) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 0bc629cc81e..10be02b9995 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -661,6 +661,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table ;; Comments. + (c-ts-common-comment-setup) (setq-local comment-setup-function #'js--treesit-comment-setup) ;; Electric commit f60ad8d1e0bf3352af8f30bc4d4de25030447d3a Author: Michael Albinus Date: Tue Jun 3 16:56:52 2025 +0200 Add ansible password prompts to `comint-password-prompt-regexp' * lisp/comint.el (comint-password-prompt-regexp): * test/lisp/comint-tests.el (comint-testsuite-password-strings): Add ansible password prompts. (Bug#78442) diff --git a/lisp/comint.el b/lisp/comint.el index bb718f25ee0..56a28f6ae99 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -404,6 +404,8 @@ This variable is buffer-local." (regexp-opt '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the" "Current" + ;; Ansible. (Bug#78442) + "Vault" "SSH" "BECOME" "Enter Auth" "enter auth" "Old" "old" "New" "new" "login" "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO" "[sudo]" "doas" "Repeat" "Bad" "Retype" "Verify") @@ -418,6 +420,8 @@ This variable is buffer-local." ;; The ccrypt encryption dialog doesn't end with a colon, so ;; treat it specially. "\\|^Enter encryption key: (repeat) *\\'" + ;; Ansible. The vault-id syntax is a guess. (Bug#78442) + "\\|^Vault password ([^@-][^@]*): \\'" ;; Default openssh format: "user@host's password:". "\\|^[^@ \t\n]+@[^@ \t\n]+'s password: *\\'" ;; openssh-8.6p1 format: "(user@host) Password:". diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 20ef01acd95..6b6cc7256ec 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -50,6 +50,10 @@ "Enter encryption key: (repeat) " ; ccrypt "Enter Auth Password:" ; OpenVPN (Bug#35724) "Verify password: " ; zip -e zipfile.zip ... (Bug#47209) + "Vault password: " ; ansible-playbook --ask-vault-pass ... (Bug#78442) + "Vault password (dev): " ; ansible-playbook --vault-id dev@prompt ... (Bug#78442) + "SSH password: " ; ansible-playbook --ask-pass playbook.yml ... (Bug#78442) + "BECOME password: " ; ansible-playbook --ask-become-pass ... (Bug#78442) "Mot de Passe :" ; localized (Bug#29729) "Passwort:") ; localized "List of strings that should match `comint-password-prompt-regexp'.") commit 50e3bce315eb499917c1d208f87f84315f1a8b4e Author: Alan Third Date: Mon May 26 20:27:39 2025 +0100 Fix NS port screen geometry report (bug#76051) * src/nsfns.m (Fns_display_monitor_attributes_list): Fix the arithmetic to calculate the origin of the visible frame. diff --git a/src/nsfns.m b/src/nsfns.m index b219064cdd1..41400e8883f 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2692,41 +2692,28 @@ Frames are listed from topmost (first) to bottommost (last). */) struct MonitorInfo *m = &monitors[i]; NSRect fr = [s frame]; NSRect vfr = [s visibleFrame]; - short y, vy; #ifdef NS_IMPL_COCOA NSDictionary *dict = [s deviceDescription]; NSNumber *nid = [dict objectForKey:@"NSScreenNumber"]; CGDirectDisplayID did = [nid unsignedIntValue]; #endif + + /* The primary display is always the first in the array. */ if (i == 0) - { - primary_display_height = fr.size.height; - y = (short) fr.origin.y; - vy = (short) vfr.origin.y; - } - else - { - /* Flip y coordinate as NS screen coordinates originate from - the bottom. */ - y = (short) (primary_display_height - fr.size.height - fr.origin.y); - vy = (short) (primary_display_height - - vfr.size.height - vfr.origin.y); - } + primary_display_height = fr.size.height; + + /* Flip y coordinate as NS screen coordinates originate from + the bottom. */ m->geom.x = (short) fr.origin.x; - m->geom.y = y; + m->geom.y = (short) (primary_display_height - NSMaxY(fr)); m->geom.width = (unsigned short) fr.size.width; m->geom.height = (unsigned short) fr.size.height; + /* The work area excludes the menu bar and the dock. */ m->work.x = (short) vfr.origin.x; - /* y is flipped on NS, so vy - y are pixels missing at the - bottom, and fr.size.height - vfr.size.height are pixels - missing in total. - - Pixels missing at top are fr.size.height - vfr.size.height - - vy + y. work.y is then pixels missing at top + y. */ - m->work.y = (short) (fr.size.height - vfr.size.height) - vy + y + y; + m->work.y = (short) (primary_display_height - NSMaxY(vfr)); m->work.width = (unsigned short) vfr.size.width; m->work.height = (unsigned short) vfr.size.height; commit 9cc5f1c697c1a47470651ff4293f335eaa10ea9a Author: shipmints Date: Tue Mar 4 09:56:56 2025 -0500 Fix ns_make_monitor_attribute_list (bug#76691) This is the NS implementation for 'display-monitor-attributes-list'. Change implementation from IORegistry to direct introspection of NSScreen. * src/nsfns.m (ns_make_monitor_attribute_list): Use localizedName selector on NSScreen. For anonymous displays, synthesize names of the form ("%dx%d@%d,%d" width height x y). (ns_get_name_from_ioreg) (ns_screen_name): Removed. diff --git a/src/nsfns.m b/src/nsfns.m index b1ed0eff58a..b219064cdd1 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2612,100 +2612,6 @@ Frames are listed from topmost (first) to bottommost (last). */) return make_fixnum (ns_display_pixel_height (dpyinfo)); } -#ifdef NS_IMPL_COCOA - -/* Returns the name for the screen that OBJ represents, or NULL. - Caller must free return value. -*/ - -static char * -ns_get_name_from_ioreg (io_object_t obj) -{ - char *name = NULL; - - NSDictionary *info = (NSDictionary *) - IODisplayCreateInfoDictionary (obj, kIODisplayOnlyPreferredName); - NSDictionary *names = [info objectForKey: - [NSString stringWithUTF8String: - kDisplayProductName]]; - - if ([names count] > 0) - { - NSString *n = [names objectForKey: [[names allKeys] - objectAtIndex:0]]; - if (n != nil) name = xstrdup ([n UTF8String]); - } - - [info release]; - - return name; -} - -/* Returns the name for the screen that DID came from, or NULL. - Caller must free return value. -*/ - -static char * -ns_screen_name (CGDirectDisplayID did) -{ - char *name = NULL; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - if (CGDisplayIOServicePort == NULL) -#endif - { - mach_port_t masterPort; - io_iterator_t it; - io_object_t obj; - - /* CGDisplayIOServicePort is deprecated. Do it another (harder) way. - - Is this code OK for macOS < 10.9, and GNUstep? I suspect it is, - in which case is it worth keeping the other method in here? */ - - if (IOMasterPort (MACH_PORT_NULL, &masterPort) != kIOReturnSuccess - || IOServiceGetMatchingServices (masterPort, - IOServiceMatching ("IONDRVDevice"), - &it) != kIOReturnSuccess) - return name; - - /* Must loop until we find a name. Many devices can have the same unit - number (represents different GPU parts), but only one has a name. */ - while (! name && (obj = IOIteratorNext (it))) - { - CFMutableDictionaryRef props; - const void *val; - - if (IORegistryEntryCreateCFProperties (obj, - &props, - kCFAllocatorDefault, - kNilOptions) == kIOReturnSuccess - && props != nil - && (val = CFDictionaryGetValue(props, @"IOFBDependentIndex"))) - { - unsigned nr = [(NSNumber *)val unsignedIntegerValue]; - if (nr == CGDisplayUnitNumber (did)) - name = ns_get_name_from_ioreg (obj); - } - - CFRelease (props); - IOObjectRelease (obj); - } - - IOObjectRelease (it); - } -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - else -#endif -#endif /* #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 */ -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - name = ns_get_name_from_ioreg (CGDisplayIOServicePort (did)); -#endif - return name; -} -#endif /* NS_IMPL_COCOA */ - static Lisp_Object ns_make_monitor_attribute_list (struct MonitorInfo *monitors, int n_monitors, @@ -2825,7 +2731,25 @@ Frames are listed from topmost (first) to bottommost (last). */) m->work.height = (unsigned short) vfr.size.height; #ifdef NS_IMPL_COCOA - m->name = ns_screen_name (did); + m->name = NULL; + if ([s respondsToSelector:@selector(localizedName)]) + { + NSString *name = [s valueForKey:@"localizedName"]; + if (name != NULL) + { + m->name = xmalloc ([name lengthOfBytesUsingEncoding: NSUTF8StringEncoding] + 1); + strcpy(m->name, [name UTF8String]); + } + } + /* If necessary, synthesize a name of the following form: + %dx%d@%d,%d width height x y. */ + if (m->name == NULL) + { + char buf[25]; /* sufficient for 12345x78901@34567,90123 */ + snprintf (buf, sizeof(buf), "%ux%u@%d,%d", + m->work.width, m->work.height, m->work.x, m->work.y); + m->name = xstrdup (buf); + } { CGSize mms = CGDisplayScreenSize (did); commit 55691c61d4af972b999bb97bffb46cb8571c912c Author: Michael Albinus Date: Mon Jun 2 11:44:43 2025 +0200 Tramp: Do not raise an error when not connected (Bug#78572) * lisp/net/tramp-cmds.el (tramp-cleanup-connection): Use read syntax #' for `tramp-timeout-session', * lisp/net/tramp.el (tramp-barf-if-file-missing): Do not raise an error when not connected. (Bug#78572) (tramp-file-name-handler): Do not force the backtrace. (tramp-connectable-p): Check also, whether initial handshake is finished. (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-set-file-modes-times-uid-gid): Rearrange sending `file-missing' error. (tramp-handle-access-file, tramp-handle-unlock-file): Use `tramp-connectable-p'. * test/lisp/net/tramp-tests.el (project-mode-line-format) (project-mode-line): Declare. (tramp-test48-session-timeout): New test. (tramp-test49-auto-load, tramp-test49-delay-load) (tramp-test49-recursive-load, tramp-test49-remote-load-path) (tramp-test50-without-remote-files, tramp-test51-unload): Rename. diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 098e39ccf7c..62dff3d8d46 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -177,7 +177,7 @@ interactively, a Tramp connection has to be selected." ;; Cancel timer. (dolist (timer timer-list) - (when (and (eq (timer--function timer) 'tramp-timeout-session) + (when (and (eq (timer--function timer) #'tramp-timeout-session) (tramp-file-name-equal-p vec (car (timer--args timer)))) (cancel-timer timer))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 679d76d0f57..46666b8657e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5162,6 +5162,7 @@ If there is just some editing, retry it after 5 seconds." Does not do anything if a connection is already open, but re-opens the connection if a previous connection has died for some reason." ;; During completion, don't reopen a new connection. + ;; Same for slide-in timer or process-{filter,sentinel}. (unless (tramp-connectable-p vec) (throw 'non-essential 'non-essential)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 24298e8e09a..0f7b945f84a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2105,10 +2105,11 @@ does not exist, otherwise propagate the error." (declare (indent 2) (debug (symbolp form body))) (let ((err (make-symbol "err"))) `(condition-case ,err - (progn ,@body) + (let (signal-hook-function) ,@body) (error (if (not (or (file-exists-p ,filename) (file-symlink-p ,filename))) - (tramp-error ,vec 'file-missing ,filename) + (when (tramp-connectable-p ,vec) + (tramp-error ,vec 'file-missing ,filename)) (signal (car ,err) (cdr ,err))))))) ;; This function provides traces in case of errors not triggered by @@ -2561,7 +2562,7 @@ Fall back to normal file name handler if no Tramp file name handler exists." (tramp-message v 5 "Non-essential received in operation %s" (cons operation args)) - (let ((tramp-verbose 10)) (tramp-backtrace v)) + (tramp-backtrace v) (tramp-run-real-handler operation args)) ((eq result 'suppress) (let ((inhibit-message t)) @@ -2793,13 +2794,15 @@ They are completed by `M-x TAB' only if there's an active connection or buffer." "Check if it is possible to connect the remote host without side-effects. This is true, if either the remote host is already connected, or if we are not in completion mode." - (let ((tramp-verbose 0) - (vec (tramp-ensure-dissected-file-name vec-or-filename))) - (or ;; We check this for the process related to - ;; `tramp-buffer-name'; otherwise `make-process' wouldn't run - ;; ever when `non-essential' is non-nil. - (process-live-p (tramp-get-process vec)) - (not non-essential)))) + (or (not non-essential) + ;; We check this for the process related to `tramp-buffer-name'; + ;; otherwise `make-process' wouldn't run ever when + ;; `non-essential' is non-nil. + (and-let* ((tramp-verbose 0) + (vec (tramp-ensure-dissected-file-name vec-or-filename)) + (p (tramp-get-process vec)) + ((process-live-p p)) + ((tramp-get-connection-property p "connected")))))) (defun tramp-completion-handle-expand-file-name (filename &optional directory) "Like `expand-file-name' for partial Tramp files." @@ -3470,79 +3473,69 @@ BODY is the backend specific code." "Skeleton for `tramp-*-handle-directory-files'. BODY is the backend specific code." (declare (indent 5) (debug t)) - `(or - (with-parsed-tramp-file-name (expand-file-name ,directory) nil - (tramp-barf-if-file-missing v ,directory - (when (file-directory-p ,directory) - (setf ,directory - (file-name-as-directory (expand-file-name ,directory))) - (let ((temp - (with-tramp-file-property v localname "directory-files" ,@body)) - result item) - (while temp - (setq item (directory-file-name (pop temp))) - (when (or (null ,match) (string-match-p ,match item)) - (push (if ,full (concat ,directory item) item) - result))) - (unless ,nosort - (setq result (sort result #'string<))) - (when (and (natnump ,count) (> ,count 0)) - (setq result (tramp-compat-ntake ,count result))) - result)))) - - ;; Error handling. - (if (not (file-exists-p ,directory)) - (tramp-error - (tramp-dissect-file-name ,directory) 'file-missing ,directory) - nil))) + `(with-parsed-tramp-file-name (expand-file-name ,directory) nil + (tramp-barf-if-file-missing v ,directory + (if (not (file-directory-p ,directory)) + ;; Trigger the `file-missing' error. + (signal 'error nil) + (setf ,directory + (file-name-as-directory (expand-file-name ,directory))) + (let ((temp + (with-tramp-file-property v localname "directory-files" ,@body)) + result item) + (while temp + (setq item (directory-file-name (pop temp))) + (when (or (null ,match) (string-match-p ,match item)) + (push (if ,full (concat ,directory item) item) + result))) + (unless ,nosort + (setq result (sort result #'string<))) + (when (and (natnump ,count) (> ,count 0)) + (setq result (tramp-compat-ntake ,count result))) + result))))) (defmacro tramp-skeleton-directory-files-and-attributes (directory &optional full match nosort id-format count &rest body) "Skeleton for `tramp-*-handle-directory-files-and-attributes'. BODY is the backend specific code." (declare (indent 6) (debug t)) - `(or - (with-parsed-tramp-file-name (expand-file-name ,directory) nil - (tramp-barf-if-file-missing v ,directory - (when (file-directory-p ,directory) - (let ((temp - (copy-tree - (mapcar - (lambda (x) - (cons - (car x) - (tramp-convert-file-attributes - v (expand-file-name (car x) localname) - ,id-format (cdr x)))) - (with-tramp-file-property - v localname "directory-files-and-attributes" - ,@body)))) - result item) - - (while temp - (setq item (pop temp)) - (when (or (null ,match) (string-match-p ,match (car item))) - (when ,full - (setcar item (expand-file-name (car item) ,directory))) - (push item result))) - - (unless ,nosort - (setq result - (sort result (lambda (x y) (string< (car x) (car y)))))) - - (when (and (natnump ,count) (> ,count 0)) - (setq result (tramp-compat-ntake ,count result))) - - (or result - ;; The scripts could fail, for example with huge file size. - (tramp-handle-directory-files-and-attributes - ,directory ,full ,match ,nosort ,id-format ,count)))))) - - ;; Error handling. - (if (not (file-exists-p ,directory)) - (tramp-error - (tramp-dissect-file-name ,directory) 'file-missing ,directory) - nil))) + `(with-parsed-tramp-file-name (expand-file-name ,directory) nil + (tramp-barf-if-file-missing v ,directory + (if (not (file-directory-p ,directory)) + ;; Trigger the `file-missing' error. + (signal 'error nil) + (let ((temp + (copy-tree + (mapcar + (lambda (x) + (cons + (car x) + (tramp-convert-file-attributes + v (expand-file-name (car x) localname) + ,id-format (cdr x)))) + (with-tramp-file-property + v localname "directory-files-and-attributes" + ,@body)))) + result item) + + (while temp + (setq item (pop temp)) + (when (or (null ,match) (string-match-p ,match (car item))) + (when ,full + (setcar item (expand-file-name (car item) ,directory))) + (push item result))) + + (unless ,nosort + (setq result + (sort result (lambda (x y) (string< (car x) (car y)))))) + + (when (and (natnump ,count) (> ,count 0)) + (setq result (tramp-compat-ntake ,count result))) + + (or result + ;; The scripts could fail, for example with huge file size. + (tramp-handle-directory-files-and-attributes + ,directory ,full ,match ,nosort ,id-format ,count))))))) (defcustom tramp-use-file-attributes t "Whether to use \"file-attributes\" connection property for check. @@ -3850,20 +3843,23 @@ BODY is the backend specific code." BODY is the backend specific code." (declare (indent 1) (debug t)) `(with-parsed-tramp-file-name (expand-file-name ,filename) nil - (when (not (file-exists-p ,filename)) - (tramp-error v 'file-missing ,filename)) - (with-tramp-saved-file-properties - v localname - ;; We cannot add "file-attributes", "file-executable-p", - ;; "file-ownership-preserved-p", "file-readable-p", - ;; "file-writable-p". - '("file-directory-p" "file-exists-p" "file-symlink-p" "file-truename") - (tramp-flush-file-properties v localname)) - (condition-case err - (progn ,@body) - (error (if tramp-inhibit-errors-if-setting-file-attributes-fail - (display-warning 'tramp (error-message-string err)) - (signal (car err) (cdr err))))))) + (tramp-barf-if-file-missing v ,filename + (if (not (file-exists-p ,filename)) + ;; Trigger the `file-missing' error. + (signal 'error nil) + (with-tramp-saved-file-properties + v localname + ;; We cannot add "file-attributes", "file-executable-p", + ;; "file-ownership-preserved-p", "file-readable-p", + ;; "file-writable-p". + '("file-directory-p" "file-exists-p" + "file-symlink-p" "file-truename") + (tramp-flush-file-properties v localname)) + (condition-case err + (progn ,@body) + (error (if tramp-inhibit-errors-if-setting-file-attributes-fail + (display-warning 'tramp (error-message-string err)) + (signal (car err) (cdr err))))))))) (defmacro tramp-skeleton-write-region (start end filename append visit lockname mustbenew &rest body) @@ -4051,9 +4047,7 @@ Let-bind it when necessary.") (tramp-dont-suspend-timers t)) (with-tramp-timeout (timeout - (unless (and-let* ((p (tramp-get-connection-process v)) - ((process-live-p p)) - ((tramp-get-connection-property p "connected")))) + (unless (and (not non-essential) (tramp-connectable-p v)) (tramp-cleanup-connection v 'keep-debug 'keep-password)) (tramp-error v 'file-error @@ -4939,6 +4933,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") ;; functions like `kill-buffer' would try to reestablish the ;; connection. See Bug#61663. (if-let* ((v (tramp-dissect-file-name file)) + ((tramp-connectable-p v)) ((process-live-p (tramp-get-process v))) (lockname (make-lock-file-name file))) (delete-file lockname) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index b60b29fc3e6..f67a33467de 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -67,6 +67,7 @@ (require 'vc-git) (require 'vc-hg) +(declare-function project-mode-line-format "project") (declare-function tramp-check-remote-uname "tramp-sh") (declare-function tramp-find-executable "tramp-sh") (declare-function tramp-get-remote-chmod-h "tramp-sh") @@ -89,6 +90,7 @@ (defvar tramp-use-connection-share) ;; Declared in Emacs 30.1. +(defvar project-mode-line) (defvar remote-file-name-access-timeout) (defvar remote-file-name-inhibit-delete-by-moving-to-trash) @@ -8374,8 +8376,52 @@ process sentinels. They shall not disturb each other." ;; Cleanup. (tramp-cleanup-connection tramp-test-vec 'keep-debug)) +;; This test is inspired by Bug#78572. +(ert-deftest tramp-test48-session-timeout () + "Check that Tramp handles a session timeout properly." + (skip-unless (tramp--test-enabled)) + (skip-unless + (tramp-get-method-parameter tramp-test-vec 'tramp-session-timeout)) + + ;; We want to see the timeout message. + (tramp--test-instrument-test-case 3 + (let ((remote-file-name-inhibit-cache t) + (tmp-name (tramp--test-make-temp-name))) + (unwind-protect + (progn + (should-not (file-exists-p tmp-name)) + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + + (tramp-timeout-session tramp-test-vec) + (should (file-exists-p tmp-name)) + (should (directory-files (file-name-directory tmp-name))) + + ;; `project-mode-line' was introduced in Emacs 30.1. + (when (boundp 'project-mode-line) + (require 'project) + (ert-with-message-capture captured-messages + (let ((project-mode-line t)) + (with-temp-buffer + (set-visited-file-name tmp-name) + (insert "foo") + (should (buffer-modified-p)) + (tramp-timeout-session tramp-test-vec) + ;; This calls `file-directory-p' and + ;; `directory-files'. Shouldn't raise an error when + ;; not connected. + (project-mode-line-format) + ;; Steal the file lock. + (cl-letf (((symbol-function #'ask-user-about-lock) #'always)) + (save-buffer))) + (should-not + (string-match-p "File is missing:" captured-messages)))))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + ;; This test is inspired by Bug#29163. -(ert-deftest tramp-test48-auto-load () +(ert-deftest tramp-test49-auto-load () "Check that Tramp autoloads properly." ;; If we use another syntax but `default', Tramp is already loaded ;; due to the `tramp-change-syntax' call. @@ -8400,7 +8446,7 @@ process sentinels. They shall not disturb each other." (mapconcat #'shell-quote-argument load-path " -L ") (shell-quote-argument code))))))) -(ert-deftest tramp-test48-delay-load () +(ert-deftest tramp-test49-delay-load () "Check that Tramp is loaded lazily, only when needed." ;; Tramp is neither loaded at Emacs startup, nor when completing a ;; non-Tramp file name like "/foo". Completing a Tramp-alike file @@ -8430,7 +8476,7 @@ process sentinels. They shall not disturb each other." (mapconcat #'shell-quote-argument load-path " -L ") (shell-quote-argument (format code tm))))))))) -(ert-deftest tramp-test48-recursive-load () +(ert-deftest tramp-test49-recursive-load () "Check that Tramp does not fail due to recursive load." (skip-unless (tramp--test-enabled)) @@ -8454,7 +8500,7 @@ process sentinels. They shall not disturb each other." (mapconcat #'shell-quote-argument load-path " -L ") (shell-quote-argument code)))))))) -(ert-deftest tramp-test48-remote-load-path () +(ert-deftest tramp-test49-remote-load-path () "Check that Tramp autoloads its packages with remote `load-path'." ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. ;; It shall still work, when a remote file name is in the @@ -8479,7 +8525,7 @@ process sentinels. They shall not disturb each other." (mapconcat #'shell-quote-argument load-path " -L ") (shell-quote-argument code))))))) -(ert-deftest tramp-test49-without-remote-files () +(ert-deftest tramp-test50-without-remote-files () "Check that Tramp can be suppressed." (skip-unless (tramp--test-enabled)) @@ -8494,7 +8540,7 @@ process sentinels. They shall not disturb each other." (setq tramp-mode t) (should (file-remote-p ert-remote-temporary-file-directory))) -(ert-deftest tramp-test50-unload () +(ert-deftest tramp-test51-unload () "Check that Tramp and its subpackages unload completely. Since it unloads Tramp, it shall be the last test to run." :tags '(:expensive-test) commit 1b03a348f7e7a01961108867985006fdfcc0a8cf Author: Collin Funk Date: Sun Jun 1 18:01:33 2025 -0700 Pacify Clang's -Wformat-signedness. * configure.ac: Enable -Wno-format-signedness if Clang is being used. diff --git a/configure.ac b/configure.ac index bafbb748149..d7c27dae734 100644 --- a/configure.ac +++ b/configure.ac @@ -1870,6 +1870,7 @@ AS_IF([test $gl_gcc_warnings = no], # clang is unduly picky about some things. if test "$emacs_cv_clang" = yes; then gl_WARN_ADD([-Wno-bitwise-instead-of-logical]) + gl_WARN_ADD([-Wno-format-signedness]) gl_WARN_ADD([-Wno-missing-braces]) gl_WARN_ADD([-Wno-null-pointer-arithmetic]) gl_WARN_ADD([-Wno-implicit-const-int-float-conversion])