[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer
From: |
Jiajie Chen |
Subject: |
bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer |
Date: |
Mon, 27 Jun 2016 22:08:09 +0800 |
I have found the bug -- it comes from nlinum.el:
(defun nlinum--flush ()
(nlinum--setup-windows)
;; (kill-local-variable 'nlinum--ol-counter)
(remove-overlays (point-min) (point-max) 'nlinum t)
(run-with-timer 0 nil
(lambda (buf)
(with-current-buffer buf
(with-silent-modifications
;; FIXME: only remove `fontified' on those parts of the
;; buffer that had an nlinum overlay!
(remove-text-properties
(point-min) (point-max) '(fontified)))))
(current-buffer)))
It seems that when the timer is ran, the (current-buffer) no longer
exists. That buffer may be a temp buffer.
And my init code includes:
(add-hook 'nlinum-mode-hook
(lambda ()
(when nlinum-mode
(setq nlinum--width
(1+ (length (number-to-string
(count-lines (point-min) (point-max))))))
(nlinum--flush))))
A fix would be:
(defun nlinum--flush ()
(nlinum--setup-windows)
;; (kill-local-variable 'nlinum--ol-counter)
(remove-overlays (point-min) (point-max) 'nlinum t)
(run-with-timer 0 nil
(lambda (buf)
(when (buffer-live-p buf)
(with-current-buffer buf
(with-silent-modifications
;; FIXME: only remove `fontified' on those parts of
the
;; buffer that had an nlinum overlay!
(remove-text-properties
(point-min) (point-max) '(fontified)))))
(current-buffer)))