Closed seagle0128 closed 4 years ago
I just pushed a commit which I suspect should avoid this: my guess is that the timer was triggering while a different buffer was current.
The failing code was narrowing to (window-start)
and (window-end)
, and this causes an error like the one you saw if (window-end)
is larger than (point-max)
. I'm not exactly sure how this happened though. :-/
I am not sure this is related, but after upgrading the package I get:
Debugger entered--Lisp error: (error "Selecting deleted buffer")
set-buffer(#<killed buffer>)
(save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))
(lambda (buf) (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp)))(#<killed buffer>)
apply((lambda (buf) (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))) #<killed buffer>)
timer-event-handler([t 0 0 500000 t (lambda (buf) (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))) (#<killed buffer>) idle 0])
Unfortunately I still encountered this error, and also got the new error @manuel-uberti mentioned.
Hmm, I did push a follow-up commit that checked for liveness of the buffer before invoking with-current-buffer
. It looks like the code in the backtrace above is from before that fix. Are you still seeing this with the very latest MELPA package?
(See 66eaaef)
I've met the same error. Here is the backtrace log:
Debugger entered--Lisp error: (args-out-of-range 13655 15402)
narrow-to-region(13655 15402)
(progn (narrow-to-region (window-start) (window-end)))
(if window (progn (narrow-to-region (window-start) (window-end))))
(if scope (let ((pt (point)) min max p) (save-excursion (save-restriction (narrow-to-defun) (setq min (point-min) max (point-max) p (or (/= pt (point)) (= pt (point-max)))))) (save-excursion (and p (setq min (progn (backward-paragraph) (point)) max (progn (forward-paragraph) (point)))) (narrow-to-region min max))) (if window (progn (narrow-to-region (window-start) (window-end)))))
symbol-overlay-narrow(nil t)
(save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re (symbol-overlay-regexp symbol))) (re-search-forward re nil t) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (while (re-search-forward re nil t) (symbol-overlay-put-one symbol) (or p (setq p t)))) (set-match-data save-match-data-internal 'evaporate))) (if p (progn (symbol-overlay-put-one symbol) (setq symbol-overlay-temp-symbol symbol)))))
(save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re (symbol-overlay-regexp symbol))) (re-search-forward re nil t) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (while (re-search-forward re nil t) (symbol-overlay-put-one symbol) (or p ...))) (set-match-data save-match-data-internal 'evaporate))) (if p (progn (symbol-overlay-put-one symbol) (setq symbol-overlay-temp-symbol symbol))))))
(progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re (symbol-overlay-regexp symbol))) (re-search-forward re nil t) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (while ... ... ...)) (set-match-data save-match-data-internal 'evaporate))) (if p (progn (symbol-overlay-put-one symbol) (setq symbol-overlay-temp-symbol symbol)))))))
(if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re (symbol-overlay-regexp symbol))) (re-search-forward re nil t) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (if p (progn (symbol-overlay-put-one symbol) (setq symbol-overlay-temp-symbol symbol))))))))
(let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let ((re ...)) (re-search-forward re nil t) (let (...) (unwind-protect ... ...)) (if p (progn ... ...))))))))
(progn (let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char (point-min)) (let (...) (re-search-forward re nil t) (let ... ...) (if p ...))))))))
(if symbol-overlay-mode (progn (let* ((case-fold-search nil) (symbol (symbol-overlay-get-symbol t)) p) (if (and symbol (not (symbol-overlay-assoc symbol)) (not (symbol-overlay-ignored-p symbol))) (progn (symbol-overlay-remove-temp) (save-excursion (save-restriction (symbol-overlay-narrow symbol-overlay-scope symbol-overlay-displayed-window) (goto-char ...) (let ... ... ... ...))))))))
symbol-overlay-maybe-put-temp()
(save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))
(progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp)))
(if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))))
(lambda (buf) (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp)))))(#<buffer *Pp Eval Output*>)
apply((lambda (buf) (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))))) #<buffer *Pp Eval Output*>)
timer-event-handler([t 0 0 500000 t (lambda (buf) (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (symbol-overlay-maybe-put-temp))))) (#<buffer *Pp Eval Output*>) idle 0])
Tested with the latest code (8aa6b11) in master branch.
Yeah, I've been looking into this - thanks folks! I think ca3b02c should help. It turns out that when some of these timers fire, they are for in buffers that are not currently visible, yet the previous code assumed that (selected-window)
would also contain the buffer that fired the timer.
You'll have to restart Emacs for the fix to work, btw, because old broken timer functions will still be present in buffers.
Latest version is now in MELPA btw, in case anyone would like to try it out and confirm that the issue is fixed. :-)
Thank you for working on this, Steve. I've been trying the latest changes and so far so good. I'll report back here whether I find problems or not to give a feedback. Thanks again!
I can also confirm it works. Thanks.
OK, I've been using it all day at work with no problem. :+1:
I can confirm it works fine now. Close it. Thank you! @purcell
Thanks folks!