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: Sat, 18 Jun 2016 08:09:21 +0800 [thread overview]
Message-ID: <EECF7C4F-CB2B-4843-8E8F-00EF3DF89288@qq.com> (raw)
In-Reply-To: <m2fusdxm9n.fsf@qq.com>
[-- Attachment #1: Type: text/plain, Size: 4736 bytes --]
Forward to the mailing list.
Sent from my iPad
Begin forwarded message:
> From: Jiajie Chen <jiegec@qq.com>
> Date: June 17, 2016 at 7:27:52 PM GMT+8
> To: Noam Postavsky <npostavs@users.sourceforge.net>
> Subject: Re: bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer
>
>
> Thanks. That works. This behaviour is only observed in Emacs daemon.
>
> This is what I have found:
>
> The backtrace:
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
> set-buffer(#<killed buffer>)
> (save-current-buffer (set-buffer buf) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (remove-text-properties (point-min) (point-max) (quote (fontified)))) (if modified nil (restore-buffer-modified-p nil)))))
> (closure (t) (buf) (save-current-buffer (set-buffer buf) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (remove-text-properties (point-min) (point-max) (quote (fontified)))) (if modified nil (restore-buffer-modified-p nil))))))(#<killed buffer>)
> apply((closure (t) (buf) (save-current-buffer (set-buffer buf) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (remove-text-properties (point-min) (point-max) (quote (fontified)))) (if modified nil (restore-buffer-modified-p nil)))))) #<killed buffer>)
> timer-event-handler([t 22371 54023 394400 nil (closure (t) (buf) (save-current-buffer (set-buffer buf) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (remove-text-properties (point-min) (point-max) (quote ...))) (if modified nil (restore-buffer-modified-p nil)))))) (#<killed buffer>) nil 0])
>
>
> Then I ran `ag 'modified
> \(buffer-modified-p\).*\n.*buffer-undo.*\n*inhib'` and got this:
> dtrt-indent-20160523.1318/dtrt-indent-diag.el:163: `((,modified (buffer-modified-p))
> dtrt-indent-20160523.1318/dtrt-indent-diag.el:164: (buffer-undo-list t)
> dtrt-indent-20160523.1318/dtrt-indent-diag.el:165: (inhibit-read-only t)
> markdown-mode-20160610.1745/markdown-mode.el:6321: (let* ((modified (buffer-modified-p))
> markdown-mode-20160610.1745/markdown-mode.el:6322: (buffer-undo-list t)
> markdown-mode-20160610.1745/markdown-mode.el:6323: (inhibit-read-only t)
>
> Then reading the code in those files, the code turned out to be in a macro:
>
> (defmacro save-buffer-state (varlist &rest body)
> "Bind variables according to VARLIST and eval BODY restoring buffer state."
> (declare (indent 1) (debug let))
> (let ((modified (make-symbol "modified")))
> `(let* ,(append varlist
> `((,modified (buffer-modified-p))
> (buffer-undo-list t)
> (inhibit-read-only t)
> (inhibit-point-motion-hooks t)
> (inhibit-modification-hooks t)
> deactivate-mark
> buffer-file-name
> buffer-file-truename))
> (progn
> ,@body)
> (unless ,modified
> (restore-buffer-modified-p nil)))))
>
>
> But I have found only one occurrence in dtrt-indent:
>
> (defun dtrt-indent-highlight ()
> "Highlight non-excluded indentation in the current buffer."
> (interactive)
> (let ((language-and-variable
> (cdr (dtrt-indent--search-hook-mapping major-mode))))
> (if (null language-and-variable)
> (message "Major mode %s not supported by dtrt-indent" major-mode)
> (save-buffer-state nil
> (dtrt-indent--for-each-indentation
> (car language-and-variable)
> (lambda (histogram)
> (put-text-property (save-excursion (beginning-of-line) (point))
> (point)
> 'face '(background-color . "red"))
> t)
> nil)))))
>
> Dunno how it is related to that timer execution. But according to the
> comment above `save-buffer-state`, there might be a similar macro in
> font-lock.el. Yes there is.
> I did a grep in emacs source and found lots of them. Then I look at the
> body part of that macro expansion: `(unwind-protect (progn
> (remove-text-properties (point-min) (point-max) 'fontified)))`. However
> I failed to find any occurrence. It might be another macro expansion
> here. So I decide to put it aside and will investigate later.
>
> Best regards,
> Jiege CHen
[-- Attachment #2: Type: text/html, Size: 8546 bytes --]
next prev parent reply other threads:[~2016-06-18 0:09 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 [this message]
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
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=EECF7C4F-CB2B-4843-8E8F-00EF3DF89288@qq.com \
--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).