bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31361: 25.3; Issue when advising `indent-line-function'


From: Nicolas Goaziou
Subject: bug#31361: 25.3; Issue when advising `indent-line-function'
Date: Thu, 03 May 2018 23:15:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

When `indent-line-function' is advised, using `add-function', and the
variable contains `indent-relative', `indent-according-to-mode' has an
erratic behavior.

In the following code, from `indent-according-to-mode',

 (if (memq indent-line-function
            '(indent-relative indent-relative-maybe))
    ...
    ;; The normal case.
    (funcall indent-line-function))

the if branch is no longer executed because `indent-line-function' is no
longer `indent-relative' but a closure around it.

You can reproduce the issue with the following recipe:

  - Open a new buffer in Fundamental mode (so `indent-line-function' is
    `indent-relative')

  - Insert : "-- Test"

  - From there, <RET> returns to column 0.  However, upon evaluating the
    following:

      M-: (add-function :before-until (local 'indent-line-function) #'ignore)

    <RET> now moves point at the same column as the "T" from "Test", in
    the new line.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738





reply via email to

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