From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer Date: Mon, 27 Jun 2016 20:28:56 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1467073826 26597 80.91.229.3 (28 Jun 2016 00:30:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Jun 2016 00:30:26 +0000 (UTC) Cc: 23777@debbugs.gnu.org To: Jiajie Chen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 28 02:30:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bHgus-0004dh-KQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Jun 2016 02:30:14 +0200 Original-Received: from localhost ([::1]:33436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHgur-00006E-PF for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jun 2016 20:30:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHgum-000052-9A for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2016 20:30:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHgug-0002Jc-OA for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2016 20:30:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHgug-0002JV-JZ for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2016 20:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bHgug-00008i-8P for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2016 20:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Jun 2016 00:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23777 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23777-submit@debbugs.gnu.org id=B23777.1467073744409 (code B ref 23777); Tue, 28 Jun 2016 00:30:02 +0000 Original-Received: (at 23777) by debbugs.gnu.org; 28 Jun 2016 00:29:04 +0000 Original-Received: from localhost ([127.0.0.1]:58579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHgtk-00006W-Ag for submit@debbugs.gnu.org; Mon, 27 Jun 2016 20:29:04 -0400 Original-Received: from mail-oi0-f47.google.com ([209.85.218.47]:35901) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHgti-00005y-FN for 23777@debbugs.gnu.org; Mon, 27 Jun 2016 20:29:03 -0400 Original-Received: by mail-oi0-f47.google.com with SMTP id f189so1527233oig.3 for <23777@debbugs.gnu.org>; Mon, 27 Jun 2016 17:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wR2eg/A4+O9Da+966FeAUI2BYWOSf6he31AwPcLJIhk=; b=tmokLxWfqub8joUJ6shysp5FPf5nO3qdSoIXPfO3vEU99S6VrgtnYf0unJvQoWw8WT huBMu8rnoy429u/UouUnTTjjwSyj49UaHgb2HSOC7MT8+tAr2rrbNlJUx5Ah7v9aZNxN Cogp1MQqZFwzRSbkQqLxEktzKv3tMDCTSFuVh07QxzmabUSvqmWdWIPc8pvA6p3mr/K6 bW8UPYTPuR+WbuP+QwkgwCndOOtS9hacqju6GbmyDJ/p/HYSm4qLztkCQkCF3D5s776d /PmInuYjG7a4PS6+sFTa5sdyqZVoolgSs8sMVEMArR+feUgfu+0YVcN096DYJzTgw+TZ +A7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wR2eg/A4+O9Da+966FeAUI2BYWOSf6he31AwPcLJIhk=; b=lJ76AytcS+uYT3CVEB8rOVEIXdT+Cmt+0rBW8G2AYiN0N49WJPn1b3DNJFOiJFvRQl j5m9IUwhXVyXflJLz9o1cSWs0xnAhAD6EWxlI3nHM3YJL4P3kAGZWNmMLW2jdcSn557+ WGyrfXEYOoCyGO4sIbe35YxlTqUXvzYF5VVISPJkTdFDXahuu0fIE+O2xOr6Wy0B7kbn tYPWBC3gsNrtTp0c0tETUFfWz+QbVlrKgDclZiUXIHx8IVwB8v7oLtMIJx2bCkkMZVJg k7EIhbYte4k4pwHVkqXFnU4pqzw4IvTbXfMb1Tjej2cF2Fg9xu7fg5FQEvqbeLnAYwn6 95qA== X-Gm-Message-State: ALyK8tLdkzCodpkiHFnzqzj9jAbtGZ7hsGUY4pkPKpEMM6LB9+rK/MxjBIO3tWaEdCChHmk3qitqmEta8JXdOQ== X-Received: by 10.202.85.9 with SMTP id j9mr38345oib.202.1467073736779; Mon, 27 Jun 2016 17:28:56 -0700 (PDT) Original-Received: by 10.157.52.238 with HTTP; Mon, 27 Jun 2016 17:28:56 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: YnisHDlBHwApLO29l1Lz4JLraM4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120169 Archived-At: On Mon, Jun 27, 2016 at 10:08 AM, Jiajie Chen 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?