all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 36897@debbugs.gnu.org
Subject: bug#36897: 27.0.50; [CC Mode] c-after-change may signal error in narrowed buffer
Date: 2 Aug 2019 08:41:21 -0000	[thread overview]
Message-ID: <20190802084121.5612.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.507.1564705872.1985.bug-gnu-emacs@gnu.org>

Hello, Noam.

In article <mailman.507.1564705872.1985.bug-gnu-emacs@gnu.org> you wrote:
> [-- text/plain, encoding 7bit, charset: US-ASCII, 31 lines --]

> Package: emacs, cc-mode

>>From 'emacs -Q', eval the following:

> (with-current-buffer (get-buffer-create "*test*")
>   (erase-buffer)
>   (insert "int main()\n{\n  \n}\n")
>   (search-backward "\n}")
>   (c-mode)
>   (save-restriction
>     (narrow-to-region (point) (point))
>     (insert "foo")))

> Gives the backtrace:

> Debugger entered--Lisp error: (args-out-of-range 1 1)
>   get-text-property(1 c-fl-syn-tab)
>   c-clear-string-fences()
>   #f(compiled-function () #<bytecode 0xbb39fd>)()
>   c-after-change(16 19 0)
>   insert("foo")
>   (save-restriction (narrow-to-region (point) (point)) (insert "foo"))
>   (save-current-buffer (set-buffer (get-buffer-create "*test*")) (erase-buffer) (insert "int main()\n{\n  \n}\n") (search-backward "\n}") (c-mode) (save-restriction (narrow-to-region (point) (point)) (insert "foo")))

Yes, thanks.  I've known about this for around a week, and I have a patch
for it prepared.  I was just giving the OP who reported it to me an extra
day or two to comment on it.

> This is a reduced test case from
> https://github.com/joaotavora/eglot/issues/291.

> I think the obvious fix is to extend the save-restriction just a bit
> further to cover c-clear-string-fences, patch attached.

Yes.  The "same" problem also happened in c-before-change, and my patch
fixes that, too.  (Otherwise, it's pretty much the same as your patch, as
far as c-after-change is concerned.)

I'll commit my patch soon, hopefully today.

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).






  parent reply	other threads:[~2019-08-02  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02  0:30 bug#36897: 27.0.50; [CC Mode] c-after-change may signal error in narrowed buffer Noam Postavsky
     [not found] ` <mailman.507.1564705872.1985.bug-gnu-emacs@gnu.org>
2019-08-02  8:41   ` Alan Mackenzie [this message]
     [not found] ` <mailman.530.1564738445.1985.bug-gnu-emacs@gnu.org>
2019-08-02 10:41   ` Alan Mackenzie
2019-08-02 11:40     ` Noam Postavsky

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=20190802084121.5612.qmail@mail.muc.de \
    --to=acm@muc.de \
    --cc=36897@debbugs.gnu.org \
    --cc=npostavs@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.