all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: joaotavora@gmail.com, 32014@debbugs.gnu.org
Subject: bug#32014: 26.1; lisp-indent-line fails in first line of Ielm
Date: Sat, 30 Jun 2018 09:27:58 -0400	[thread overview]
Message-ID: <87o9fsmmjl.fsf@gmail.com> (raw)
In-Reply-To: <831scoojfx.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Jun 2018 09:52:02 +0300")

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure I'm okay with changing the behavior of
> forward/backward-to-indentation like that.  It's an incompatible
> change, isn't it?  The documentation doesn't seem to tell anything wrt
> the behavior in presence of fields, but that doesn't mean we can make
> such changes without considering the consequences.  Can you tell why
> you think this change is TRT?

Hmm, the more I look at it, the less I understand why these functions
even exist.  There are hardly any uses of them.  Maybe we should just do
this instead:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1122 bytes --]

From a31918efdbdbf4c6d3f26ae7a73aba910f164116 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 30 Jun 2018 09:14:22 -0400
Subject: [PATCH v2] Respect field boundaries in indent-line-to (Bug#32014)

* lisp/indent.el (indent-line-to): Use the back-to-indentation point
as the end-point of whitespace removal, rather than
backward-to-indentation which doesn't respect field boundaries.
---
 lisp/indent.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index eb5b21e8e8..14efe8bfdf 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -300,8 +300,9 @@ indent-line-to
 			      (progn (skip-chars-backward " ") (point))))
 	   (indent-to column))
 	  ((> cur-col column) ; too far right (after tab?)
-	   (delete-region (progn (move-to-column column t) (point))
-			  (progn (backward-to-indentation 0) (point)))))))
+	   (let ((cur-indent (point)))
+             (delete-region (progn (move-to-column column t) (point))
+			    cur-indent))))))
 
 (defun current-left-margin ()
   "Return the left margin to use for this line.
-- 
2.11.0


  reply	other threads:[~2018-06-30 13:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 23:20 bug#32014: 26.1; lisp-indent-line fails in first line of Ielm João Távora
2018-06-30  0:23 ` Noam Postavsky
2018-06-30  6:52   ` Eli Zaretskii
2018-06-30 13:27     ` Noam Postavsky [this message]
2018-07-10  0:48       ` Noam Postavsky
2018-07-10  7:04         ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9fsmmjl.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=32014@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.