]> git.eshelyaron.com Git - emacs.git/commitdiff
Silence compiler error
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 9 Sep 2024 13:22:35 +0000 (15:22 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 14 Sep 2024 20:19:29 +0000 (22:19 +0200)
* lisp/net/tramp.el (tramp-file-name*): Embed `function-put' calls
with `tramp--with-startup'.
(tramp-active-command-completion-p)
* lisp/net/tramp-cache.el (tramp-get-hash-table): Remove declare
form.  Add `tramp-suppress-trace' function property.

(cherry picked from commit d33d8c089b909b1fa64a799146557fcb68096269)

lisp/net/tramp-cache.el
lisp/net/tramp.el

index 2d9d58b51ac60dd787d158fd22f176f370003736..a5bdacb4d91e8d33d95148783201f24b412d59ad 100644 (file)
@@ -131,7 +131,7 @@ details see the info pages."
 If it doesn't exist yet, it is created and initialized with
 matching entries of `tramp-connection-properties'.
 If KEY is `tramp-cache-undefined', don't create anything, and return nil."
-  (declare (tramp-suppress-trace t))
+  ;; (declare (tramp-suppress-trace t))
   (unless (eq key tramp-cache-undefined)
     (or (gethash key tramp-cache-data)
        (let ((hash
@@ -144,6 +144,11 @@ If KEY is `tramp-cache-undefined', don't create anything, and return nil."
                (tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
          hash))))
 
+;; We cannot use the `declare' form for `tramp-suppress-trace' in
+;; autoloaded functions, because the tramp-loaddefs.el generation
+;; would fail.
+(function-put #'tramp-get-hash-table 'tramp-suppress-trace t)
+
 ;;;###tramp-autoload
 (defun tramp-get-file-property (key file property &optional default)
   "Get the PROPERTY of FILE from the cache context of KEY.
index 1dfdf7c68c87b21f0b22a45efcd7a9cc972cf5e6..8c649f284156030d4d5e104d17c6d0ff9b152053 100644 (file)
@@ -1513,17 +1513,18 @@ calling HANDLER.")
 ;; so .... here we are.
 ;;;###tramp-autoload(require 'cl-lib)
 ;;;###tramp-autoload
-(progn
-  (cl-defstruct (tramp-file-name (:type list) :named)
-    method user domain host port localname hop))
+(cl-defstruct (tramp-file-name (:type list) :named)
+  method user domain host port localname hop)
 
-(function-put #'tramp-file-name-method 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-user 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-domain 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-host 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-port 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-localname 'tramp-suppress-trace t)
-(function-put #'tramp-file-name-hop 'tramp-suppress-trace t)
+(tramp--with-startup
+ (function-put #'tramp-file-name-method 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-user 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-domain 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-host 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-port 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-localname 'tramp-suppress-trace t)
+ (function-put #'tramp-file-name-hop 'tramp-suppress-trace t)
+ (function-put #'make-tramp-file-name 'tramp-suppress-trace t))
 
 ;;;###tramp-autoload
 (defconst tramp-null-hop
@@ -2713,11 +2714,16 @@ They are completed by `M-x TAB' only if the current buffer is remote."
 (defun tramp-active-command-completion-p (_symbol _buffer)
   "A predicate for Tramp interactive commands.
 They are completed by `M-x TAB' only if there's an active connection or buffer."
-  (declare (tramp-suppress-trace t))
+  ;; (declare (tramp-suppress-trace t))
   (or (and (hash-table-p tramp-cache-data)
           (not (zerop (hash-table-count tramp-cache-data))))
       (tramp-list-remote-buffers)))
 
+;; We cannot use the `declare' form for `tramp-suppress-trace' in
+;; autoloaded functions, because the tramp-loaddefs.el generation
+;; would fail.
+(function-put #'tramp-active-command-completion-p 'tramp-suppress-trace t)
+
 (defun tramp-connectable-p (vec-or-filename)
   "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