From: Sven Joachim <svenjoac@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: kill-buffer-if-not-modified: Wrong type argument: bufferp, t
Date: Thu, 24 Jan 2008 19:48:38 +0100 [thread overview]
Message-ID: <87y7af3vqx.fsf@gmx.de> (raw)
In-Reply-To: <87ve5mc3if.fsf@gmx.de> (Sven Joachim's message of "Mon, 21 Jan 2008 21:44:40 +0100")
On 2008-01-21 21:44 +0100, Sven Joachim wrote:
> On 2008-01-21 21:07 +0100, Eli Zaretskii wrote:
>
>> Sorry for messing up. Please show me the full traceback, I didn't
>> expect this function to be called with t as its argument.
>
> Here it comes:
>
> ,----
> | Debugger entered--Lisp error: (wrong-type-argument bufferp t)
> | buffer-modified-p(t)
> | kill-buffer-if-not-modified(#<buffer junk>)
> | view-mode-exit(((#<window 249 on sven> nil #<buffer sven> 6889 8214) (#<window 177> nil #<buffer sven> 7472 8351) (#<window 164> nil #<buffer sven> 7755 8214)) kill-buffer-if-not-modified)
> | View-quit()
> | call-interactively(View-quit)
> `----
>
> The reason is that (bufferp buf) returns t if buf is a buffer, so
> (or (bufferp buf) (get-buffer buf)) returns t as well and buf is set to t.
And buffer-modified-p does not accept t as argument, I should add.
>>> It seems that this patch fixes the issue:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> --- view.el 21 Jan 2008 18:51:02 +0100 1.84.2.9
>>> +++ view.el 21 Jan 2008 19:26:10 +0100
>>> @@ -244,7 +244,9 @@
>>> ;; types C-x C-q again to return to view mode.
>>> (defun kill-buffer-if-not-modified (buf)
>>> "Like `kill-buffer', but does nothing if the buffer is modified."
>>> - (let ((buf (or (bufferp buf) (get-buffer buf))))
>>> + (let ((buf (if (bufferp buf)
>>> + buf
>>> + (get-buffer buf))))
>>> (and buf (not (buffer-modified-p buf))
>>> (kill-buffer buf))))
>>
>> I'm not sure this is the right fix, that's why I want to see the
>> traceback.
>
> As Andreas and Stefan already noted, just
>
> (let ((buf (get-buffer buf)))
>
> would suffice.
Here is a cleaned up patch (that I've been using for two days) and
Changelog entry. Would you please install that?
--8<---------------cut here---------------start------------->8---
--- view.el 21 Jan 2008 18:51:02 +0100 1.84.2.9
+++ view.el 22 Jan 2008 08:30:22 +0100
@@ -244,7 +244,7 @@
;; types C-x C-q again to return to view mode.
(defun kill-buffer-if-not-modified (buf)
"Like `kill-buffer', but does nothing if the buffer is modified."
- (let ((buf (or (bufferp buf) (get-buffer buf))))
+ (let ((buf (get-buffer buf)))
(and buf (not (buffer-modified-p buf))
(kill-buffer buf))))
--8<---------------cut here---------------end--------------->8---
2008-01-24 Sven Joachim <svenjoac@gmx.de>
* view.el (kill-buffer-if-not-modified): Don't pass t to
buffer-modified-p.
next prev parent reply other threads:[~2008-01-24 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 18:44 kill-buffer-if-not-modified: Wrong type argument: bufferp, t Sven Joachim
2008-01-21 19:55 ` Andreas Schwab
2008-01-21 20:07 ` Eli Zaretskii
2008-01-21 20:44 ` Sven Joachim
2008-01-22 6:55 ` Sven Joachim
2008-01-22 13:57 ` martin rudalics
2008-01-24 18:48 ` Sven Joachim [this message]
2008-01-25 4:42 ` Glenn Morris
2008-01-21 20:08 ` Stefan Monnier
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=87y7af3vqx.fsf@gmx.de \
--to=svenjoac@gmx.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@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 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.