unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
@ 2021-09-28 15:15 Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-10-02 16:36 ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-09-28 15:15 UTC (permalink / raw)
  To: 50869

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

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)
 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:
 'configure --without-pop --with-native-image-api
 --with-native-compilation --without-compress-install
 '--program-transform-name=s/^ctags$/ctags.emacs/''

[-- Attachment #2: Type: text/html, Size: 1128 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2021-09-28 15:15 bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-10-02 16:36 ` Michael Albinus
  2022-03-17 14:39   ` Michael Albinus
  2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Albinus @ 2021-10-02 16:36 UTC (permalink / raw)
  To: 50869; +Cc: shuguang79

"Shuguang Sun" via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2021-10-02 16:36 ` Michael Albinus
@ 2022-03-17 14:39   ` Michael Albinus
  2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2022-03-17 14:39 UTC (permalink / raw)
  To: 50869-done; +Cc: shuguang79

Version: 28.2

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2021-10-02 16:36 ` Michael Albinus
  2022-03-17 14:39   ` Michael Albinus
@ 2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-03 15:44     ` Michael Albinus
  2022-09-02 11:43     ` Lars Ingebrigtsen
  1 sibling, 2 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-02 21:09 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, 50869

>> 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






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-03 15:44     ` Michael Albinus
  2022-09-02 18:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-02 11:43     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2022-04-03 15:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: shuguang79, 50869

Stefan Monnier <monnier@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-03 15:44     ` Michael Albinus
@ 2022-09-02 11:43     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-02 11:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: shuguang79, Michael Albinus, 50869

Stefan Monnier <monnier@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?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-04-03 15:44     ` Michael Albinus
@ 2022-09-02 18:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-03 10:07         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-02 18:52 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, 50869

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

Michael Albinus [2022-04-03 17:44:55] wrote:
> Stefan Monnier <monnier@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@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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: comp-macro.patch --]
[-- Type: text/x-diff, Size: 1629 bytes --]

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)

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-02 18:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-03 10:07         ` Lars Ingebrigtsen
  2022-09-03 19:08           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-03 10:07 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, Stefan Monnier, 50869

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-03 10:07         ` Lars Ingebrigtsen
@ 2022-09-03 19:08           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-04 14:53             ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-03 19:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: shuguang79, Michael Albinus, 50869

>> 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






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-03 19:08           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-04 14:53             ` Michael Albinus
  2022-09-04 16:44               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2022-09-04 14:53 UTC (permalink / raw)
  To: 50869; +Cc: larsi, shuguang79, monnier

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-04 14:53             ` Michael Albinus
@ 2022-09-04 16:44               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-09-04 17:27                 ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-04 16:44 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Lars Ingebrigtsen, shuguang79, 50869

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@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






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-04 16:44               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-09-04 17:27                 ` Michael Albinus
  2022-09-04 18:03                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2022-09-04 17:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lars Ingebrigtsen, shuguang79, 50869

Stefan Monnier <monnier@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro
  2022-09-04 17:27                 ` Michael Albinus
@ 2022-09-04 18:03                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-04 18:03 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Lars Ingebrigtsen, shuguang79, 50869-done

> 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






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-09-04 18:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 15:15 bug#50869: 28.0.50; tramp: void-function tramp-file-name-method--cmacro Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-02 16:36 ` Michael Albinus
2022-03-17 14:39   ` Michael Albinus
2022-04-02 21:09   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-03 15:44     ` Michael Albinus
2022-09-02 18:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-03 10:07         ` Lars Ingebrigtsen
2022-09-03 19:08           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-04 14:53             ` Michael Albinus
2022-09-04 16:44               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-04 17:27                 ` Michael Albinus
2022-09-04 18:03                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-02 11:43     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).