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

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?





  reply	other threads:[~2016-06-28  0:28 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 [this message]
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=CAM-tV--jEkubdWmikG9Lgo7+-NH6e8tHiiTjCV3NeV3cJH0_Sw@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=23777@debbugs.gnu.org \
    --cc=jiegec@qq.com \
    /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.