[CCing Stefan as the nadvice.el expert.] Gregor Zattler writes: > Dear org-mode developers, hello Nicolas, > I use orgalist-mode while writing emails in > notmuch-message-mode. Today I updated emacs (from git), and > since then, the second line of a paragraph get's indented > (and succeeding lines too). > > As demonstrated with this email. While I write this email with > my configurations, I checked with emacs -Q as follows: visited > one org file (in order for org-mode to load), visited > orgalist.el, eval'ed this buffer and started writing an email: > bang! indented succeeding lines. > > > > I bisected emacs like so: > > make ; src/emacs -Q --eval '(org-mode)' -l > ~/.emacs.d/elpa-27.0/orgalist-1.9/orgalist.el -f compose-mail --eval > '(orgalist-mode)' -f end-of-buffer > > and this is the relevant commit: > > 2e3deb09bd42d22a9b354937ce63b151fb493d8a is the first bad commit > commit 2e3deb09bd42d22a9b354937ce63b151fb493d8a > Author: Basil L. Contovounesios > Date: Sun Mar 31 19:39:54 2019 +0100 > > Do not set indent-line-function in text-mode > > For discussion, see thread starting at: > https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg01012.html > * lisp/textmodes/text-mode.el (text-mode): Do not reset > indent-line-function to its global default value of indent-relative. > * doc/lispref/modes.texi (Example Major Modes): > * etc/NEWS: Document change accordingly. [...] > I do not know what to do with this. This seems to be a relapse(?) of bug#31361[1], which you have correctly identified as being caused by my commit. The following outlines what happens now (you can safely skip the next four paragraphs if you don't care about the technical details). text-mode no longer makes indent-line-function buffer-local. orgalist-mode advises indent-line-function buffer-locally using add-function. add-function uses advice--buffer-local to find which place form to set. advice--buffer-local sees that indent-line-function is not a local variable, so it wraps it in a custom closure before making it buffer-local. orgalist-mode also advises indent-according-to-mode in order to work around bug#31361 by temporarily unwrapping the advice added to indent-line-function. This is done because indent-according-to-mode behaves differently if indent-line-function is set to indent-relative or indent-relative-first-indent-point (née indent-relative-maybe). Back when text-mode made indent-line-function buffer-local before orgalist-mode advised it, (advice--cd*r indent-line-function) would simply return indent-relative, and the advice on indent-according-to-mode worked as intended. Now that add-function sets indent-line-function to a custom closure, however, (advice--cd*r indent-line-function) no longer returns indent-relative and the workaround breaks. The simplest fix would be to make indent-line-function buffer-local in orgalist-mode before advising it with add-function, as the code already expects and relies on this: