GNU bug report logs - #52003
Unexpected advising behavior due to recursive implementation

Previous Next

Package: emacs;

Reported by: Daniel Sausner <daniel.sausner <at> posteo.de>

Date: Sat, 20 Nov 2021 17:05:03 UTC

Severity: normal

Done: Mattias EngdegÄrd <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 52003 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Sausner <daniel.sausner <at> posteo.de>
To: Mattias EngdegÄrd <mattiase <at> acm.org>
Cc: 52003 <at> debbugs.gnu.org
Subject: Re: bug#52003: Unexpected advising behavior due to recursive
 implementation
Date: Sun, 21 Nov 2021 17:29:36 +0000
> Yes but what would that mean? The best we can do is to promise that a function F, when called in a manner consistent with the documentation, behaves accordingly. We cannot guarantee the absence of calls to F, can we?
>
> But unless I'm mistaken, that's what you are unhappy about: `forward-sexp` may call itself when you call it. A lot of other code calls that function as part of their implementation. Don't they cause trouble, or is it just the recursive call?
Well, my initial concern was the (new) recursive call, which adds 
another layer of complexity for advising. I now see too that an advice 
on such a deep rooted function is kind of madness anyway. In fact I 
would need to make a distinction between the interactive modes both ways.

> What are you trying to do? Can't you define a mode-specific forward-sexp-function?
The problem I'm trying to solve is, that the cursor in evil normal state 
is not between chars but _on_ a char. Moving to the end of a sexp in 
lisp I would expect the cursor to be on the closing paren instead of 
behind it. There was already an advice planted on 
`elisp--precedent-sexp` to achieve this effect for `eval-last-sexp`. It 
basically only moves the point one char forward if in normal mode before 
eval-last-sexp, hence the sexp including the paren on which the cursor 
rests will be evaluated instead of the thing before the cursor/paren.

I wanted to transport this behaviour to the motion-sexp commands and 
initially I was naive enough to think that this is a low hanging fruit, 
because I could take the same advice function and add it to 
backward/forward-sexp.

In essence I would like to move the visible cursor by a single char in 
one or the other direction before and after one or more 
`forward-sexp`-based commands are executed. But I'm not sure anymore if 
this is really worth the effort :-)




This bug report was last modified 3 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.