unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 33301@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com>
Subject: bug#33301: 27.0.50; broken elisp indentation for non-definition symbols starting with "def.."
Date: Fri, 09 Nov 2018 09:04:04 +0000	[thread overview]
Message-ID: <875zx6r5a3.fsf@gmail.com> (raw)
In-Reply-To: <877ehnowgy.fsf@web.de> (Michael Heerdegen's message of "Fri, 09 Nov 2018 02:45:01 +0100")

Michael Heerdegen <michael_heerdegen@web.de> writes:

> João Távora <joaotavora@gmail.com> writes:
>
>> 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?
>
> But wait, this is in lisp-mode.el which I remember is used not only for
> Elisp but also for other Lisps, right?

Well it's lisp/emacs-lisp/... ;-)

> So your patch could make things worse for editing Common Lisp, for
> example.

OK, just add (derived-mode-p 'emacs-lisp-mode), as is done elsewhere in
that file.

Or I would suggest (setq-local lisp-indent-function
'common-lisp-indent-function) in you hypothetical fancy-lisp-mode hook
and has much better heuristics that don't cause the bug I've described.

(But, as someone who writes CL for a living, if you're indenting CL with
these heuristics, you've already lost.  You should use SLY/SLIME which
looks at the macroexpansion to understand what you're trying to indent.)

> For Elisp the heuristic doesn't make much sense, though, if the edited
> file is not loaded, it also prevents false negatives for macro uses of
> macros defined in that file.

I don't fully understand the "it also" part, but here's my take on this:
If you're not loading the code, all things being equal, it's better to
incorrectly re-indent existing "def"-macros (not defmacro) than to
incorrectly indent new arbitrary "def"-forms anywhere in the AST.
That's because it's a bad idea to re-indent code anyway, but indent new
code happens all the time.

Also, it's not a very good idea to indent without some form of
evaluation anyway.  Because of the indentation declaration, that ship
has sailed long ago (and bon voyage).

João





  reply	other threads:[~2018-11-09  9:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 13:21 bug#33301: 27.0.50; broken elisp indentation for non-definition symbols starting with "def.." João Távora
2018-11-08  0:05 ` Noam Postavsky
2018-11-08  0:35   ` Michael Heerdegen
2018-11-08  9:52     ` João Távora
2018-11-09  0:13       ` Michael Heerdegen
2018-11-09  0:41         ` João Távora
2018-11-09  1:45           ` Michael Heerdegen
2018-11-09  9:04             ` João Távora [this message]
2018-11-09  9:51               ` Michael Heerdegen
2018-11-09 12:28                 ` Noam Postavsky
2018-11-09 19:39                   ` João Távora
2018-11-10  4:48                     ` Michael Heerdegen
2018-11-10 10:28                       ` João Távora
2018-11-10 10:54                     ` Andreas Schwab
2018-11-10 12:46                       ` João Távora
2018-11-10 12:53                         ` Andreas Schwab
2018-11-10 16:05                           ` João Távora
2018-11-10 16:18                             ` João Távora
2020-08-22 14:58                     ` Lars Ingebrigtsen
2020-08-22 16:19                       ` João Távora
2020-08-23 12:26                         ` Lars Ingebrigtsen
2020-08-23 13:39                           ` João Távora
2020-08-24 13:12                             ` Lars Ingebrigtsen
2020-08-25 19:59                               ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zx6r5a3.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=33301@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).