[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 5065698: Move the ‘declare’ form before the interactive spec

From: Juri Linkov
Subject: Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions.
Date: Sat, 23 Jan 2021 19:33:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> The GNU Coding Standard format requires a line number between colons,
>> so maybe count-lines would give some plausible number in most cases.
> But 0 would work as well for that purpose.

I don't know if this is the best that could be done:

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 0f8dd5a284..a2cbb85412 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -301,7 +301,7 @@ defun
                                 (cdr body)
-                   (t (message "Warning: Unknown defun property `%S' in %S"
+                   (t (message "unknown:0:Warning: Unknown defun property `%S' 
in %S"
                                (car x) name)))))
           (def (list 'defalias

>>> Another approach could be to use something like
>>> `macroexp--warn-and-return`.
>> `macroexp--warn-and-return` uses `load-file-name` that is nil here.
> Not necessarily, no: when compiling, it will let bytecomp.el emit the
> warning which gives proper file and line numbers.
> Do we care about the format used when we're not compiling?
> [ This is not a rethorical question.  ]

Indeed, this format is useful only when compiling.

>> I tried it, but it has no effect.
>>   (let ((warnfun (lambda ()
>>                    (message "Warning: Unknown defun property `%S' in %S"
>>                             (car x) name))))
>>     `(progn
>>        (macroexp--funcall-if-compiled ',warnfun)))
> How did you try it?

Compiled this, then tried to byte-compile a file with wrong `declare`,
still same warning without line numbers.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]