unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: John Mastro <john.b.mastro@gmail.com>
Cc: 26891@debbugs.gnu.org
Subject: bug#26891: 26.0.50; Error using lisp-indent-line in eval-expression minibuffer
Date: Thu, 11 May 2017 21:11:37 -0400	[thread overview]
Message-ID: <87a86ikhfa.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAOj2CQTCuJ9ezFbbS4Dx_Yxf7wgADYje6KO-mVHS=H5jzua1XQ@mail.gmail.com> (John Mastro's message of "Thu, 11 May 2017 16:34:29 -0700")

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

tags 26891 patch
quit

John Mastro <john.b.mastro@gmail.com> writes:

> Using lisp-indent-line in an eval-expression minibuffer (i.e. M-:) works
> in Emacs 25 but causes a "Text is read-only" error in Emacs 26.
>
> To reproduce:
> 1. Run emacs -Q
> 2. Evaluate the code below
> 3. Type M-:
> 4. Hit TAB
>
> Here's the code:
>
>     (defun init-eval-expression-minibuffer ()
>       (setq-local indent-line-function #'lisp-indent-line)
>       (local-set-key (kbd "TAB") #'indent-for-tab-command))
>
>     (add-hook 'eval-expression-minibuffer-setup-hook
>               #'init-eval-expression-minibuffer)
>
> Point will move to the very beginning of the minibuffer (on the "E" in
> "Eval") and you'll see a "Text is read only" message. (I called it an
> error above but it doesn't actually invoke the debugger even with
> debug-on-error and debug-on-signal non-nil).
>
> It doesn't matter whether you have entered text or not before hitting
> TAB.

indent-line-to doesn't respect field boundaries (i.e., moves into the
"Eval: " prompt text) because it uses backward-to-indentation.  This
patch to change it to back-to-indentation seems to fix it.  I'm not sure
why back-to-indentation and backward-to-indentation are inconsistent...


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

From 33880d67f0cc567ca5c317f828cc15859dcd9fe7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 11 May 2017 21:06:33 -0400
Subject: [PATCH v1] Make `indent-indent-to' respect field boundaries
 (Bug#26891)

* lisp/indent.el (indent-line-to): Use `back-to-indentation' instead
of `backward-to-indentation'.
---
 lisp/indent.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index fdd184c799..e7a30b885d 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -285,7 +285,7 @@ indent-line-to
   "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."
-  (backward-to-indentation 0)
+  (back-to-indentation)
   (let ((cur-col (current-column)))
     (cond ((< cur-col column)
 	   (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
-- 
2.11.1


  reply	other threads:[~2017-05-12  1:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 23:34 bug#26891: 26.0.50; Error using lisp-indent-line in eval-expression minibuffer John Mastro
2017-05-12  1:11 ` npostavs [this message]
2017-05-12 16:47   ` John Mastro
2017-05-12 17:15     ` John Mastro
2017-05-16  3:07       ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87a86ikhfa.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=26891@debbugs.gnu.org \
    --cc=john.b.mastro@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 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).