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: Mon, 21 Jan 2008 21:44:40 +0100 [thread overview]
Message-ID: <87ve5mc3if.fsf@gmx.de> (raw)
In-Reply-To: <ubq7fndr9.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 21 Jan 2008 22:07:54 +0200")
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.
>> 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.
>> Eli, is switching away from the buffer even if it is modified the
>> intended behavior?
>
> Sorry, I don't understand the question. Could you please explain?
In a Dired buffer, I typed v to view the file at point. Then I typed
C-x C-q, edited the buffer and pressed C-x C-q again to re-enter view
mode. Then I typed q and the result was that I was back in the Dired
buffer. Yet C-x C-b showed the modified (now writable) file buffer at
the top of the buffer list. I would expect that it would either
a) not be switched away from; or
b) buried.
But maybe this is not so important. There is another inconsistency,
though: pressing C-x C-q in the modified buffer does not enter view mode
again.
next prev parent reply other threads:[~2008-01-21 20:44 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 [this message]
2008-01-22 6:55 ` Sven Joachim
2008-01-22 13:57 ` martin rudalics
2008-01-24 18:48 ` Sven Joachim
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=87ve5mc3if.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.