unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16461: 24.3.50; electric eats too much
@ 2014-01-16  7:51 Juri Linkov
  2014-01-16 14:02 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2014-01-16  7:51 UTC (permalink / raw)
  To: 16461

In Text mode typing RET on a formfeed character ^L deletes it.
The presence of ^L means it's here on purpose, so RET should keep it.

electric-indent-post-self-insert-function calls indent-according-to-mode
that uses special casing for indent-relative (that is the default
indent-line-function in text-mode).  I don't understand why it
calls ^L-eating indent-line-to instead of indent-relative
but without this special casing, indent-relative works fine
and doesn't eat ^L.





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

* bug#16461: 24.3.50; electric eats too much
  2014-01-16  7:51 bug#16461: 24.3.50; electric eats too much Juri Linkov
@ 2014-01-16 14:02 ` Stefan Monnier
  2014-01-17  8:05   ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-01-16 14:02 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16461

> I don't understand why it calls ^L-eating indent-line-to instead of
> indent-relative but without this special casing, indent-relative works
> fine and doesn't eat ^L.

If we can get the same behavior using indent-relative, I'm perfectly
fine with it.  But I also think that indent-line-to should *not* eat ^L.


        Stefan





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

* bug#16461: 24.3.50; electric eats too much
  2014-01-16 14:02 ` Stefan Monnier
@ 2014-01-17  8:05   ` Juri Linkov
  2014-01-17 14:40     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2014-01-17  8:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16461

> But I also think that indent-line-to should *not* eat ^L.

This patch fixes the problem and doesn't eat ^L:

=== modified file 'lisp/indent.el'
--- lisp/indent.el	2014-01-15 08:22:41 +0000
+++ lisp/indent.el	2014-01-17 08:05:10 +0000
@@ -265,7 +265,7 @@ (defun indent-line-to (column)
   "Indent current line to COLUMN.
 This function removes or adds spaces and tabs at beginning of line
 only if necessary.  It leaves point at end of indentation."
-  (back-to-indentation)
+  (backward-to-indentation 0)
   (let ((cur-col (current-column)))
     (cond ((< cur-col column)
 	   (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
@@ -274,7 +274,7 @@ (defun indent-line-to (column)
 	   (indent-to column))
 	  ((> cur-col column) ; too far right (after tab?)
 	   (delete-region (progn (move-to-column column t) (point))
-			  (progn (back-to-indentation) (point)))))))
+			  (progn (backward-to-indentation 0) (point)))))))
 
 (defun current-left-margin ()
   "Return the left margin to use for this line.






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

* bug#16461: 24.3.50; electric eats too much
  2014-01-17  8:05   ` Juri Linkov
@ 2014-01-17 14:40     ` Stefan Monnier
  2014-01-20  8:47       ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-01-17 14:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16461

>> But I also think that indent-line-to should *not* eat ^L.
> This patch fixes the problem and doesn't eat ^L:

Looks OK, thanks.  This difference between back-to-indentation and
backward-to-indentation is really obscure.


        Stefan





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

* bug#16461: 24.3.50; electric eats too much
  2014-01-17 14:40     ` Stefan Monnier
@ 2014-01-20  8:47       ` Juri Linkov
  2014-01-20 14:12         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2014-01-20  8:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16461-done

>>> But I also think that indent-line-to should *not* eat ^L.
>> This patch fixes the problem and doesn't eat ^L:
>
> Looks OK, thanks.  This difference between back-to-indentation and
> backward-to-indentation is really obscure.

Perhaps a new function with more descriptive name could be added later.





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

* bug#16461: 24.3.50; electric eats too much
  2014-01-20  8:47       ` Juri Linkov
@ 2014-01-20 14:12         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-01-20 14:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16461-done

>> Looks OK, thanks.  This difference between back-to-indentation and
>> backward-to-indentation is really obscure.
> Perhaps a new function with more descriptive name could be added later.

I think back-to-indentation should use the same " \t" pattern rather
than rely on syntax tables.


        Stefan





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

end of thread, other threads:[~2014-01-20 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16  7:51 bug#16461: 24.3.50; electric eats too much Juri Linkov
2014-01-16 14:02 ` Stefan Monnier
2014-01-17  8:05   ` Juri Linkov
2014-01-17 14:40     ` Stefan Monnier
2014-01-20  8:47       ` Juri Linkov
2014-01-20 14:12         ` 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).