bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer


From: Jiege Chen
Subject: bug#23777: 25.0.95; Throwing (error "Selecting deleted buffer") in timer
Date: Sat, 18 Jun 2016 08:09:21 +0800


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]