unofficial mirror of bug-gnu-emacs@gnu.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 04:54:20 +0000 (UTC)	[thread overview]
Message-ID: <nksvtr$br0$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?
> 
> 
> 
> 
> 

Yes that's another solution. In my memory that code snippet in my init
comes from EmacsWiki.
I will try whether it works tonight (UTC+8 here). I don't understand that
timer too.
In Android for example, that might be intended to wait for the GUI event
loop to update some
controls.

-- 
Jiegec






  reply	other threads:[~2016-06-28  4:54 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='nksvtr$br0$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 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).