commit 7a14f60b90ea640087b759466f2e2bafa490699d (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Mon Aug 5 09:56:38 2024 +0300 * lisp/tab-bar.el (tab-bar-tab-group-format-default): Hide hints. Don't display hints when tab-bar-show-inactive-group-tabs is customized to t (bug#71939). Suggested by Ship Mints . diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index b9726459b51..0ac31727ef4 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1017,7 +1017,10 @@ It should return the formatted tab group name to display in the tab bar." (defun tab-bar-tab-group-format-default (tab i &optional current-p) (propertize - (concat (if (and tab-bar-tab-hints (not current-p)) (format "%d " i) "") + (concat (if (and tab-bar-tab-hints + (not current-p) + (not tab-bar-show-inactive-group-tabs)) + (format "%d " i) "") (funcall tab-bar-tab-group-function tab)) 'face (if current-p 'tab-bar-tab-group-current 'tab-bar-tab-group-inactive))) commit 5ecd35555e9e20de9717f0184f58a15d8a2e68a3 Author: Yuan Fu Date: Sun Aug 4 20:46:45 2024 -0700 Fix c-ts-common filling * lisp/progmodes/c-ts-common.el: (c-ts-common--fill-block-comment): Exclude the last line from filling if it only has non-word characters like *=-. * test/lisp/progmodes/c-ts-mode-resources/filling.erts: Fir the multi-line test and add a single line test. diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 022d21e11a1..674623a5e61 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -186,9 +186,9 @@ comment." ;; filling region. (when (not end-marker) (goto-char end) - (when (looking-back (rx "*/") 2) - (backward-char 2) - (skip-syntax-backward "-") + (forward-line 0) + (when (looking-at (rx (* (or (syntax whitespace) "*" "=" "-")) + "*/" eol)) (setq end (point)))) ;; Let `fill-paragraph' do its thing. diff --git a/test/lisp/progmodes/c-ts-mode-resources/filling.erts b/test/lisp/progmodes/c-ts-mode-resources/filling.erts index e58b8e91c90..5425519b3d7 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/filling.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/filling.erts @@ -101,7 +101,7 @@ Name: Type 4 =-= /*================================================================ * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy - woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy * ================================================================*/ =-= @@ -112,6 +112,20 @@ Name: Type 4 * ================================================================*/ =-=-= +Name: Type 4 Single-line + +=-= +/*================================================================ + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * ================================================================*/ +=-= +/*================================================================ + * woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy + * woooomy woooomy + * ================================================================*/ +=-=-= + + Name: Type 5 /* woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy woooomy commit f70a6ea0ea86ef461e40d20664a75a92d02679ea Author: Jim Porter Date: Sat Jul 27 20:48:38 2024 -0700 Add support for variable-pitch fonts in 'visual-wrap-prefix-mode' * lisp/emacs-lisp/subr-x.el (string-pixel-width): Allow passing BUFFER to use the face remappings from that buffer when calculating the width. * lisp/visual-wrap.el (visual-wrap--prefix): Rename to... (visual-wrap--adjust-prefix): ... this, and support PREFIX as a number. (visual-wrap-fill-context-prefix): Make obsolete in favor of... (visual-wrap--content-prefix): ... this. (visual-wrap-prefix-function): Extract inside of loop into... (visual-wrap--apply-to-line): ... this. * doc/lispref/display.texi (Size of Displayed Text): Update documentation for 'string-pixel-width'. * etc/NEWS: Announce this change. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 195464ef7f5..d28ff9ead26 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2385,9 +2385,11 @@ The optional arguments @var{x-limit} and @var{y-limit} have the same meaning as with @code{window-text-pixel-size}. @end defun -@defun string-pixel-width string +@defun string-pixel-width string &optional buffer This is a convenience function that uses @code{window-text-pixel-size} -to compute the width of @var{string} (in pixels). +to compute the width of @var{string} (in pixels). If @var{buffer} is +non-@code{nil}, use any face remappings (@pxref{Face Remapping}) from +that buffer when computing the width of @var{string}. @end defun @defun line-pixel-height diff --git a/etc/NEWS b/etc/NEWS index 02007830bfc..b89a80aa14d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -83,6 +83,12 @@ aggressively rather than switching to some other buffer in it. *** New language-environment and input method for Tifinagh. The Tifinagh script is used to write the Berber languages. +--- +** 'visual-wrap-prefix-mode' now supports variable-pitch fonts. +When using 'visual-wrap-prefix-mode' in buffers with variable-pitch +fonts, the wrapped text will now be lined up correctly so that it's +exactly below the text after the prefix on the first line. + * Changes in Specialized Modes and Packages in Emacs 31.1 @@ -245,6 +251,12 @@ language A will be applied to language B instead. This is useful for reusing font-lock rules and indentation rules of language A for language B, when language B is a strict superset of language A. + ++++ +** New optional BUFFER argument for 'string-pixel-width'. +If supplied, 'string-pixel-width' will use any face remappings from +BUFFER when computing the string's width. + * Changes in Emacs 31.1 on Non-Free Operating Systems diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index e725c490aba..058c06bc5f6 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -337,8 +337,10 @@ This construct can only be used with lexical binding." . ,aargs))) ;;;###autoload -(defun string-pixel-width (string) - "Return the width of STRING in pixels." +(defun string-pixel-width (string &optional buffer) + "Return the width of STRING in pixels. +If BUFFER is non-nil, use the face remappings from that buffer when +determining the width." (declare (important-return-value t)) (if (zerop (length string)) 0 @@ -352,6 +354,11 @@ This construct can only be used with lexical binding." ;; Disable line-prefix and wrap-prefix, for the same reason. (setq line-prefix nil wrap-prefix nil) + (if buffer + (setq-local face-remapping-alist + (with-current-buffer buffer + face-remapping-alist)) + (kill-local-variable 'face-remapping-alist)) (insert (propertize string 'line-prefix nil 'wrap-prefix nil)) (car (buffer-text-pixel-size nil nil t))))) diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el index d95cf4bb569..cac3bc767b8 100644 --- a/lisp/visual-wrap.el +++ b/lisp/visual-wrap.el @@ -97,24 +97,85 @@ extra indent = 2 (if (visual-wrap--face-extend-p f) f)) eol-face))))))) -(defun visual-wrap--prefix (fcp) - (let ((fcp-len (string-width fcp))) - (cond - ((= 0 visual-wrap-extra-indent) - fcp) - ((< 0 visual-wrap-extra-indent) - (concat fcp (make-string visual-wrap-extra-indent ?\s))) - ((< 0 (+ visual-wrap-extra-indent fcp-len)) - (substring fcp - 0 - (+ visual-wrap-extra-indent fcp-len))) - (t - "")))) +(defun visual-wrap--adjust-prefix (prefix) + "Adjust PREFIX with `visual-wrap-extra-indent'." + (if (numberp prefix) + (+ visual-wrap-extra-indent prefix) + (let ((prefix-len (string-width prefix))) + (cond + ((= 0 visual-wrap-extra-indent) + prefix) + ((< 0 visual-wrap-extra-indent) + (concat prefix (make-string visual-wrap-extra-indent ?\s))) + ((< 0 (+ visual-wrap-extra-indent prefix-len)) + (substring prefix + 0 (+ visual-wrap-extra-indent prefix-len))) + (t + ""))))) + +(defun visual-wrap--apply-to-line (position) + "Apply visual-wrapping properties to the logical line starting at POSITION." + (save-excursion + (goto-char position) + (when-let ((first-line-prefix (fill-match-adaptive-prefix)) + (next-line-prefix (visual-wrap--content-prefix + first-line-prefix position))) + (when (numberp next-line-prefix) + (put-text-property + position (+ position (length first-line-prefix)) 'display + `(min-width ((,next-line-prefix . width))))) + (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix)) + (put-text-property + position (line-end-position) 'wrap-prefix + (if (numberp next-line-prefix) + `(space :align-to (,next-line-prefix . width)) + next-line-prefix))))) + +(defun visual-wrap--content-prefix (prefix position) + "Get the next-line prefix for the specified first-line PREFIX. +POSITION is the position in the buffer where PREFIX is located. + +This returns a string prefix to use for subsequent lines; an integer, +indicating the number of canonical-width spaces to use; or nil, if +PREFIX was empty." + (cond + ((string= prefix "") + nil) + ((string-match (rx bos (+ blank) eos) prefix) + ;; If the first-line prefix is all spaces, return its width in + ;; characters. This way, we can set the prefix for all lines to use + ;; the canonical-width of the font, which helps for variable-pitch + ;; fonts where space characters are usually quite narrow. + (string-width prefix)) + ((or (and adaptive-fill-first-line-regexp + (string-match adaptive-fill-first-line-regexp prefix)) + (and comment-start-skip + (string-match comment-start-skip prefix))) + ;; If we want to repeat the first-line prefix on subsequent lines, + ;; return its string value. However, we remove any `wrap-prefix' + ;; property that might have been added earlier. Otherwise, we end + ;; up with a string containing a `wrap-prefix' string containing a + ;; `wrap-prefix' string... + (remove-text-properties 0 (length prefix) '(wrap-prefix) prefix) + prefix) + (t + ;; Otherwise, we want the prefix to be whitespace of the same width + ;; as the first-line prefix. If possible, compute the real pixel + ;; width of the first-line prefix in canonical-width characters. + ;; This is useful if the first-line prefix uses some very-wide + ;; characters. + (if-let ((font (font-at position)) + (info (query-font font))) + (max (string-width prefix) + (ceiling (string-pixel-width prefix (current-buffer)) + (aref info 7))) + (string-width prefix))))) (defun visual-wrap-fill-context-prefix (beg end) "Compute visual wrap prefix from text between BEG and END. This is like `fill-context-prefix', but with prefix length adjusted by `visual-wrap-extra-indent'." + (declare (obsolete nil "31.1")) (let* ((fcp ;; `fill-context-prefix' ignores prefixes that look like ;; paragraph starts, in order to avoid inadvertently @@ -128,7 +189,7 @@ by `visual-wrap-extra-indent'." ;; Note: fill-context-prefix may return nil; See: ;; http://article.gmane.org/gmane.emacs.devel/156285 "")) - (prefix (visual-wrap--prefix fcp)) + (prefix (visual-wrap--adjust-prefix fcp)) (face (visual-wrap--prefix-face fcp beg end))) (if face (propertize prefix 'face face) @@ -147,28 +208,8 @@ by `visual-wrap-extra-indent'." (forward-line 0) (setq beg (point)) (while (< (point) end) - (let ((lbp (point))) - (put-text-property - (point) (progn (search-forward "\n" end 'move) (point)) - 'wrap-prefix - (let ((pfx (visual-wrap-fill-context-prefix - lbp (point)))) - ;; Remove any `wrap-prefix' property that might have been - ;; added earlier. Otherwise, we end up with a string - ;; containing a `wrap-prefix' string containing a - ;; `wrap-prefix' string ... - (remove-text-properties - 0 (length pfx) '(wrap-prefix) pfx) - (let ((dp (get-text-property 0 'display pfx))) - (when (and dp (eq dp (get-text-property (1- lbp) 'display))) - ;; There's a `display' property which covers not just the - ;; prefix but also the previous newline. So it's not - ;; just making the prefix more pretty and could interfere - ;; or even defeat our efforts (e.g. it comes from - ;; `adaptive-fill-mode'). - (remove-text-properties - 0 (length pfx) '(display) pfx))) - pfx)))) + (visual-wrap--apply-to-line (point)) + (forward-line)) `(jit-lock-bounds ,beg . ,end)) ;;;###autoload commit 0756f3085ea948c945e309e2ce347fc5ab836574 Author: Philip Kaludercic Date: Sun Aug 4 16:52:38 2024 +0200 Clarify that 'pcase-lambda' only destructs * lisp/emacs-lisp/pcase.el (pcase-lambda): Copy notice from 'pcase-let', indicating that pcase-lambda won't pattern match like 'pcase', but just try to destruct with uncertain side effects if this fails. (Bug#71503) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 5a7f3995311..fd6b0c8db5c 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -241,9 +241,14 @@ not signal an error." ;;;###autoload (defmacro pcase-lambda (lambda-list &rest body) "Like `lambda' but allow each argument to be a pattern. -I.e. accepts the usual &optional and &rest keywords, but every -formal argument can be any pattern accepted by `pcase' (a mere -variable name being but a special case of it)." +I.e. accepts the usual &optional and &rest keywords, but every formal +argument can be any pattern destructed by `pcase-let' (a mere variable +name being but a special case of it). + +Each argument should match its respective pattern in the parameter +list (i.e. be of a compatible structure); a mismatch may signal an error +or may go undetected, binding arguments to arbitrary values, such as +nil." (declare (doc-string 2) (indent defun) (debug (&define (&rest pcase-PAT) lambda-doc def-body))) (let* ((bindings ()) commit 1b806a200edcb893471237f47e969dbb9d6a99f1 Author: Michael Albinus Date: Sun Aug 4 13:23:43 2024 +0200 Remove further compat code from Tramp * lisp/net/tramp-adb.el (tramp-adb-handle-process-file): Use `process-file-return-signal-string'. * lisp/net/tramp-cache.el (tramp-dump-connection-properties): Use "lisp-data" for persistency file. * lisp/net/tramp-cmds.el (tramp-cleanup-this-connection) (tramp-rename-these-files, tramp-recompile-elpa): Declare `completion'. * lisp/net/tramp-container.el (tramp-kubernetes--container) (tramp-kubernetes--pod, tramp-kubernetes--namespace): Make more robust. * lisp/net/tramp-crypt.el (tramp-crypt-remove-directory): Declare `completion'. * lisp/net/tramp-gvfs.el (file-notyify-callback): Declare. * lisp/net/tramp-sh.el (process-file-return-signal-string) (vc-handled-backends): Don't declare. * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory): Use `copy-directory-create-symlink'. * lisp/net/tramp.el (tramp-skeleton-write-region): Use `lock-file' and `unlock-file'.. (tramp-handle-make-lock-file-name): Use `remote-file-name-inhibit-locks'. (tramp-handle-unlock-file): Use `remote-file-name-inhibit-locks' and `userlock--handle-unlock-error'. (tramp-handle-shell-command): Use `shell-command-buffer-name-async' and `shell-command-buffer-name'. (tramp-read-passwd): Remove workaround. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 3b8a930cb57..e8bb8ec3184 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -763,9 +763,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (kill-buffer (tramp-get-connection-buffer v)) (setq ret 1))) - ;; Handle signals. `process-file-return-signal-string' exists - ;; since Emacs 28.1. - (when (and (bound-and-true-p process-file-return-signal-string) + (when (and process-file-return-signal-string (natnump ret) (> ret 128)) (setq ret (nth (- ret 128) (tramp-adb-get-signal-strings v)))))) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 9d7fb488412..85a318b8a93 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -584,8 +584,7 @@ PROPERTIES is a list of file properties (strings)." ;; Dump it. (with-temp-file tramp-persistency-file-name (insert - ;; Starting with Emacs 28, we could use `lisp-data'. - (format ";; -*- emacs-lisp -*- <%s %s>\n" + (format ";; -*- lisp-data -*- <%s %s>\n" (time-stamp-string "%02y/%02m/%02d %02H:%02M:%02S") tramp-persistency-file-name) ";; Tramp connection history. Don't change this file.\n" diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 866532041c5..3cc8704aaba 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -157,18 +157,12 @@ When called interactively, a Tramp connection has to be selected." ;;;###tramp-autoload (defun tramp-cleanup-this-connection () "Flush all connection related objects of the current buffer's connection." - ;; (declare (completion tramp-command-completion-p))) + (declare (completion tramp-command-completion-p)) (interactive) (and (tramp-tramp-file-p default-directory) (tramp-cleanup-connection (tramp-dissect-file-name default-directory 'noexpand)))) -;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. -;;;###tramp-autoload -(function-put - #'tramp-cleanup-this-connection 'completion-predicate - #'tramp-command-completion-p) - ;;;###tramp-autoload (defvar tramp-cleanup-all-connections-hook nil "List of functions to be called after all Tramp connections are cleaned up.") @@ -521,7 +515,7 @@ Interactively, TARGET is selected from `tramp-default-rename-alist' without confirmation if the prefix argument is non-nil. For details, see `tramp-rename-files'." - ;; (declare (completion tramp-command-completion-p)) + (declare (completion tramp-command-completion-p)) (interactive (let ((source default-directory) target @@ -552,11 +546,6 @@ For details, see `tramp-rename-files'." (tramp-rename-files default-directory target)) -;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. -;;;###tramp-autoload -(function-put - #'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p) - ;;; Run as sudo (defcustom tramp-file-name-with-method "sudo" @@ -625,9 +614,8 @@ If the buffer runs `dired', the buffer is reverted." ;;; Recompile on ELPA -;; This function takes action since Emacs 28.1, when -;; `read-extended-command-predicate' is set to -;; `command-completion-default-include-p'. +;; This function takes action, when `read-extended-command-predicate' +;; is set to `command-completion-default-include-p'. ;;;###tramp-autoload (defun tramp-recompile-elpa-command-completion-p (_symbol _buffer) "A predicate for `tramp-recompile-elpa'. @@ -642,7 +630,7 @@ Tramp is an installed ELPA package." (defun tramp-recompile-elpa () "Recompile the installed Tramp ELPA package. This is needed if there are compatibility problems." - ;; (declare (completion tramp-recompile-elpa-command-completion-p)) + (declare (completion tramp-recompile-elpa-command-completion-p)) (interactive) ;; We expect just one Tramp package is installed. (when-let @@ -662,12 +650,6 @@ This is needed if there are compatibility problems." "--eval" (format "(byte-recompile-directory %S 0 t)" dir)) (message "Package `tramp' recompiled."))))) -;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. -;;;###tramp-autoload -(function-put - #'tramp-recompile-elpa 'completion-predicate - #'tramp-recompile-elpa-command-completion-p) - ;; Tramp version is useful in a number of situations. ;;;###tramp-autoload diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el index 27bad70753c..57c34a1b8e4 100644 --- a/lisp/net/tramp-container.el +++ b/lisp/net/tramp-container.el @@ -339,27 +339,26 @@ see its function help for a description of the format." ;;;###tramp-autoload (defun tramp-kubernetes--container (vec) "Extract the container name from a kubernetes host name in VEC." - (or (let ((host (tramp-file-name-host vec))) - (and (string-match tramp-kubernetes--host-name-regexp host) - (match-string 1 host))) + (or (when-let ((host (and vec (tramp-file-name-host vec))) + ((string-match tramp-kubernetes--host-name-regexp host))) + (match-string 1 host)) "")) ;;;###tramp-autoload (defun tramp-kubernetes--pod (vec) "Extract the pod name from a kubernetes host name in VEC." - (or (let ((host (tramp-file-name-host vec))) - (and (string-match tramp-kubernetes--host-name-regexp host) - (match-string 2 host))) + (or (when-let ((host (and vec (tramp-file-name-host vec))) + ((string-match tramp-kubernetes--host-name-regexp host))) + (match-string 2 host)) "")) ;;;###tramp-autoload (defun tramp-kubernetes--namespace (vec) "Extract the namespace from a kubernetes host name in VEC. Use `tramp-kubernetes-namespace' otherwise." - (or (when-let ((_ vec) - (host (tramp-file-name-host vec))) - (and (string-match tramp-kubernetes--host-name-regexp host) - (match-string 3 host))) + (or (when-let ((host (and vec (tramp-file-name-host vec))) + ((string-match tramp-kubernetes--host-name-regexp host))) + (match-string 3 host)) tramp-kubernetes-namespace)) ;; We must change `vec' and `default-directory' to the previous hop, diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index e9d9eb2a2c2..2bcdfb061d7 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -112,9 +112,8 @@ initializing a new encrypted remote directory." "Non-nil when encryption support is available.") (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) -;; This function takes action since Emacs 28.1, when -;; `read-extended-command-predicate' is set to -;; `command-completion-default-include-p'. +;; This function takes action, when `read-extended-command-predicate' +;; is set to `command-completion-default-include-p'. (defun tramp-crypt-command-completion-p (symbol _buffer) "A predicate for Tramp interactive commands. They are completed by `M-x TAB' only when encryption support is enabled." @@ -522,7 +521,7 @@ directory. File names will be also encrypted." "Unmark expanded remote directory NAME for encryption. Existing files in that directory and its subdirectories will be kept in their encrypted form." - ;; (declare (completion tramp-crypt-command-completion-p)) + (declare (completion tramp-crypt-command-completion-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled (tramp-user-error nil "Feature is not enabled")) @@ -536,11 +535,6 @@ kept in their encrypted form." (setq tramp-crypt-directories (delete name tramp-crypt-directories)) (tramp-register-file-name-handlers))) -;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. -(function-put - #'tramp-crypt-remove-directory 'completion-predicate - #'tramp-crypt-command-completion-p) - ;; `auth-source' requires a user. (defun tramp-crypt-dissect-file-name (name) "Return a `tramp-file-name' structure for NAME. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 1f61c5fdd36..6e331396d01 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -108,6 +108,7 @@ (require 'url-util) ;; Pacify byte-compiler. +(declare-function file-notify-callback "filenotify") (declare-function zeroconf-init "zeroconf") (declare-function zeroconf-list-service-types "zeroconf") (declare-function zeroconf-list-services "zeroconf") @@ -1571,8 +1572,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." ;; `unread-command-events' does not accept several events at ;; once. Therefore, we apply the callback directly. (when (member action events) - (tramp-compat-funcall - 'file-notify-callback (list proc action file file1))))) + (file-notify-callback (list proc action file file1))))) ;; Save rest of the string. (when (string-empty-p string) (setq string nil)) diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index 5e1c9904aa7..901ccc49ad0 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -124,9 +124,8 @@ The outline level is equal to the verbosity of the Tramp message." (declare (tramp-suppress-trace t)) (1+ (string-to-number (match-string 3)))) -;; This function takes action since Emacs 28.1, when -;; `read-extended-command-predicate' is set to -;; `command-completion-default-include-p'. +;; This function takes action, when `read-extended-command-predicate' +;; is set to `command-completion-default-include-p'. (defun tramp-debug-buffer-command-completion-p (_symbol buffer) "A predicate for Tramp interactive commands. They are completed by `M-x TAB' only in Tramp debug buffers." diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b011b7ca3d4..e4e14912579 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -38,9 +38,6 @@ (declare-function dired-compress-file "dired-aux") (declare-function dired-remove-file "dired-aux") (defvar dired-compress-file-suffixes) -;; Added in Emacs 28.1. -(defvar process-file-return-signal-string) -(defvar vc-handled-backends) (defvar vc-bzr-program) (defvar vc-git-program) (defvar vc-hg-program) @@ -2026,8 +2023,7 @@ ID-FORMAT valid values are `string' and `integer'." (unless (file-exists-p dirname) (tramp-error v 'file-missing dirname)) - ;; `copy-directory-create-symlink' exists since Emacs 28.1. - (if (and (bound-and-true-p copy-directory-create-symlink) + (if (and copy-directory-create-symlink (setq target (file-symlink-p dirname)) (tramp-equal-remote dirname newname)) (make-symbolic-link @@ -3288,9 +3284,8 @@ will be used." (kill-buffer (tramp-get-connection-buffer v)) (setq ret 1))) - ;; Handle signals. `process-file-return-signal-string' exists - ;; since Emacs 28.1. - (when (and (bound-and-true-p process-file-return-signal-string) + ;; Handle signals. + (when (and process-file-return-signal-string (natnump ret) (>= ret 128)) (setq ret (nth (- ret 128) (tramp-sh-get-signal-strings v))))))) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 1f4ee8bc8e5..da62773ccc6 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -431,8 +431,7 @@ arguments to pass to the OPERATION." (unless (file-exists-p dirname) (tramp-error v 'file-missing dirname)) - ;; `copy-directory-create-symlink' exists since Emacs 28.1. - (if (and (bound-and-true-p copy-directory-create-symlink) + (if (and copy-directory-create-symlink (setq target (file-symlink-p dirname)) (tramp-equal-remote dirname newname)) (make-symbolic-link diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3260cf5daac..5d6ab3991df 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2335,26 +2335,22 @@ Must be handled by the callers." ((member operation '(access-file byte-compiler-base-file-name delete-directory delete-file diff-latest-backup-file directory-file-name - directory-files directory-files-and-attributes - dired-compress-file dired-uncache file-acl - file-accessible-directory-p file-attributes - file-directory-p file-executable-p file-exists-p - file-local-copy file-modes file-name-as-directory + directory-files directory-files-and-attributes dired-compress-file + dired-uncache file-acl file-accessible-directory-p file-attributes + file-directory-p file-executable-p file-exists-p file-local-copy + file-locked-p file-modes file-name-as-directory file-name-case-insensitive-p file-name-directory file-name-nondirectory file-name-sans-versions - file-notify-add-watch file-ownership-preserved-p - file-readable-p file-regular-p file-remote-p - file-selinux-context file-symlink-p file-system-info - file-truename file-writable-p find-backup-file-name - get-file-buffer insert-directory insert-file-contents - load make-directory set-file-acl set-file-modes - set-file-selinux-context set-file-times - substitute-in-file-name unhandled-file-name-directory - vc-registered + file-notify-add-watch file-ownership-preserved-p file-readable-p + file-regular-p file-remote-p file-selinux-context file-symlink-p + file-system-info file-truename file-writable-p + find-backup-file-name get-file-buffer + insert-directory insert-file-contents load lock-file make-directory + make-lock-file-name set-file-acl set-file-modes + set-file-selinux-context set-file-times substitute-in-file-name + unhandled-file-name-directory unlock-file vc-registered ;; Emacs 28- only. make-directory-internal - ;; Emacs 28+ only. - file-locked-p lock-file make-lock-file-name unlock-file ;; Emacs 29+ only. abbreviate-file-name ;; Tramp internal magic file name function. @@ -2699,9 +2695,8 @@ Run BODY." ;;; File name handler functions for completion mode: -;; This function takes action since Emacs 28.1, when -;; `read-extended-command-predicate' is set to -;; `command-completion-default-include-p'. +;; This function takes action, when `read-extended-command-predicate' +;; is set to `command-completion-default-include-p'. (defun tramp-command-completion-p (_symbol buffer) "A predicate for Tramp interactive commands. They are completed by `M-x TAB' only if the current buffer is remote." @@ -3823,8 +3818,7 @@ BODY is the backend specific code." (tramp-tramp-file-p lockname) (not file-locked)) (setq file-locked t) - ;; `lock-file' exists since Emacs 28.1. - (tramp-compat-funcall 'lock-file lockname)) + (lock-file lockname)) ;; The body. ,@body @@ -3862,8 +3856,7 @@ BODY is the backend specific code." ;; Unlock file. (when file-locked - ;; `unlock-file' exists since Emacs 28.1. - (tramp-compat-funcall 'unlock-file lockname)) + (unlock-file lockname)) ;; Sanity check. (unless (equal curbuf (current-buffer)) @@ -4825,8 +4818,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") (defun tramp-handle-make-lock-file-name (file) "Like `make-lock-file-name' for Tramp files." (and create-lockfiles - ;; This variable has been introduced with Emacs 28.1. - (not (bound-and-true-p remote-file-name-inhibit-locks)) + (not remote-file-name-inhibit-locks) (tramp-run-real-handler 'make-lock-file-name (list file)))) (defun tramp-handle-unlock-file (file) @@ -4844,12 +4836,10 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") (unless (or (not create-lockfiles) (bound-and-true-p remote-file-name-inhibit-locks)) (signal 'file-error `("Cannot remove lock file for" ,file)))) - ;; `userlock--handle-unlock-error' exists since Emacs 28.1. It - ;; checks for `create-lockfiles' since Emacs 30.1, we don't need - ;; this check here, then. - (error (unless (or (not create-lockfiles) - (bound-and-true-p remote-file-name-inhibit-locks)) - (tramp-compat-funcall 'userlock--handle-unlock-error err))))) + ;; `userlock--handle-unlock-error' checks for `create-lockfiles' + ;; since Emacs 30.1, we don't need this check here, then. + (error (unless (or (not create-lockfiles) remote-file-name-inhibit-locks) + (userlock--handle-unlock-error err))))) (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) "Like `load' for Tramp files." @@ -5312,12 +5302,9 @@ support symbolic links." (setq current-buffer-p t) (current-buffer)) (t (get-buffer-create - ;; These variables have been introduced with Emacs 28.1. (if asynchronous - (or (bound-and-true-p shell-command-buffer-name-async) - "*Async Shell Command*") - (or (bound-and-true-p shell-command-buffer-name) - "*Shell Command Output*")))))) + (or shell-command-buffer-name-async "*Async Shell Command*") + (or shell-command-buffer-name "*Shell Command Output*")))))) (error-buffer (cond ((bufferp error-buffer) error-buffer) @@ -6849,10 +6836,6 @@ Consults the auth-source package." (lambda () (password-cache-add key auth-passwd))) auth-passwd)) - ;; Workaround. Prior Emacs 28.1, auth-source has saved empty - ;; passwords. See discussion in Bug#50399. - (when (tramp-string-empty-or-nil-p auth-passwd) - (setq tramp-password-save-function nil)) (tramp-set-connection-property vec "first-password-request" nil)))) (defun tramp-read-passwd-without-cache (proc &optional prompt)