unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Daniel Sausner <daniel.sausner@posteo.de>
Cc: 52003@debbugs.gnu.org
Subject: bug#52003: Unexpected advising behavior due to recursive implementation
Date: Sat, 20 Nov 2021 20:16:43 +0100	[thread overview]
Message-ID: <43094E20-7F74-4CE0-ABE7-4348ADFFFCE0@acm.org> (raw)
In-Reply-To: <9f9a3c25-c473-ce45-9293-9754b8bcc113@posteo.de>

Thanks for the report, and yes, it's true that the way interactive use is managed makes advice hacks more interesting. Do remember that you are always on your own when using advice; Emacs cannot reasonably promise any compatibility on that level.

That said, it would be straightforward to straighten out the control flow by extracting the bulk of the code to a new (internal) function which is called with or without `condition-case`. It would be slightly slower since it entails an extra function call in the non-interactive case, and forward-sexp and its ilk are workhorses in many language modes. It may not matter much, of course.

> I'm far from a lisp expert but my feeling is that the condition-case 
> should only wrap the calls where things can actually go wrong.

Oh, but in this case they can. Noninteractive calls expect the scan-errors; interactive use does not. It is also possible for a a forward-sexp-function to raise scan-error.






  reply	other threads:[~2021-11-20 19:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20 16:13 bug#52003: Unexpected advising behavior due to recursive implementation Daniel Sausner
2021-11-20 19:16 ` Mattias Engdegård [this message]
2021-11-21  9:32   ` Daniel Sausner
2021-11-21 11:08     ` Mattias Engdegård
2021-11-21 17:29       ` Daniel Sausner
2021-11-22  9:20         ` Mattias Engdegård

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=43094E20-7F74-4CE0-ABE7-4348ADFFFCE0@acm.org \
    --to=mattiase@acm.org \
    --cc=52003@debbugs.gnu.org \
    --cc=daniel.sausner@posteo.de \
    /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).