unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Strange error caused by post-command-hook.
@ 2007-07-10 12:35 ishikawa
  2007-07-10 13:52 ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: ishikawa @ 2007-07-10 12:35 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: ishikawa

Strange error caused by post-command-hook.

I have a problem caused by apparently an incorrect hook installed
in post-command-hook and am at a loss about how to track it down.
Any helpful tips are appreciated.

(I have not seen this in pre-22.1 emacs version all the way back
to 18.5x).

Version:
emacs-version is a variable defined in `/u2/ishikawa/emacs-22.1/lisp/version.el'.
Its value is "22.1.1"

OS:
Linux dell-w2k-note 2.6.20-1.2320.fc5 #1 Tue Jun 12 18:50:38 EDT 2007 i686 i686
i386 GNU/Linux
(Fedora Core 5)


Symptom:

For some reason which I have not figured out completely (but I suspect
trying to run M-x man for non-existing command utility such as M-x man
foobar tends to cause the following symptom very likely, but not
always :-( ), once the following message begins to appear in the
minibuffer whenever a minibuffer interaction is attemped,

  Error in post-command-hook: (error Selecting deleted buffer)

this message seems to re-appear (almost) always in the mini-buffer.

This message obscures the prompt message which should have been shown
in the first place.  For example, if I type C-c C-f, the default
directory usually shown is obscured with overlapping message (above).
(Funny if I type C-c C-v, the error message doesn't show up.)

A good news about this bad news is once I insert a key into the minibuffer,
the message disappears and the intended prompt message, which has been
obsucred, as well as the key I type is now shown in its complete form.

So it is not a fatal bug, but very irritating and as far as user
interface is concerned, emacs is very difficult to use after this
happens. The first time I notice this problem, I had to exit emacs and
start again.

Now, from reading the "C-H v" help message for 'post-command-hook', if
an error occurs when the hook is run from post-command-hook,
the hook is set to nil.  But if this is set to "nil" permanently, I
should not see this repetition of the same error message over and over
again. (Correct?)

Does this mean that whatever is causing the incorrect hook to be installed
is trying to install this invalid hook again and again?

========================================
>From C-H help message:
----------------------
post-command-hook is a variable defined in `C source code'.
Its value is nil


Documentation:
Normal hook run after each command is executed.
If an unhandled error happens in running this hook,
the hook value is set to nil, since otherwise the error
might happen repeatedly and make Emacs nonfunctional.

[back]
========================================

Now I have an additional observation, which seems to suggest
that something (but I don't know which library) is trying
to install this invalid hook again and again.

Very strange observation:

I just noticed that a very strange sequence of events.  Now I am using
an emacs session when the described error message appears.

When I hit "C-c C-f" the first time, I get the error message as
described above.  But if I hit "C-g" to stop the interaction, and hit
"C-c c-f" again, the second "C-c C-f" is followed by the correct
prompt, i.e., the default directory (for "find-file" that is.). The
error message is not shown.  However, if I hit "c-g" to stop this
correct interaction, and hit "C-c c-f" again, I get the error message
described above. And the process repeats forever.

========================================
>From *Messages* buffer
----------------------------------------
     ...
Error in post-command-hook: (error Selecting deleted buffer)
Mark set [2 times]
(New file)
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
<<< Press Return to bury the buffer list >>>
    ...
========================================


I am using "electric-buffer-list" and it seems that the combination
of electric-buffer-list and man against non-existing command name
seems to trigger the bug/feature, but not always.

Any helpful tips to track down this problem are appreciated.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-10 12:35 Strange error caused by post-command-hook ishikawa
@ 2007-07-10 13:52 ` martin rudalics
  2007-07-11  9:30   ` ishikawa
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2007-07-10 13:52 UTC (permalink / raw)
  To: ishikawa; +Cc: bug-gnu-emacs

 > [...] once the following message begins to appear in the
 > minibuffer whenever a minibuffer interaction is attemped,
 >
 >   Error in post-command-hook: (error Selecting deleted buffer)
 >
 > this message seems to re-appear (almost) always in the mini-buffer.
 >
 > This message obscures the prompt message which should have been shown
 > in the first place.  For example, if I type C-c C-f, the default
 > directory usually shown is obscured with overlapping message (above).
 > (Funny if I type C-c C-v, the error message doesn't show up.)

Do you intend the commands `find-file' and `find-alternate-file' here?
You could try to add ...

(defun find-file (filename &optional wildcards)
   "..."
   (interactive
    (progn
      (when post-command-hook
        (message "... %s" post-command-hook) (sit-for 1))
      (find-file-read-args "Find file: " nil)))	
   (let ((value (find-file-noselect filename nil nil wildcards)))
     (if (listp value)
	(mapcar 'switch-to-buffer (nreverse value))
       (switch-to-buffer value))))

... to your .emacs.  As soon as `find-file' triggers the message _and_
the error please tell us the value for `post-command-hook' printed by
the message (although your observations indicate that the error is
triggered _before_ the command gets executed).

 > Now, from reading the "C-H v" help message for 'post-command-hook', if
 > an error occurs when the hook is run from post-command-hook,
 > the hook is set to nil.  But if this is set to "nil" permanently, I
 > should not see this repetition of the same error message over and over
 > again. (Correct?)
 >
 > Does this mean that whatever is causing the incorrect hook to be installed
 > is trying to install this invalid hook again and again?

Yes.

 > <<< Press Return to bury the buffer list >>>

This seems to come from `electric-buffer-list' which I don't know.
AFAICT it doesn't install a `post-command-hook' though.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-10 13:52 ` martin rudalics
@ 2007-07-11  9:30   ` ishikawa
  2007-07-11 11:47     ` martin rudalics
  2007-07-11 11:53     ` ishikawa
  0 siblings, 2 replies; 11+ messages in thread
From: ishikawa @ 2007-07-11  9:30 UTC (permalink / raw)
  To: martin rudalics; +Cc: bug-gnu-emacs

Dear Martin Rudalics,

Thank you for the suggestion.

I have inserted the re-defined find-file in my .emacs file.
Once the problem returns, I will report the value of
post-command-hook.
(Aha, I see that the problem may happen before find-file gets executed.
How complicated...)

Chiaki Ishikawa

martin rudalics wrote:
>  > [...] once the following message begins to appear in the
>  > minibuffer whenever a minibuffer interaction is attemped,
>  >
>  >   Error in post-command-hook: (error Selecting deleted buffer)
>  >
>  > this message seems to re-appear (almost) always in the mini-buffer.
>  >
>  > This message obscures the prompt message which should have been shown
>  > in the first place.  For example, if I type C-c C-f, the default
>  > directory usually shown is obscured with overlapping message (above).
>  > (Funny if I type C-c C-v, the error message doesn't show up.)
> 
> Do you intend the commands `find-file' and `find-alternate-file' here?
> You could try to add ...
> 
> (defun find-file (filename &optional wildcards)
>   "..."
>   (interactive
>    (progn
>      (when post-command-hook
>        (message "... %s" post-command-hook) (sit-for 1))
>      (find-file-read-args "Find file: " nil)))   
>   (let ((value (find-file-noselect filename nil nil wildcards)))
>     (if (listp value)
>     (mapcar 'switch-to-buffer (nreverse value))
>       (switch-to-buffer value))))
> 
> ... to your .emacs.  As soon as `find-file' triggers the message _and_
> the error please tell us the value for `post-command-hook' printed by
> the message (although your observations indicate that the error is
> triggered _before_ the command gets executed).
> 
>  > Now, from reading the "C-H v" help message for 'post-command-hook', if
>  > an error occurs when the hook is run from post-command-hook,
>  > the hook is set to nil.  But if this is set to "nil" permanently, I
>  > should not see this repetition of the same error message over and over
>  > again. (Correct?)
>  >
>  > Does this mean that whatever is causing the incorrect hook to be 
> installed
>  > is trying to install this invalid hook again and again?
> 
> Yes.
> 
>  > <<< Press Return to bury the buffer list >>>
> 
> This seems to come from `electric-buffer-list' which I don't know.
> AFAICT it doesn't install a `post-command-hook' though.
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11  9:30   ` ishikawa
@ 2007-07-11 11:47     ` martin rudalics
  2007-07-11 12:10       ` ishikawa
  2007-07-11 11:53     ` ishikawa
  1 sibling, 1 reply; 11+ messages in thread
From: martin rudalics @ 2007-07-11 11:47 UTC (permalink / raw)
  To: ishikawa; +Cc: bug-gnu-emacs

 > I have inserted the re-defined find-file in my .emacs file.
 > Once the problem returns, I will report the value of
 > post-command-hook.
 > (Aha, I see that the problem may happen before find-file gets executed.
 > How complicated...)

I expected that.  Try the following (more intrusive):

(add-hook 'pre-command-hook
	  (lambda ()
	    (when post-command-hook
	      (message "... %s" post-command-hook))))

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11  9:30   ` ishikawa
  2007-07-11 11:47     ` martin rudalics
@ 2007-07-11 11:53     ` ishikawa
  1 sibling, 0 replies; 11+ messages in thread
From: ishikawa @ 2007-07-11 11:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: ishikawa, bug-gnu-emacs

Using the suggestion, I tried to
print the value of post-command-hook.

Unfortunately, when the discussed error message is
seen, by the time 'find-file' is invoked, the
value of post-command-hook seems to have been cleared to nil, and
I don't get the print out of post-command-hook.

(I *DO* get the print ouf of post-command-hook occasionally
when I invoked find-file and so the code is correct as far
as the coding goes.)

I am now looking at keyboard.c and pondering to
modify it to print out of the value of post-command-hook using Fmessage()
when run_hook_safely() is called (and the argument is post-command-hook).

If someone has a better idea of tracking down the value in a general manner,
short of modifying the keyboard.c source file, please let me know.

I am going to insert Fmessage() anyway since it won't hurt so much...

Chiaki Ishikawa

PS: Yes, the problem happened again in about 10 minutes time of
real-world editing. I checked my local e-lisp code files and
there was only one instance of post-hook-command mentioned in my code files,
and that file is not used. So the culprit is somewhere else...
Oh, wait, I have a few more code repositories one for Japanese input and
the other for reading a popular BBS.
In any case, by printing out the value, I should be able to
get closer to the cause of the bug.

TIA.




ishikawa wrote:
> Dear Martin Rudalics,
> 
> Thank you for the suggestion.
> 
> I have inserted the re-defined find-file in my .emacs file.
> Once the problem returns, I will report the value of
> post-command-hook.
> (Aha, I see that the problem may happen before find-file gets executed.
> How complicated...)
> 
> Chiaki Ishikawa
> 
> martin rudalics wrote:
>>  > [...] once the following message begins to appear in the
>>  > minibuffer whenever a minibuffer interaction is attemped,
>>  >
>>  >   Error in post-command-hook: (error Selecting deleted buffer)
>>  >
>>  > this message seems to re-appear (almost) always in the mini-buffer.
>>  >
>>  > This message obscures the prompt message which should have been shown
>>  > in the first place.  For example, if I type C-c C-f, the default
>>  > directory usually shown is obscured with overlapping message (above).
>>  > (Funny if I type C-c C-v, the error message doesn't show up.)
>>
>> Do you intend the commands `find-file' and `find-alternate-file' here?
>> You could try to add ...
>>
>> (defun find-file (filename &optional wildcards)
>>   "..."
>>   (interactive
>>    (progn
>>      (when post-command-hook
>>        (message "... %s" post-command-hook) (sit-for 1))
>>      (find-file-read-args "Find file: " nil)))     (let ((value 
>> (find-file-noselect filename nil nil wildcards)))
>>     (if (listp value)
>>     (mapcar 'switch-to-buffer (nreverse value))
>>       (switch-to-buffer value))))
>>
>> ... to your .emacs.  As soon as `find-file' triggers the message _and_
>> the error please tell us the value for `post-command-hook' printed by
>> the message (although your observations indicate that the error is
>> triggered _before_ the command gets executed).
>>
>>  > Now, from reading the "C-H v" help message for 'post-command-hook', if
>>  > an error occurs when the hook is run from post-command-hook,
>>  > the hook is set to nil.  But if this is set to "nil" permanently, I
>>  > should not see this repetition of the same error message over and over
>>  > again. (Correct?)
>>  >
>>  > Does this mean that whatever is causing the incorrect hook to be 
>> installed
>>  > is trying to install this invalid hook again and again?
>>
>> Yes.
>>
>>  > <<< Press Return to bury the buffer list >>>
>>
>> This seems to come from `electric-buffer-list' which I don't know.
>> AFAICT it doesn't install a `post-command-hook' though.
>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11 11:47     ` martin rudalics
@ 2007-07-11 12:10       ` ishikawa
  2007-07-11 12:27         ` ishikawa
  2007-07-11 14:24         ` martin rudalics
  0 siblings, 2 replies; 11+ messages in thread
From: ishikawa @ 2007-07-11 12:10 UTC (permalink / raw)
  To: martin rudalics; +Cc: ishikawa, bug-gnu-emacs

Dear Martin Rudalics,

Thank you the suggestion. Before reading the following suggestion, I began
modifying the keyboard.c.

But I will try the following suggested tip first before compiling the
modified keyboard.c source file.

Chiaki Ishikawa

PS: Things get really strange. I tried the following tip, and found that
this doesn't really print anything of importance. It seems that the processing
that leads to the
"<< Press Return to bury the buffer list >>"
and probably the code that gets executed shortly after that is the candidate for 
the culprit.

Oh, wait, after a close look, I wonder what this 'tooltip-hide' is...

To wit: This is the *Mesasges* buffer after I added the
following hook:


((lambda nil (when post-command-hook (message "... %s" post-command-hook))) 
tooltip-hide)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer) [3 times]
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
((lambda nil (when post-command-hook (message "... %s" post-command-hook))) 
tooltip-hide)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark saved where search started [2 times]
Auto-saving...
Mark saved where search started [2 times]
Saving file /home/ishikawa/emacs-22.1/src/keyboard.c...
Wrote /home/ishikawa/emacs-22.1/src/keyboard.c
(No changes need to be saved)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Wrote /home/ishikawa/.emacs
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
<<< Press Return to bury the buffer list >>>
Error in post-command-hook: (error Selecting deleted buffer)
Mark set
Mark activated
Transient-mark-mode temporarily enabled
Saved text from "((lambda nil (when post-command-hook (me"
Mark set [2 times]



martin rudalics wrote:
>  > I have inserted the re-defined find-file in my .emacs file.
>  > Once the problem returns, I will report the value of
>  > post-command-hook.
>  > (Aha, I see that the problem may happen before find-file gets executed.
>  > How complicated...)
> 
> I expected that.  Try the following (more intrusive):
> 
> (add-hook 'pre-command-hook
>       (lambda ()
>         (when post-command-hook
>           (message "... %s" post-command-hook))))
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11 12:10       ` ishikawa
@ 2007-07-11 12:27         ` ishikawa
  2007-07-11 20:40           ` martin rudalics
  2007-07-11 14:24         ` martin rudalics
  1 sibling, 1 reply; 11+ messages in thread
From: ishikawa @ 2007-07-11 12:27 UTC (permalink / raw)
  To: martin rudalics, bug-gnu-emacs; +Cc: ishikawa

Hi,

I tried the following mods to record what is inside post-command-hook.
But this is too verbose and I wonder if there is a way to
record the output of Fmessage() only to *Message* file
instead of showing it to the minibuffer.
My mailer may input line-break inside the format string of Fmessage().


 From keyboard.c:

/* If we get an error while running the hook, cause the hook variable
    to be nil.  Also inhibit quits, so that C-g won't cause the hook
    to mysteriously evaporate.  */

void
safe_run_hooks (hook)
      Lisp_Object hook;
{
   int count = SPECPDL_INDEX ();

#if 0
   /* Local mods.
    * Tring to locate what erratic hook is set to post-command-hook.
    * Too verbose. I wonder if this could be only saved to Fmessage.
    */
   if(hook == Qpost_command_hook && ! NILP(Vpost_command_hook))
     {
       Lisp_Object args[3];
       args[0] = build_string ("Value of post-command hook in safe_run_hooks: %s");
       args[1] = Vpost_command_hook;
       Fmessage (2, args);
     }
#endif

   specbind (Qinhibit_quit, hook);

   internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error);

   unbind_to (count, Qnil);
}


Oh, maybe I can "copy" the value of post-command-hook and
re-print it after the error was detected...


ishikawa wrote:
ishikawa wrote:
> Dear Martin Rudalics,
> 
> Thank you the suggestion. Before reading the following suggestion, I began
> modifying the keyboard.c.
> 
> But I will try the following suggested tip first before compiling the
> modified keyboard.c source file.
> 
> Chiaki Ishikawa
> 
> PS: Things get really strange. I tried the following tip, and found that
> this doesn't really print anything of importance. It seems that the 
> processing
> that leads to the
> "<< Press Return to bury the buffer list >>"
> and probably the code that gets executed shortly after that is the 
> candidate for the culprit.
> 
> Oh, wait, after a close look, I wonder what this 'tooltip-hide' is...
> 
> To wit: This is the *Mesasges* buffer after I added the
> following hook:
> 
> 
> ((lambda nil (when post-command-hook (message "... %s" 
> post-command-hook))) tooltip-hide)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer) [3 times]
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark set
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark set
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> ((lambda nil (when post-command-hook (message "... %s" 
> post-command-hook))) tooltip-hide)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark set
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark set
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark saved where search started [2 times]
> Auto-saving...
> Mark saved where search started [2 times]
> Saving file /home/ishikawa/emacs-22.1/src/keyboard.c...
> Wrote /home/ishikawa/emacs-22.1/src/keyboard.c
> (No changes need to be saved)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Wrote /home/ishikawa/.emacs
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> <<< Press Return to bury the buffer list >>>
> Error in post-command-hook: (error Selecting deleted buffer)
> Mark set
> Mark activated
> Transient-mark-mode temporarily enabled
> Saved text from "((lambda nil (when post-command-hook (me"
> Mark set [2 times]
> 
> 
> 
> martin rudalics wrote:
>>  > I have inserted the re-defined find-file in my .emacs file.
>>  > Once the problem returns, I will report the value of
>>  > post-command-hook.
>>  > (Aha, I see that the problem may happen before find-file gets 
>> executed.
>>  > How complicated...)
>>
>> I expected that.  Try the following (more intrusive):
>>
>> (add-hook 'pre-command-hook
>>       (lambda ()
>>         (when post-command-hook
>>           (message "... %s" post-command-hook))))
>>
>>
> 
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11 12:10       ` ishikawa
  2007-07-11 12:27         ` ishikawa
@ 2007-07-11 14:24         ` martin rudalics
  1 sibling, 0 replies; 11+ messages in thread
From: martin rudalics @ 2007-07-11 14:24 UTC (permalink / raw)
  To: ishikawa; +Cc: bug-gnu-emacs

 > Oh, wait, after a close look, I wonder what this 'tooltip-hide' is...

You probably have `tooltip-mode' enabled.  If so you could try to
disable it and see whether the bug goes away?

 > To wit: This is the *Mesasges* buffer after I added the
 > following hook:

Just to double-check: Did you add it to `pre-command-hook' as ...

(add-hook 'pre-command-hook
	  (lambda ()
	    (when post-command-hook
	      (message "... %s" post-command-hook) (sit-for 1))))

... because I fail to understand the following message ...
	
 > ((lambda nil (when post-command-hook (message "... %s"
 > post-command-hook))) tooltip-hide)

... which looks like the value of `pre-command-hook'.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11 12:27         ` ishikawa
@ 2007-07-11 20:40           ` martin rudalics
  2007-07-12  8:00             ` ishikawa
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2007-07-11 20:40 UTC (permalink / raw)
  To: ishikawa; +Cc: bug-gnu-emacs

 > I tried the following mods to record what is inside post-command-hook.
 > But this is too verbose and I wonder if there is a way to
 > record the output of Fmessage() only to *Message* file
 > instead of showing it to the minibuffer.

My previous suggestions were rather silly.  The bug should occur with
`minibuffer-setup-hook', that is, within `minibuffer-with-setup-hook'.
You'd have to identify an object in your .emacs that causes
`minibuffer-setup-hook' to add a function to `post-command-hook' that's
triggering the bug, likely somewhere within `find-file-read-args'.
Could you try to edebug the latter?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-11 20:40           ` martin rudalics
@ 2007-07-12  8:00             ` ishikawa
  2007-07-12  8:54               ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: ishikawa @ 2007-07-12  8:00 UTC (permalink / raw)
  To: martin rudalics; +Cc: ishikawa, bug-gnu-emacs

Dear Martin Rudalics,

Thank you for the additional information.

I am now trying to figure out where minibuffer-setup-hook is set.
Things get quite interesting. It seems that there are certainly more
references to minibuffer-setup-hook than to post-command-hook, etc..

I need to refresh my knowledge of edebug now.

Thank you again.

Chiaki Ishikawa

martin rudalics wrote:
>  > I tried the following mods to record what is inside post-command-hook.
>  > But this is too verbose and I wonder if there is a way to
>  > record the output of Fmessage() only to *Message* file
>  > instead of showing it to the minibuffer.
> 
> My previous suggestions were rather silly.  The bug should occur with
> `minibuffer-setup-hook', that is, within `minibuffer-with-setup-hook'.
> You'd have to identify an object in your .emacs that causes
> `minibuffer-setup-hook' to add a function to `post-command-hook' that's
> triggering the bug, likely somewhere within `find-file-read-args'.
> Could you try to edebug the latter?
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Strange error caused by post-command-hook.
  2007-07-12  8:00             ` ishikawa
@ 2007-07-12  8:54               ` martin rudalics
  0 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2007-07-12  8:54 UTC (permalink / raw)
  To: ishikawa; +Cc: bug-gnu-emacs

 > I am now trying to figure out where minibuffer-setup-hook is set.
 > Things get quite interesting. It seems that there are certainly more
 > references to minibuffer-setup-hook than to post-command-hook, etc..
 >
 > I need to refresh my knowledge of edebug now.

Just to elaborate on this: One of the packages you call adds a
buffer-local post-command-hook when setting up the minibuffer like:

(add-hook 'post-command-hook 'foo ... t)

This means you cannot see "foo" when you investigate `post-command-hook'
_before_ executing a command because it's set up by the command itself.
If the function chokes because it wants to select a deleted buffer it's
automatically removed from `post-command-hook'.  Hence, you can't see it
_after_ executing the command when Emacs is still prompting you for a
file-name.  All you see is the error message which still obscures the
prompt.  Now consider:

(defun find-file-read-args (prompt mustmatch)
   (list (let ((find-file-default
	       (and buffer-file-name
		    (abbreviate-file-name buffer-file-name))))
	  (minibuffer-with-setup-hook
	      (lambda () (setq minibuffer-default find-file-default))
	    (read-file-name prompt nil default-directory mustmatch)))
	t))

First `read-file-name' puts the prompt in the minibuffer.  Then foo
triggers the bug and the prompt is overwritten because minibuffer and
echo area share the same screen area.  According to the Emacs manual the
error message should go away after a "few seconds".  I don't know
whether it does so with a `post-command-hook' error.

Anyway you have to find the function that wants to resurrect the deleted
buffer in the first place.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-07-12  8:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 12:35 Strange error caused by post-command-hook ishikawa
2007-07-10 13:52 ` martin rudalics
2007-07-11  9:30   ` ishikawa
2007-07-11 11:47     ` martin rudalics
2007-07-11 12:10       ` ishikawa
2007-07-11 12:27         ` ishikawa
2007-07-11 20:40           ` martin rudalics
2007-07-12  8:00             ` ishikawa
2007-07-12  8:54               ` martin rudalics
2007-07-11 14:24         ` martin rudalics
2007-07-11 11:53     ` ishikawa

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).