unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: ishikawa <chiaki.ishikawa@ubin.jp>
To: martin rudalics <rudalics@gmx.at>, bug-gnu-emacs@gnu.org
Cc: ishikawa <chiaki.ishikawa@ubin.jp>
Subject: Re: Strange error caused by post-command-hook.
Date: Wed, 11 Jul 2007 21:27:28 +0900	[thread overview]
Message-ID: <4694CCB0.1040907@ubin.jp> (raw)
In-Reply-To: <4694C89C.5000402@ubin.jp>

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

  reply	other threads:[~2007-07-11 12:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4694CCB0.1040907@ubin.jp \
    --to=chiaki.ishikawa@ubin.jp \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=rudalics@gmx.at \
    /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 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).