emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto-insert help-buffer


From: Chong Yidong
Subject: Re: auto-insert help-buffer
Date: Thu, 08 Mar 2007 21:06:55 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux)

Richard Stallman <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]