GNU bug report logs -
#33301
27.0.50; broken elisp indentation for non-definition symbols starting with "def.."
Previous Next
Reported by: João Távora <joaotavora <at> gmail.com>
Date: Wed, 7 Nov 2018 13:22:02 UTC
Severity: minor
Tags: confirmed, moreinfo
Merged with 43329
Found in versions 24.3, 27.0.50, 28.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> João Távora <joaotavora <at> gmail.com> writes:
>
>> Ah, that's unfortunate. Still, coundn't we improve the heuristic by
>> asking if the "function" has a macro definition? Isn't that closer to
>> the intended behaviour?
>>
>> diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
>> index afb7cbd1dd..e7373ece85 100644
>> --- a/lisp/emacs-lisp/lisp-mode.el
>> +++ b/lisp/emacs-lisp/lisp-mode.el
>> @@ -1104,7 +1104,8 @@ lisp-indent-function
>> (cond ((or (eq method 'defun)
>> (and (null method)
>> (> (length function) 3)
>> - (string-match "\\`def" function)))
>> + (string-match "\\`def" function)
>> + (macrop (intern function))))
>> (lisp-indent-defform state indent-point))
>> ((integerp method)
>> (lisp-indent-specform method state
>
> If that macro is defined, shouldn't it already be indented correctly
> without heuristics?
I don't think so, not without an explicit indent declaration spec in the
macro definition.
This may explain the string-match hack in the first place. I don't know
the exact motivation of the hack, but it's been there since the initial
2001 revision of the file. Possibly before declare/indent existed?
If you're suggesting removing it entirely, I don't oppose it. There's
the downside that indentation relying on it would start to fail, but
diffs normally spot that and this would encourage users to add proper
indent (and edebug) specs to their macros.
Otherwise, I think my macrop tweak does a slightly better job at
avoiding false positives.
João
This bug report was last modified 3 years and 215 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.