all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jiege Chen <jiegec@qq.com>
To: 23777@debbugs.gnu.org
Subject: bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer
Date: Tue, 28 Jun 2016 13:37:38 +0000 (UTC)	[thread overview]
Message-ID: <nktuj0$8lm$1@ger.gmane.org> (raw)
In-Reply-To: <m2fusdxm9n.fsf@qq.com>

Noam Postavsky <npostavs@users.sourceforge.net> wrote:
> On Mon, Jun 27, 2016 at 10:08 AM, Jiajie Chen <jiegec@qq.com> wrote:
>> 
>> I have found the bug -- it comes from nlinum.el:
> [...]
>> 
>> 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)))
> 
> Perhaps it makes more sense to put that buffer-live-p check in your
> nlinum-mode-hook lambda? Actually I wonder why you need to call
> nlinum--flush at all? Though I admit I don't really understand the
> nlinum code either, e.g. what is the use of (run-with-timer 0 ...),
> why not run the thing immediately?
> 
> 
> 
> 
> 

I removed that call in my init code, and the error is gone,
at the price of some display inconsistency which is acceptable.
There is room for improvement in nlinum--flush. 

-- 
Jiegec






  parent reply	other threads:[~2016-06-28 13:37 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
2016-06-28  0:28     ` Noam Postavsky
2016-06-28  4:54       ` Jiege Chen
2016-06-28 13:37       ` Jiege Chen [this message]
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='nktuj0$8lm$1@ger.gmane.org' \
    --to=jiegec@qq.com \
    --cc=23777@debbugs.gnu.org \
    /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.