emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in orgalist mode's advice on indent-according-to-mode


From: Tim Cross
Subject: Re: Bug in orgalist mode's advice on indent-according-to-mode
Date: Thu, 28 Apr 2022 16:06:11 +1000
User-agent: mu4e 1.7.13; emacs 28.1.50

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> In Emacs commit f596f0db82c0b1ff3fe8e8f1d8b07d2fe7504ab6, from Nov 2021,
> the function `indent-according-to-mode' was given an optional
> inhibit-widen argument. That argument being passed causes orgalist's
> advice to fail, as the lambda doesn't accept any additional arguments.
> One way to fix it would be like that:
>
>  (unless (advice-member-p 'orgalist-fix-bug:31361 'indent-according-to-mode)
>    (advice-add 'indent-according-to-mode
>                :around (lambda (old &optional inhibit-widen)
>                          "Workaround bug#31361."
>                          (or (orgalist--indent-line)
>                              (let ((indent-line-function
>                                     (advice--cd*r indent-line-function)))
>                                (funcall old inhibit-widen))))
>                '((name . orgalist-fix-bug:31361)))))
>
> Or I suppose a more future-proof approach might be to use a &rest and
> then `apply' instead of `funcall'.
>

A better solution would probably be to fix this without using
add-advice. While advice can be a useful escape hatch, it really is best
avoided, especially given that it doesn't always play nice with lexical
binding. I note this one is also calling an undocumented internal
function. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]