all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jiajie Chen <jiegec@qq.com>
To: npostavs@users.sourceforge.net
Cc: 23777@debbugs.gnu.org
Subject: bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer
Date: Mon, 27 Jun 2016 22:08:09 +0800	[thread overview]
Message-ID: <m2lh1qiv1y.fsf@qq.com> (raw)
In-Reply-To: <m2fusdxm9n.fsf@qq.com>


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)))





  parent reply	other threads:[~2016-06-27 14:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2k2ho9hs7.fsf@qq.com>
2016-06-16 14:04 ` bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer Jiajie Chen
2016-06-17  3:51   ` Noam Postavsky
2016-06-18  0:09   ` Jiege Chen
2016-06-27 14:08   ` Jiajie Chen [this message]
2016-06-28  0:28     ` Noam Postavsky
2016-06-28  4:54       ` Jiege Chen
2016-06-28 13:37       ` Jiege Chen
2016-07-09 21:34         ` npostavs
2016-07-18  2:24           ` npostavs

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=m2lh1qiv1y.fsf@qq.com \
    --to=jiegec@qq.com \
    --cc=23777@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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.