unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31361: 25.3; Issue when advising `indent-line-function'
@ 2018-05-03 21:15 Nicolas Goaziou
  2018-05-05 14:26 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Goaziou @ 2018-05-03 21:15 UTC (permalink / raw)
  To: 31361; +Cc: Stefan Monnier

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-05 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 21:15 bug#31361: 25.3; Issue when advising `indent-line-function' Nicolas Goaziou
2018-05-05 14:26 ` Nicolas Goaziou

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).