emacs-devel
[Top][All Lists]
Advanced

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

Re: Changes to comint-line-beginning-position


From: Juri Linkov
Subject: Re: Changes to comint-line-beginning-position
Date: Thu, 29 Oct 2015 02:05:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)

> Your changes to comint-line-beginning-position (back in Feb) have broken
> indentation in IELM:
>
>    IELM> (foo
>    bar
>
> where hitting TAB with point in from of "bar" should indent it (and used
> to indent it), but it doesn't any more.
>
> It's because IELM uses (save-excursion (comint-bol) (bolp)) to check if
> we want to indent, but now (comint-bol) doesn't just jump to the
> beginning of the second line but all the way to the end of the prompt.
>
> Could you try and fix it?

To better support multi-line command lines, functions used to jump
to the beginning of the non-first non-prompt line, now jump to the
beginning of the command line.  Apparently, this change breaks some
existing functions whereas the same change improves other functions
to do the right thing with multiple lines.  The problem is in different
interpretation of logical units used by comint-bol as commands lines vs
text lines.  The functions that previously assumed only single-line commands
benefit from this change when encountering multi-line commands.

To fix IELM the following patch should suffice that ignores field boundaries.
Also I grepped for other usages of comint-bol and it seems there is no more
such problems in the source tree.

diff --git a/lisp/ielm.el b/lisp/ielm.el
index 183f8a6..b035432 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -217,7 +217,7 @@ (defun ielm-complete-filename nil
 
 (defun ielm-indent-line nil
   "Indent the current line as Lisp code if it is not a prompt line."
-  (when (save-excursion (comint-bol) (bolp))
+  (when (save-excursion (comint-bol t) (bolp))
     (lisp-indent-line)))
 
 ;;; Working buffer manipulation



reply via email to

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