unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Changes to comint-line-beginning-position
@ 2015-10-28 18:12 Stefan Monnier
  2015-10-29  0:05 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2015-10-28 18:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

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?


        Stefan



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

* Re: Changes to comint-line-beginning-position
  2015-10-28 18:12 Changes to comint-line-beginning-position Stefan Monnier
@ 2015-10-29  0:05 ` Juri Linkov
  2015-10-30 13:19   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2015-10-29  0:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> 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



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

* Re: Changes to comint-line-beginning-position
  2015-10-29  0:05 ` Juri Linkov
@ 2015-10-30 13:19   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2015-10-30 13:19 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

> -  (when (save-excursion (comint-bol) (bolp))
> +  (when (save-excursion (comint-bol t) (bolp))

Thanks,


        Stefan



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

end of thread, other threads:[~2015-10-30 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 18:12 Changes to comint-line-beginning-position Stefan Monnier
2015-10-29  0:05 ` Juri Linkov
2015-10-30 13:19   ` Stefan Monnier

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