GNU bug report logs - #36898
27.0.50; c-clear-string-fences causes args-out-of-range error

Previous Next

Package: emacs;

Reported by: Óscar Fuentes <ofv <at> wanadoo.es>

Date: Fri, 2 Aug 2019 20:02:02 UTC

Severity: normal

Tags: fixed

Merged with 36897

Found in version 27.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36898 in the body.
You can then email your comments to 36898 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36898; Package emacs. (Fri, 02 Aug 2019 20:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Óscar Fuentes <ofv <at> wanadoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 02 Aug 2019 20:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; c-clear-string-fences causes args-out-of-range error
Date: Fri, 02 Aug 2019 22:01:05 +0200
Since recently (a few months, max.) ws-butler-mode [1] no longer works
on C++ (probably C also) buffers. ws-butler tracks changes on a buffer
(adds a hook to after-change-functions) adding text properties on the
changed area and, upon saving (adds a hook to before-save-hook)
traverses those areas sanitizing whitespace (removes trailing
whitespace, converts spaces <-> tabs, etc).

For replicating the problem, start with emacs -Q, visit a C++ file, load
ws-butler, enable it with M-x ws-butler-mode, put the point after an
inner `}', press enter to create a new empty line which is indented,
then save the buffer. ws-butler shall remove the white space on the new
line, but it doesn't. If the operation is excutend with debug-on-error
enabled, this trace appears:

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 0x15768654dea9>)()
  c-after-change(804 804 2)
  delete-horizontal-space()
  (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not (and (boundp 'smart-tabs-mode) smart-tabs-mode))) (progn (let ((eol (point-at-eol))) (if indent-tabs-mode (progn (skip-chars-forward "\11" eol) (if (eq ... 32) (progn ...))) (skip-chars-forward " " eol) (if (eq (char-after) 9) (progn (untabify ... ...))))))) (end-of-line) (delete-horizontal-space) (forward-line 1))
  (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not (and (boundp 'smart-tabs-mode) smart-tabs-mode))) (progn (let ((eol (point-at-eol))) (if indent-tabs-mode (progn (skip-chars-forward "\11" eol) (if ... ...)) (skip-chars-forward " " eol) (if (eq ... 9) (progn ...)))))) (end-of-line) (delete-horizontal-space) (forward-line 1)))
  (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not (and (boundp ...) smart-tabs-mode))) (progn (let ((eol ...)) (if indent-tabs-mode (progn ... ...) (skip-chars-forward " " eol) (if ... ...))))) (end-of-line) (delete-horizontal-space) (forward-line 1))))
  (let ((ws-butler-saved t)) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not (and ... smart-tabs-mode))) (progn (let (...) (if indent-tabs-mode ... ... ...)))) (end-of-line) (delete-horizontal-space) (forward-line 1)))))
  (if (and (boundp 'ws-butler-saved) ws-butler-saved) (progn (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not (and (boundp ...) smart-tabs-mode))) (progn (let ((eol ...)) (if indent-tabs-mode (progn ... ...) (skip-chars-forward " " eol) (if ... ...))))) (end-of-line) (delete-horizontal-space) (forward-line 1))) (let ((ws-butler-saved t)) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (if (and ws-butler-convert-leading-tabs-or-spaces (not ...)) (progn (let ... ...))) (end-of-line) (delete-horizontal-space) (forward-line 1))))))
  ws-butler-clean-region(800 806)
  (progn (ws-butler-clean-region beg end))
  (if (funcall ws-butler-trim-predicate beg end) (progn (ws-butler-clean-region beg end)))
  (lambda (_prop beg end) (save-excursion (setq beg (progn (goto-char beg) (point-at-bol)) end (progn (goto-char (1- end)) (point-at-eol)))) (if (funcall ws-butler-trim-predicate beg end) (progn (ws-butler-clean-region beg end))) (setq last-end end))(chg 803 806)
  funcall((lambda (_prop beg end) (save-excursion (setq beg (progn (goto-char beg) (point-at-bol)) end (progn (goto-char (1- end)) (point-at-eol)))) (if (funcall ws-butler-trim-predicate beg end) (progn (ws-butler-clean-region beg end))) (setq last-end end)) chg 803 806)
  (if prop (funcall func prop start (or end limit)))
  (while (and start (< start limit)) (setq prop (get-text-property start 'ws-butler-chg)) (setq end (text-property-not-all start limit 'ws-butler-chg prop)) (if prop (funcall func prop start (or end limit))) (setq start end))
  (let ((start (or start-position (point-min))) (limit (copy-marker (or end-position (point-max)))) prop end) (while (and start (< start limit)) (setq prop (get-text-property start 'ws-butler-chg)) (setq end (text-property-not-all start limit 'ws-butler-chg prop)) (if prop (funcall func prop start (or end limit))) (setq start end)) (set-marker limit nil))
  ws-butler-map-changes((lambda (_prop beg end) (save-excursion (setq beg (progn (goto-char beg) (point-at-bol)) end (progn (goto-char (1- end)) (point-at-eol)))) (if (funcall ws-butler-trim-predicate beg end) (progn (ws-butler-clean-region beg end))) (setq last-end end)))
  (let (last-end) (ws-butler-map-changes #'(lambda (_prop beg end) (save-excursion (setq beg (progn (goto-char beg) (point-at-bol)) end (progn (goto-char ...) (point-at-eol)))) (if (funcall ws-butler-trim-predicate beg end) (progn (ws-butler-clean-region beg end))) (setq last-end end))) (ws-butler-maybe-trim-eob-lines last-end))
  ws-butler-before-save()
  run-hooks(before-save-hook)
  basic-save-buffer(t)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)

I tried to replicate the error without ws-butler, just adding
delete-horizontal-space to before-save-hook, but that does not throw the
error. ws-butler does a narrow-to-region, though.

In the meantime, I'm working-around the problem on ws-butler.es with

-     (delete-horizontal-space)
+     (ignore-errors (delete-horizontal-space)
+		    (delete-horizontal-space))


1. https://raw.githubusercontent.com/lewang/ws-butler/master/ws-butler.el


In GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit)
 of 2019-07-28 built on sky
Repository revision: 77ee23d1ede9eece3eab4cc67d7f2e72d30a1117
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux bullseye/sid




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36898; Package emacs. (Fri, 02 Aug 2019 20:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 36898 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 36898 <at> debbugs.gnu.org
Subject: Re: bug#36898: 27.0.50;
 c-clear-string-fences causes args-out-of-range error
Date: Fri, 02 Aug 2019 16:08:35 -0400
forcemerge 36897 36898
quit

Óscar Fuentes <ofv <at> wanadoo.es> writes:

> 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 0x15768654dea9>)()
>   c-after-change(804 804 2)

Try pulling again, Alan fixed it just this morning.





Forcibly Merged 36897 36898. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 20:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36898; Package emacs. (Fri, 02 Aug 2019 21:23:01 GMT) Full text and rfc822 format available.

Message #13 received at 36898 <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 36898 <at> debbugs.gnu.org
Subject: Re: bug#36898: 27.0.50; c-clear-string-fences causes
 args-out-of-range error
Date: Fri, 02 Aug 2019 23:22:40 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> Try pulling again, Alan fixed it just this morning.

Fixed indeed. Thanks Alan & Noam.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 31 Aug 2019 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.