emacs-devel
[Top][All Lists]
Advanced

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

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


From: Stefan Monnier
Subject: Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions.
Date: Fri, 22 Jan 2021 09:04:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> -                   (t (message "Warning: Unknown defun property `%S' in %S"
>>> -                               (car x) name)))))
>>> +                   (t (message "%S:%d:Warning: Unknown defun property `%S'"
>>> +                               name (count-lines (point-min) (point))
>>> +                               (car x))))))
>> I think `count-lines` is a problem because we don't know in which buffer
>> we are when this is executed.
> 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.

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

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


        Stefan




reply via email to

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