* bug#36898: 27.0.50; c-clear-string-fences causes args-out-of-range error
@ 2019-08-02 20:01 Óscar Fuentes
2019-08-02 20:08 ` Noam Postavsky
0 siblings, 1 reply; 3+ messages in thread
From: Óscar Fuentes @ 2019-08-02 20:01 UTC (permalink / raw)
To: 36898
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#36898: 27.0.50; c-clear-string-fences causes args-out-of-range error
2019-08-02 20:01 bug#36898: 27.0.50; c-clear-string-fences causes args-out-of-range error Óscar Fuentes
@ 2019-08-02 20:08 ` Noam Postavsky
2019-08-02 21:22 ` Óscar Fuentes
0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2019-08-02 20:08 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: 36898
forcemerge 36897 36898
quit
Óscar Fuentes <ofv@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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#36898: 27.0.50; c-clear-string-fences causes args-out-of-range error
2019-08-02 20:08 ` Noam Postavsky
@ 2019-08-02 21:22 ` Óscar Fuentes
0 siblings, 0 replies; 3+ messages in thread
From: Óscar Fuentes @ 2019-08-02 21:22 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 36898
Noam Postavsky <npostavs@gmail.com> writes:
> Try pulling again, Alan fixed it just this morning.
Fixed indeed. Thanks Alan & Noam.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-02 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-02 20:01 bug#36898: 27.0.50; c-clear-string-fences causes args-out-of-range error Óscar Fuentes
2019-08-02 20:08 ` Noam Postavsky
2019-08-02 21:22 ` Óscar Fuentes
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).