GNU bug report logs - #50869
28.0.50; tramp: void-function tramp-file-name-method--cmacro

Previous Next

Package: emacs;

Reported by: "Shuguang Sun" <shuguang79 <at> qq.com>

Date: Tue, 28 Sep 2021 15:49:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50869 in the body.
You can then email your comments to 50869 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Tue, 28 Sep 2021 15:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Shuguang Sun" <shuguang79 <at> qq.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 28 Sep 2021 15:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Shuguang Sun" <shuguang79 <at> qq.com>
To: "bug-gnu-emacs" <bug-gnu-emacs <at> gnu.org>
Subject: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
Date: Tue, 28 Sep 2021 23:15:44 +0800
[Message part 1 (text/plain, inline)]
Hi,


After load - unload - load tramp, I got an compile error:
Compiler-macro error for tramp-file-name-method: (void-function tramp-file-name-method--cmacro) [7 times]


How to replicate it:
- Start emacs
- load-libary tramp
- tramp-unload-tramp
- load-libary tramp
- tramp-unload-tramp- load-libary tramp



Best Regards,
Shuguang Sun



In GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32)
&nbsp;of 2021-09-21 built on 
Repository revision: 5b962a7ad8d0acfe40a41ce139059b9c8e46f666
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19043
System Description: Microsoft Windows 10 Pro (v10.0.2009.19043.1237)

Configured using:
&nbsp;'configure --without-pop --with-native-image-api
&nbsp;--with-native-compilation --without-compress-install
&nbsp;'--program-transform-name=s/^ctags$/ctags.emacs/''
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sat, 02 Oct 2021 16:37:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: "Shuguang Sun" via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Shuguang Sun <shuguang79 <at> qq.com>, 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sat, 02 Oct 2021 18:36:37 +0200
"Shuguang Sun" via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Hi,

Hi,

> After load - unload - load tramp, I got an compile error:
> Compiler-macro error for tramp-file-name-method: (void-function
> tramp-file-name-method--cmacro) [7 times]
>
> How to replicate it:
> - Start emacs
> - load-libary tramp
> - tramp-unload-tramp
> - load-libary tramp
> - tramp-unload-tramp
> - load-libary tramp

tramp-file-name-method--cmacro is a generated accessor function of the
defstruct tramp-file-name. I'm not sure that this is native Tramp
error. The backtrace shows as

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (void-function tramp-file-name-method--cmacro)
  tramp-file-name-method--cmacro((tramp-file-name-method (tramp-dissect-file-name filename)) (tramp-dissect-file-name filename))
  apply(tramp-file-name-method--cmacro (tramp-file-name-method (tramp-dissect-file-name filename)) (tramp-dissect-file-name filename))
  macroexp--compiler-macro(tramp-file-name-method--cmacro (tramp-file-name-method (tramp-dissect-file-name filename)))
  #f(compiled-function (form func) #<bytecode 0x5031ad1730f4d5a>)(((tramp-file-name-method (tramp-dissect-file-name filename))) tramp-file-name-method)
  macroexp--expand-all((tramp-file-name-method (tramp-dissect-file-name filename)))
  macroexp--all-forms((string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method) 1)
  #f(compiled-function (form func) #<bytecode 0x5031ad1730f4d5a>)(((string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)) string=)
  macroexp--expand-all((string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))
  macroexp--all-forms((and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)) 1)
  #f(compiled-function (form func) #<bytecode 0x5031ad1730f4d5a>)(((and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) and)
  macroexp--expand-all((and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)))
  macroexp--all-forms((lambda (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) 2)
  macroexp--expand-all(#'(lambda (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))))
  macroexp--all-forms((defalias 'tramp-adb-file-name-p #'(lambda (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)))) 1)
  #f(compiled-function (form func) #<bytecode 0x5031ad1730f4d5a>)(((defalias 'tramp-adb-file-name-p #'(lambda (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method ...) tramp-adb-method))))) defalias)
  macroexp--expand-all((defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))))
  macroexp--all-forms((prog1 (defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) (eval-and-compile (function-put 'tramp-adb-file-name-p 'speed '-1) (put 'tramp-adb-file-name-p 'byte-optimizer 'byte-compile-inline-expand))) 1)
  #f(compiled-function (form func) #<bytecode 0x5031ad1730f4d5a>)(((prog1 (defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) (eval-and-compile (function-put 'tramp-adb-file-name-p 'speed '-1) (put 'tramp-adb-file-name-p 'byte-optimizer 'byte-compile-inline-expand)))) prog1)
  macroexp--expand-all((prog1 (defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) (eval-and-compile (function-put 'tramp-adb-file-name-p 'speed '-1) (put 'tramp-adb-file-name-p 'byte-optimizer 'byte-compile-inline-expand))))
  macroexpand-all((prog1 (defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) (eval-and-compile (function-put 'tramp-adb-file-name-p 'speed '-1) (put 'tramp-adb-file-name-p 'byte-optimizer 'byte-compile-inline-expand))))
  internal-macroexpand-for-load((prog1 (defun tramp-adb-file-name-p (filename) "Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= (tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method))) (eval-and-compile (function-put 'tramp-adb-file-name-p 'speed '-1) (put 'tramp-adb-file-name-p 'byte-optimizer 'byte-compile-inline-expand))) t)
  eval-buffer(#<buffer  *load*> nil "/home/albinus/src/emacs-28/lisp/net/tramp-loaddefs..." nil t)  ; Reading at buffer position 4857
  load-with-code-conversion("/home/albinus/src/emacs-28/lisp/net/tramp-loaddefs..." "/home/albinus/src/emacs-28/lisp/net/tramp-loaddefs..." nil t)
  load-with-shorthands-and-code-conversion("/home/albinus/src/emacs-28/lisp/net/tramp-loaddefs..." "/home/albinus/src/emacs-28/lisp/net/tramp-loaddefs..." nil t)
  require(tramp-loaddefs)
  byte-code("\300\301!\210\302\303\304\305\306DD\307\310\311%\210\302\312\304\305\313DD\314\310\315%\210\302\316\304\305\317DD\320\321\322\310\311&\7\210\302\323\304\305\324DD..." [require tramp-loaddefs custom-declare-variable tramp-mode funcall function #f(compiled-function () #<bytecode 0x1f400016fe5d4>) "Whether Tramp is enabled.\nIf it is set to nil, all..." :type boolean tramp-verbose #f(compiled-function () #<bytecode 0x1f400016fead4>) "Verbosity level for Tramp messages.\nAny level x in..." integer tramp-debug-to-file #f(compiled-function () #<bytecode 0x1f400016fe914>) "Whether Tramp debug messages shall be saved to fil..." :version "28.1" tramp-backup-directory-alist #f(compiled-function () #<bytecode 0x1f400016fe914>) "Alist of filename patterns and backup directory na..." (repeat (cons (regexp :tag "Regexp matching filename") (directory :tag "Backup directory name"))) tramp-auto-save-directory #f(compiled-function () #<bytecode 0x1f400016fe914>) "Put auto-save files in this directory, if set.\nThe..." (choice (const :tag "Use default" nil) (directory :tag "Auto save directory name")) tramp-encoding-shell #f(compiled-function () #<bytecode 0x12a348c7f818d327>) "Use this program for encoding and decoding command..." (file :must-match t) tramp-encoding-command-switch #f(compiled-function () #<bytecode -0x1c3ad6ddc556ef84>) "Use this switch together with `tramp-encoding-shel..." string tramp-encoding-command-interactive #f(compiled-function () #<bytecode -0xce224b8508034ef>) "Use this switch together with `tramp-encoding-shel..." "24.1" (choice (const nil) string)] 8)
  load("tramp")
  load-library("tramp")
  funcall-interactively(load-library "tramp")
  call-interactively(load-library record nil)
  command-execute(load-library record)
  execute-extended-command(nil "load-library" nil)
  funcall-interactively(execute-extended-command nil "load-library" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

> Best Regards,
> Shuguang Sun

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sat, 02 Oct 2021 16:37:02 GMT) Full text and rfc822 format available.

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Thu, 17 Mar 2022 14:40:01 GMT) Full text and rfc822 format available.

Notification sent to "Shuguang Sun" <shuguang79 <at> qq.com>:
bug acknowledged by developer. (Thu, 17 Mar 2022 14:40:02 GMT) Full text and rfc822 format available.

Message #16 received at 50869-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: 50869-done <at> debbugs.gnu.org
Cc: shuguang79 <at> qq.com
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Thu, 17 Mar 2022 15:39:26 +0100
Version: 28.2

Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi,

>> After load - unload - load tramp, I got an compile error:
>> Compiler-macro error for tramp-file-name-method: (void-function
>> tramp-file-name-method--cmacro) [7 times]
>>
>> How to replicate it:
>> - Start emacs
>> - load-libary tramp
>> - tramp-unload-tramp
>> - load-libary tramp
>> - tramp-unload-tramp
>> - load-libary tramp
>
> tramp-file-name-method--cmacro is a generated accessor function of the
> defstruct tramp-file-name. I'm not sure that this is native Tramp
> error.

I have rearranged Tramp's auoloads, it works now as expected. Pushed to
the git repositories. It will also be available with next Tramp ELPA
version 2.5.2.3.

Closing the bug.

>> Best Regards,
>> Shuguang Sun

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sat, 02 Apr 2022 21:10:01 GMT) Full text and rfc822 format available.

Message #19 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: shuguang79 <at> qq.com, 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sat, 02 Apr 2022 17:09:13 -0400
>> After load - unload - load tramp, I got an compile error:
>> Compiler-macro error for tramp-file-name-method: (void-function
>> tramp-file-name-method--cmacro) [7 times]

Note: this is not a compile error.  It's an error that happened during
expansion of a compiler-macro.  These are optional, so those errors only
affect the performance of the code but shouldn't affect its behavior.

IOW this sound more serious than it is.

>> How to replicate it:
>> - Start emacs
>> - load-libary tramp
>> - tramp-unload-tramp
>> - load-libary tramp
>> - tramp-unload-tramp
>> - load-libary tramp
>
> tramp-file-name-method--cmacro is a generated accessor function of the
> defstruct tramp-file-name. I'm not sure that this is native Tramp
> error. The backtrace shows as

`tramp-file-name-method--cmacro` is supposed to be a function which
inlines the code of calls to `tramp-file-name-method`.

More specifically `tramp-file-name-method--cmacro` is auto-generated
(and put on the `compiler-macro` property of the
`tramp-file-name-method` symbol) by the `cl-defsubst` used to define
`tramp-file-name-method`.

So I guess the source of the error is that unloading `tramp` undefines
the functions (both `tramp-file-name-method--cmacro` and
`tramp-file-name-method`) but leaves the `compiler-macro` property of the
`tramp-file-name-method` symbol.

We really should make it so package unloading knows how to undo
top-level `put`s.

In the men time, the `;;;###tramp-autoload` cookie placed before the
`cl-defstruct` seems to trip over another bug when I try to build the
package here:

    Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 12345819 12345820)
      scan-sexps(12345782 3)
      forward-sexp(3)
      autoload-print-form((defvar cl-struct-tramp-file-name-tags))
    [...]

Maybe it's a bug in the locally-hacked Emacs I'm using to do the build,
tho.  Still, I suspect the cure might be not much better than the disease.


        Stefan





bug No longer marked as fixed in versions 28.2 and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 03 Apr 2022 15:41:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sun, 03 Apr 2022 15:46:01 GMT) Full text and rfc822 format available.

Message #24 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: shuguang79 <at> qq.com, 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sun, 03 Apr 2022 17:44:55 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

Hi Stefan,

> Note: this is not a compile error.  It's an error that happened during
> expansion of a compiler-macro.  These are optional, so those errors only
> affect the performance of the code but shouldn't affect its behavior.
>
> IOW this sound more serious than it is.
>
> `tramp-file-name-method--cmacro` is supposed to be a function which
> inlines the code of calls to `tramp-file-name-method`.
>
> More specifically `tramp-file-name-method--cmacro` is auto-generated
> (and put on the `compiler-macro` property of the
> `tramp-file-name-method` symbol) by the `cl-defsubst` used to define
> `tramp-file-name-method`.
>
> So I guess the source of the error is that unloading `tramp` undefines
> the functions (both `tramp-file-name-method--cmacro` and
> `tramp-file-name-method`) but leaves the `compiler-macro` property of the
> `tramp-file-name-method` symbol.
>
> We really should make it so package unloading knows how to undo
> top-level `put`s.

Honestly, I have no knowledge about the byte-compiler. I've reopened the
bug, so you can work on it.

> In the men time, the `;;;###tramp-autoload` cookie placed before the
> `cl-defstruct` seems to trip over another bug when I try to build the
> package here:
>
>     Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 12345819 12345820)
>       scan-sexps(12345782 3)
>       forward-sexp(3)
>       autoload-print-form((defvar cl-struct-tramp-file-name-tags))
>     [...]
>
> Maybe it's a bug in the locally-hacked Emacs I'm using to do the build,
> tho.  Still, I suspect the cure might be not much better than the disease.

I extended tramp-test47-unload, which unloads / reloads Tramp. No error,
AFAICS. Feel free to fiddle with that test, in order to get it more
trustworthy in reproducing the problem.

>         Stefan

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Fri, 02 Sep 2022 11:45:02 GMT) Full text and rfc822 format available.

Message #27 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: shuguang79 <at> qq.com, Michael Albinus <michael.albinus <at> gmx.de>,
 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Fri, 02 Sep 2022 13:43:48 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> So I guess the source of the error is that unloading `tramp` undefines
> the functions (both `tramp-file-name-method--cmacro` and
> `tramp-file-name-method`) but leaves the `compiler-macro` property of the
> `tramp-file-name-method` symbol.
>
> We really should make it so package unloading knows how to undo
> top-level `put`s.

Do you have any ideas for how to do that?

> In the men time, the `;;;###tramp-autoload` cookie placed before the
> `cl-defstruct` seems to trip over another bug when I try to build the
> package here:
>
>     Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 12345819 12345820)
>       scan-sexps(12345782 3)
>       forward-sexp(3)
>       autoload-print-form((defvar cl-struct-tramp-file-name-tags))
>     [...]
>
> Maybe it's a bug in the locally-hacked Emacs I'm using to do the build,
> tho.  Still, I suspect the cure might be not much better than the disease.

Is this still an issue in Emacs 29?




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Sep 2022 11:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Fri, 02 Sep 2022 18:53:01 GMT) Full text and rfc822 format available.

Message #32 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: shuguang79 <at> qq.com, 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Fri, 02 Sep 2022 14:52:27 -0400
[Message part 1 (text/plain, inline)]
Michael Albinus [2022-04-03 17:44:55] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Note: this is not a compile error.  It's an error that happened during
>> expansion of a compiler-macro.  These are optional, so those errors only
>> affect the performance of the code but shouldn't affect its behavior.
>>
>> IOW this sound more serious than it is.
>>
>> `tramp-file-name-method--cmacro` is supposed to be a function which
>> inlines the code of calls to `tramp-file-name-method`.
>>
>> More specifically `tramp-file-name-method--cmacro` is auto-generated
>> (and put on the `compiler-macro` property of the
>> `tramp-file-name-method` symbol) by the `cl-defsubst` used to define
>> `tramp-file-name-method`.
>>
>> So I guess the source of the error is that unloading `tramp` undefines
>> the functions (both `tramp-file-name-method--cmacro` and
>> `tramp-file-name-method`) but leaves the `compiler-macro` property of the
>> `tramp-file-name-method` symbol.
>>
>> We really should make it so package unloading knows how to undo
>> top-level `put`s.
>
> Honestly, I have no knowledge about the byte-compiler. I've reopened the
> bug, so you can work on it.

The main point is that putting the `cl-defstruct` into the
`tramp-loaddefs.el` is really ugly and I think it's asking for trouble.
In contrast the OP's "errors" aren't actual errors, they're just
messages indicating that some optimization could not be applied.
We should really change the wording to clarify that they're warnings.

(see first hunk in patch below).

But in the mean time I'd much rather live with a harmless
"compiler-macro error" message than with a `cl-defstruct` in
a loaddefs file.

Lars Ingebrigtsen [2022-09-02 13:43:48] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> We really should make it so package unloading knows how to undo
>> top-level `put`s.
> Do you have any ideas for how to do that?

There are a few ways:
- We could let `unload-feature` remove compiler macros when present, as
  in the second hunk of the patch below.
- We could make `cl-defstruct` use `define-symbol-prop` rather than
  `put`, as in the third hunk of the patch below.


        Stefan
[comp-macro.patch (text/x-diff, inline)]
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index c3ba1b36d44..f4df40249de 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -110,7 +110,8 @@ macroexp--compiler-macro
       (let ((symbols-with-pos-enabled t))
         (apply handler form (cdr form)))
     (error
-     (message "Compiler-macro error for %S: Handler: %S\n%S" (car form) handler err)
+     (message "Warning: Optimization failure for %S: Handler: %S\n%S"
+              (car form) handler err)
      form)))
 
 (defun macroexp--funcall-if-compiled (_form)
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index b4ed0432465..76da002314b 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -171,6 +171,8 @@ loadhist-unload-element
     (cond
      ((null hist)
       (defalias fun nil)
+      (if (get fun 'compiler-macro) (put fun 'compiler-macro nil))
+      (if (get fun 'gv-expander)    (put fun 'gv-expander nil))
       ;; Override the change that `defalias' just recorded.
       (put fun 'function-history nil))
      ((equal (car hist) loadhist-unload-filename)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 80ca43c902a..b7fee7a3487 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3570,7 +3570,7 @@ cl-define-compiler-macro
        (cl-defun ,fname ,(if (memq '&whole args) (delq '&whole args)
                            (cons '_cl-whole-arg args))
          ,@body)
-       (put ',func 'compiler-macro #',fname))))
+       (define-symbol-prop ',func 'compiler-macro #',fname))))
 
 ;;;###autoload
 (defun cl-compiler-macroexpand (form)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sat, 03 Sep 2022 10:08:02 GMT) Full text and rfc822 format available.

Message #35 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: shuguang79 <at> qq.com, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sat, 03 Sep 2022 12:07:43 +0200
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> The main point is that putting the `cl-defstruct` into the
> `tramp-loaddefs.el` is really ugly and I think it's asking for trouble.

The cl-defstruct is in there because a couple of defsubsts (that use the
struct) are also in the tramp-loaddefs.el file.  So if we remove the
defstruct, we also have to adjust the defsubsts.

> In contrast the OP's "errors" aren't actual errors, they're just
> messages indicating that some optimization could not be applied.
> We should really change the wording to clarify that they're warnings.
>
> (see first hunk in patch below).

Looks good.

> - We could make `cl-defstruct` use `define-symbol-prop` rather than
>   `put`, as in the third hunk of the patch below.

Makes sense to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sat, 03 Sep 2022 19:09:02 GMT) Full text and rfc822 format available.

Message #38 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: shuguang79 <at> qq.com, Michael Albinus <michael.albinus <at> gmx.de>,
 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sat, 03 Sep 2022 15:08:26 -0400
>> The main point is that putting the `cl-defstruct` into the
>> `tramp-loaddefs.el` is really ugly and I think it's asking for trouble.
>
> The cl-defstruct is in there because a couple of defsubsts (that use the
> struct) are also in the tramp-loaddefs.el file.  So if we remove the
> defstruct, we also have to adjust the defsubsts.

Indeed, since this bug was reported, the rest of the code has grown more
dependent on duplicating the `cl-defstruct` to `tramp-loaddefs.el`.

> Looks good.
[...]
> Makes sense to me.

Pushed to `master`.  This should fix this bug, which means we may want
to update the comment:

    ;; The basic structure for remote file names.  We must autoload it in
    ;; tramp-loaddefs.el, because some functions, which need it, wouldn't
    ;; work otherwise when unloading / reloading Tramp.  (Bug#50869)

to clarify that it's now still kept in `tramp-loaddefs` but for
other reasons.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sun, 04 Sep 2022 14:54:02 GMT) Full text and rfc822 format available.

Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, shuguang79 <at> qq.com,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sun, 04 Sep 2022 16:53:27 +0200
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Pushed to `master`.  This should fix this bug, which means we may want
> to update the comment:
>
>     ;; The basic structure for remote file names.  We must autoload it in
>     ;; tramp-loaddefs.el, because some functions, which need it, wouldn't
>     ;; work otherwise when unloading / reloading Tramp.  (Bug#50869)
>
> to clarify that it's now still kept in `tramp-loaddefs` but for
> other reasons.

Somehow, I don't understand the compiler machinery. Hmm.

What comment you'd like to use instead? Remember, Tramp is backward
compatible down to Emacs 26.

>         Stefan

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sun, 04 Sep 2022 14:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sun, 04 Sep 2022 16:45:02 GMT) Full text and rfc822 format available.

Message #47 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, shuguang79 <at> qq.com,
 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sun, 04 Sep 2022 12:44:24 -0400
Michael Albinus [2022-09-04 16:53:27] wrote:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>> Pushed to `master`.  This should fix this bug, which means we may want
>> to update the comment:
>>
>>     ;; The basic structure for remote file names.  We must autoload it in
>>     ;; tramp-loaddefs.el, because some functions, which need it, wouldn't
>>     ;; work otherwise when unloading / reloading Tramp.  (Bug#50869)
>>
>> to clarify that it's now still kept in `tramp-loaddefs` but for
>> other reasons.
>
> Somehow, I don't understand the compiler machinery. Hmm.

In `master`, the unload problem described in bug#50869 has been fixed.
So the above comment suggests that we could remove the
`;;;###tramp-autoload` cookie in front of the `cl-defstruct`, but if you
do that, you get into other problems because the current Tramp code puts
other thins in `tramp-loaddefs.el` which also require this
`cl-defstruct` to be evaluated first.

> What comment you'd like to use instead? Remember, Tramp is backward
> compatible down to Emacs 26.

Something like

    ;; The basic structure for remote file names.

    ;; Note: We started autoloading it in tramp-loaddefs.el, because some
    ;; functions, which needed it, wouldn't work otherwise when unloading
    ;; / reloading Tramp (Bug#50869).
    ;; This bug is fixed in Emacs-29, but other parts of Tramp have grown
    ;; dependencies on having this in `tramp-loaddefs.el` in the mean time,
    ;; so .... here we are.

?


-- Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50869; Package emacs. (Sun, 04 Sep 2022 17:28:01 GMT) Full text and rfc822 format available.

Message #50 received at 50869 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, shuguang79 <at> qq.com,
 50869 <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sun, 04 Sep 2022 19:27:37 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

Hi Stefan,

>> What comment you'd like to use instead? Remember, Tramp is backward
>> compatible down to Emacs 26.
>
> Something like
>
>     ;; The basic structure for remote file names.
>
>     ;; Note: We started autoloading it in tramp-loaddefs.el, because some
>     ;; functions, which needed it, wouldn't work otherwise when unloading
>     ;; / reloading Tramp (Bug#50869).
>     ;; This bug is fixed in Emacs-29, but other parts of Tramp have grown
>     ;; dependencies on having this in `tramp-loaddefs.el` in the mean time,
>     ;; so .... here we are.

Thanks, applied to master.

The question remains if we shall fix something else for this bug, or
whether we can regard it as solved.

> -- Stefan

Best regards, Michael.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sun, 04 Sep 2022 18:05:01 GMT) Full text and rfc822 format available.

Notification sent to "Shuguang Sun" <shuguang79 <at> qq.com>:
bug acknowledged by developer. (Sun, 04 Sep 2022 18:05:01 GMT) Full text and rfc822 format available.

Message #55 received at 50869-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, shuguang79 <at> qq.com,
 50869-done <at> debbugs.gnu.org
Subject: Re: bug#50869: 28.0.50; tramp: void-function
 tramp-file-name-method--cmacro
Date: Sun, 04 Sep 2022 14:03:58 -0400
> The question remains if we shall fix something else for this bug, or
> whether we can regard it as solved.

I'm still not very happy with the duplication of `cl-defstruct` in the
loaddefs.el, but I think it's now unrelated to this patch (other than
historical accident), so: closing, thanks,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Oct 2022 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 206 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.