* BUG REPORT: `kill-buffer-query-functions'
@ 2003-02-27 23:48 Le Wang
2003-03-01 2:26 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: Le Wang @ 2003-02-27 23:48 UTC (permalink / raw)
Hi,
When making this hook buffer local, the 't add at the end is called as a
function, and of course it's not a function.
--
Le
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: BUG REPORT: `kill-buffer-query-functions'
2003-02-27 23:48 BUG REPORT: `kill-buffer-query-functions' Le Wang
@ 2003-03-01 2:26 ` Richard Stallman
2003-03-01 3:08 ` Le Wang
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2003-03-01 2:26 UTC (permalink / raw)
Cc: emacs-devel
When making this hook buffer local, the 't add at the end is called as a
function, and of course it's not a function.
Would you please send a precise test case?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: BUG REPORT: `kill-buffer-query-functions'
2003-03-01 2:26 ` Richard Stallman
@ 2003-03-01 3:08 ` Le Wang
2003-03-03 18:58 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: Le Wang @ 2003-03-01 3:08 UTC (permalink / raw)
Richard Stallman wrote:
> When making this hook buffer local, the 't add at the end is called as a
> function, and of course it's not a function.
>
> Would you please send a precise test case?
Sure thing.
1. emacs -q
2. paste this code in scratch
(defun test-query ()
(if (and (buffer-modified-p)
(not (y-or-n-p (format "Abandon changes to %s? (y/n) "
(buffer-name)))))
nil
t))
(add-hook 'kill-buffer-query-functions 'test-query nil t)
3. eval it.
4. <M-x> kill-this-buffer
5. answer `y' when prompted.
6. Error: Symbol's function definition is void: t
--
Le
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: BUG REPORT: `kill-buffer-query-functions'
2003-03-01 3:08 ` Le Wang
@ 2003-03-03 18:58 ` Richard Stallman
2003-03-04 0:57 ` Le Wang
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2003-03-03 18:58 UTC (permalink / raw)
Cc: emacs-devel
Now I understand. Does this fix it?
Thanks.
*** buffer.c.~1.414.~ Wed Feb 26 04:57:11 2003
--- buffer.c Sun Mar 2 15:07:46 2003
***************
*** 150,155 ****
--- 150,156 ----
/* List of functions to call that can query about killing a buffer.
If any of these functions returns nil, we don't kill it. */
Lisp_Object Vkill_buffer_query_functions;
+ Lisp_Object Qkill_buffer_query_functions;
/* List of functions to call before changing an unmodified buffer. */
Lisp_Object Vfirst_change_hook;
***************
*** 1304,1321 ****
{
int count = SPECPDL_INDEX ();
Lisp_Object list;
record_unwind_protect (save_excursion_restore, save_excursion_save ());
set_buffer_internal (b);
/* First run the query functions; if any query is answered no,
don't kill the buffer. */
! for (list = Vkill_buffer_query_functions; CONSP (list); list = XCDR (list))
! {
! tem = call0 (XCAR (list));
! if (NILP (tem))
! return unbind_to (count, Qnil);
! }
/* Then run the hooks. */
Frun_hooks (1, &Qkill_buffer_hook);
--- 1305,1320 ----
{
int count = SPECPDL_INDEX ();
Lisp_Object list;
+ Lisp_Object arglist[1];
record_unwind_protect (save_excursion_restore, save_excursion_save ());
set_buffer_internal (b);
/* First run the query functions; if any query is answered no,
don't kill the buffer. */
! arglist[0] = Qkill_buffer_query_functions;
! if (NILP (Frun_hook_with_args_until_failure (1, arglist)))
! return unbind_to (count, Qnil);
/* Then run the hooks. */
Frun_hooks (1, &Qkill_buffer_hook);
***************
*** 5150,5155 ****
--- 5149,5157 ----
Qafter_change_functions = intern ("after-change-functions");
staticpro (&Qafter_change_functions);
staticpro (&Qucs_set_table_for_input);
+
+ Qkill_buffer_query_functions = intern ("kill-buffer-query-functions");
+ staticpro (&Qkill_buffer_query_functions);
Fput (Qprotected_field, Qerror_conditions,
Fcons (Qprotected_field, Fcons (Qerror, Qnil)));
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: BUG REPORT: `kill-buffer-query-functions'
2003-03-03 18:58 ` Richard Stallman
@ 2003-03-04 0:57 ` Le Wang
2003-03-05 20:48 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: Le Wang @ 2003-03-04 0:57 UTC (permalink / raw)
Richard Stallman wrote:
> Now I understand. Does this fix it?
Yikes. I just tried it quickly, and my Emacs won't start any more, with an
error message:
Wrong type argument: stringp, t
I got today's cvs head. Then I checked out the previous version (1.414) of
buffer.c and all was well again.
--
Le
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: BUG REPORT: `kill-buffer-query-functions'
2003-03-04 0:57 ` Le Wang
@ 2003-03-05 20:48 ` Richard Stallman
0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2003-03-05 20:48 UTC (permalink / raw)
Cc: emacs-devel
Yikes. I just tried it quickly, and my Emacs won't start any more, with an
error message:
Wrong type argument: stringp, t
This does not fail for me, so I guess you need to debug it. Try a
breakpoint at Fsignal. Some errors (caught with condition-case)
normally occur at startup, so don't assume that the first call to
Fsignal is this one.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-03-05 20:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-27 23:48 BUG REPORT: `kill-buffer-query-functions' Le Wang
2003-03-01 2:26 ` Richard Stallman
2003-03-01 3:08 ` Le Wang
2003-03-03 18:58 ` Richard Stallman
2003-03-04 0:57 ` Le Wang
2003-03-05 20:48 ` Richard Stallman
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).