unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Daniel Koning <dk@danielkoning.com>, 41781@debbugs.gnu.org
Subject: bug#41781: 27.0.91; [PATCH] Eldoc describes the wrong function when reading an expression from the minibuffer
Date: Sat, 20 Jun 2020 12:51:19 -0400	[thread overview]
Message-ID: <jwv7dw1itbk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83h7v6w51h.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 20 Jun 2020 10:49:14 +0300")

>> (a) You're typing an elisp expression into `read-from-minibuffer', and
>> (b) the function name contains punctuation, such as ! or ?, whose
>> character class is "punctuation" and not "symbol" in the standard syntax
>> table.

When eldoc is activated in the minibuffer and uses the elisp backend
because we're reading an elisp expression, then the syntax-table should
also be set accordingly, indeed (not only for eldoc but also for
forward-sexp, ...).

Looks like a bug in the corresponding function (`read-expression` or nearby).

>> There are a couple different spots in the code to which you could
>> attribute this lapse. For one, the elisp-mode.el function
>> `elisp--current-symbol' isn't wrapped in a `with-syntax-table', unlike
>> other similar definitions in the same file. I think anyone invoking this
>> function could reasonably expect it to observe elisp syntax, so that's
>> what my tiny patch addresses. This fixes the Eldoc problem.

It's probably OK to do it as in your patch, yes.  Switching the
syntax-table can mess up `syntax-ppss`, so it's better if we can avoid
it, but in this specific case it seems unlikely to lead to a problem.

>> But here's another weird thing further down the call stack.
>> `read--expression' has a FIXME comment saying to turn on
>> `emacs-lisp-mode' in the minibuffer -- which would also set the
>> appropriate syntax table -- but it doesn't actually do it. I guess that
>> must not work for whatever reason (since it has to have taken longer to
>> write the comment than it would have taken to add the code). Should it
>> be changed now so that it does set the major mode?

I'm probably to blame for the comment.
I'm pretty sure just calling the major will break something.
I can't offhand tell you what, tho.  Writing the comment was faster than
trying it out and then seeing how to fix the corresponding problems.

>> Is there a problem with specialized major modes in the minibuffer?

There's the fact that it's not (never?) used, so it's a big unknown.
I think we *should* use major modes in the minibuffer (tho those major
modes will probably need to be custom tailored in most cases).
Any progress in that direction (e.g. just trying it to and reporting
the problems you encounter) will be welcome.


        Stefan






  reply	other threads:[~2020-06-20 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  2:56 bug#41781: 27.0.91; [PATCH] Eldoc describes the wrong function when reading an expression from the minibuffer Daniel Koning
2020-06-20  7:49 ` Eli Zaretskii
2020-06-20 16:51   ` Stefan Monnier [this message]
2020-06-23  0:08     ` Daniel Koning
2020-06-23  4:17       ` Stefan Monnier
2020-06-23 13:58         ` Daniel Koning
2020-06-23 14:09           ` Stefan Monnier
2020-06-23 16:42             ` Daniel Koning
2020-06-23 18:37               ` Stefan Monnier
2020-07-04  7:57       ` Eli Zaretskii
2020-08-05 15:59         ` Lars Ingebrigtsen
2020-08-08  8:09           ` Eli Zaretskii

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=jwv7dw1itbk.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=41781@debbugs.gnu.org \
    --cc=dk@danielkoning.com \
    --cc=eliz@gnu.org \
    /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).