unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: rms@gnu.org
Cc: andreas.roehler@easy-emacs.de, emacs-devel@gnu.org
Subject: Re: auto-insert help-buffer
Date: Thu, 08 Mar 2007 21:06:55 -0500	[thread overview]
Message-ID: <874povnpa8.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1HPQTO-0003LT-0P@fencepost.gnu.org> (Richard Stallman's message of "Thu\, 08 Mar 2007 16\:48\:30 -0500")

Richard Stallman <rms@gnu.org> writes:

> If the event that was read is a mouse event, and the buffer it's on is
> the help buffer, it should discard the unwind-protect without
> restoring the old window config.
>
> If the event is not a mouse event, it should do what it does now.
>
> It's not perfectly simple, but it is not very complex either.
>
> Can you implement that?

How bout this (modulo comments)?

I cancel the window config unwinding as long as the user clicks
anywhere using the mouse, not just the help window---it's too much
trouble trying to identify the help window.  I think this is an
acceptable compromise.

*** emacs/src/keyboard.c.~1.892.~	2007-01-27 13:29:49.000000000 -0500
--- emacs/src/keyboard.c	2007-03-08 21:04:16.000000000 -0500
***************
*** 2450,2455 ****
--- 2450,2466 ----
  static Lisp_Object kbd_buffer_get_event ();
  static void record_char ();
  
+ static Lisp_Object help_form_saved_window_configs;
+ static Lisp_Object
+ read_char_help_form_unwind (arg)
+ {
+   Lisp_Object window_config = XCAR (help_form_saved_window_configs);
+   help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
+   if (!NILP (window_config))
+     Fset_window_configuration (window_config);
+   return Qnil;
+ }
+ 
  #ifdef MULTI_KBOARD
  static jmp_buf wrong_kboard_jmpbuf;
  #endif
***************
*** 3319,3326 ****
        Lisp_Object tem0;
        count = SPECPDL_INDEX ();
  
!       record_unwind_protect (Fset_window_configuration,
! 			     Fcurrent_window_configuration (Qnil));
  
        tem0 = Feval (Vhelp_form);
        if (STRINGP (tem0))
--- 3330,3339 ----
        Lisp_Object tem0;
        count = SPECPDL_INDEX ();
  
!       record_unwind_protect (read_char_help_form_unwind, Qnil);
!       help_form_saved_window_configs
! 	= Fcons (Fcurrent_window_configuration (Qnil),
! 		 help_form_saved_window_configs);
  
        tem0 = Feval (Vhelp_form);
        if (STRINGP (tem0))
***************
*** 3328,3334 ****
  
        cancel_echoing ();
        do
! 	c = read_char (0, 0, 0, Qnil, 0, NULL);
        while (BUFFERP (c));
        /* Remove the help from the frame */
        unbind_to (count, Qnil);
--- 3341,3352 ----
  
        cancel_echoing ();
        do
! 	{
! 	  c = read_char (0, 0, 0, Qnil, 0, NULL);
! 	  if (EVENT_HAS_PARAMETERS (c)
! 	      && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click))
! 	    XSETCAR (help_form_saved_window_configs, Qnil);
! 	}
        while (BUFFERP (c));
        /* Remove the help from the frame */
        unbind_to (count, Qnil);
***************
*** 11335,11340 ****
--- 11353,11361 ----
    menu_bar_items_vector = Qnil;
    staticpro (&menu_bar_items_vector);
  
+   help_form_saved_window_configs = Qnil;
+   staticpro (&help_form_saved_window_configs);
+ 
    defsubr (&Scurrent_idle_time);
    defsubr (&Sevent_convert_list);
    defsubr (&Sread_key_sequence);

  reply	other threads:[~2007-03-09  2:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <45D967C4.5060104@easy-emacs.de>
2007-03-08 16:23 ` auto-insert help-buffer Chong Yidong
2007-03-08 21:48   ` Richard Stallman
2007-03-09  2:06     ` Chong Yidong [this message]
2007-03-09 21:27       ` Richard Stallman
2007-03-10  4:48         ` Chong Yidong
2007-03-11  4:23           ` Richard Stallman

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=874povnpa8.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 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).