all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: bug in 23.2.92 with anything
Date: Mon, 17 Jan 2011 11:09:29 +0100	[thread overview]
Message-ID: <87hbd7u9ie.fsf@gmail.com> (raw)
In-Reply-To: <4D32C9F5.3090205@gmx.at> (martin rudalics's message of "Sun, 16 Jan 2011 11:35:33 +0100")

martin rudalics <rudalics@gmx.at> writes:

>> Actually, using a global variable like this is butt-ugly.
>
> Indeed.
>
>> Could some one rename Fselect_window to something else, add a third
>> parameter to it and create a new Fselect_window that calls it (and let
>> Fset_window_configuration call the new function with the new param), so
>> as to get rid of this global var?
>
> Thierry could you try the attached patch against the trunk window.c?

Your patch don't apply correctly, could you make it with git and tell me
on which revision number it apply?

> Thanks, martin
> === modified file 'src/window.c'
> *** src/window.c	2011-01-15 23:16:57 +0000
> --- src/window.c	2011-01-16 10:18:51 +0000
> ***************
> *** 85,90 ****
> --- 85,91 ----
>                                int (* fn) (struct window *, void *),
>                                void *);
>   static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
> + static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
>   
>   /* This is the window in which the terminal's cursor should
>      be left when nothing is being done with it.  This must
> ***************
> *** 158,168 ****
>   
>   static int window_initialized;
>   
> - /* Set in `set-window-configuration' to prevent "swapping out point"
> -    in the old selected window.  */
> - 
> - static int inhibit_point_swap;
> - 
>   /* Hook to run when window config changes.  */
>   
>   static Lisp_Object Qwindow_configuration_change_hook;
> --- 159,164 ----
> ***************
> *** 3550,3569 ****
>     return Qnil;
>   }
>   
> - /* Note that selected_window can be nil when this is called from
> -    Fset_window_configuration.  */
>   
> ! DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
> !        doc: /* Select WINDOW.  Most editing will apply to WINDOW's buffer.
> ! If WINDOW is not already selected, make WINDOW's buffer current
> ! and make WINDOW the frame's selected window.  Return WINDOW.
> ! Optional second arg NORECORD non-nil means do not put this buffer
> ! at the front of the list of recently selected ones and do not
> ! make this window the most recently selected one.
>   
> ! Note that the main editor command loop selects the buffer of the
> ! selected window before each command.  */)
> !   (register Lisp_Object window, Lisp_Object norecord)
>   {
>     register struct window *w;
>     register struct window *ow;
> --- 3546,3560 ----
>     return Qnil;
>   }
>   
>   
> ! /* If select_window is called with inhibit_point_swap non-zero it will
> !    not store point of the old selected window's buffer back into that
> !    window's pointm slot.  This is needed by Fset_window_configuration to
> !    avoid that the display routine is called with selected_window set to
> !    Qnil causing a subsequent crash.  */
>   
> ! static Lisp_Object
> ! select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
>   {
>     register struct window *w;
>     register struct window *ow;
> ***************
> *** 3603,3611 ****
>     /* Store the current buffer's actual point into the
>        old selected window.  It belongs to that window,
>        and when the window is not selected, must be in the window.  */
> !   if (inhibit_point_swap)
> !     inhibit_point_swap = 0;
> !   else
>       {
>         ow = XWINDOW (selected_window);
>         if (! NILP (ow->buffer))
> --- 3594,3600 ----
>     /* Store the current buffer's actual point into the
>        old selected window.  It belongs to that window,
>        and when the window is not selected, must be in the window.  */
> !   if (! inhibit_point_swap)
>       {
>         ow = XWINDOW (selected_window);
>         if (! NILP (ow->buffer))
> ***************
> *** 3639,3644 ****
> --- 3628,3648 ----
>     return window;
>   }
>   
> + DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
> +        doc: /* Select WINDOW.  Most editing will apply to WINDOW's buffer.
> + If WINDOW is not already selected, make WINDOW's buffer current
> + and make WINDOW the frame's selected window.  Return WINDOW.
> + Optional second arg NORECORD non-nil means do not put this buffer
> + at the front of the list of recently selected ones and do not
> + make this window the most recently selected one.
> + 
> + Note that the main editor command loop selects the buffer of the
> + selected window before each command.  */)
> +   (register Lisp_Object window, Lisp_Object norecord)
> + {
> +   select_window (window, norecord, 0);
> + }
> + 
>   static Lisp_Object
>   select_window_norecord (Lisp_Object window)
>   {
> ***************
> *** 6167,6174 ****
>   	 out point" in the old selected window using the buffer that
>   	 has been restored into it.  We already swapped out that point
>   	 from that window's old buffer.  */
> !       inhibit_point_swap = 1;
> !       Fselect_window (data->current_window, Qnil);
>         XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
>   	= selected_window;
>   
> --- 6171,6177 ----
>   	 out point" in the old selected window using the buffer that
>   	 has been restored into it.  We already swapped out that point
>   	 from that window's old buffer.  */
> !       select_window (data->current_window, Qnil, 1);
>         XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
>   	= selected_window;
>   
> ***************
> *** 7099,7106 ****
>     window_scroll_preserve_hpos = -1;
>     window_scroll_preserve_vpos = -1;
>   
> -   inhibit_point_swap = 0;
> - 
>     DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
>   	       doc: /* Non-nil means call as function to display a help buffer.
>   The function is called with one argument, the buffer to be displayed.
> --- 7102,7107 ----
>

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 



  reply	other threads:[~2011-01-17 10:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15 19:05 bug in 23.2.92 with anything Thierry Volpiatto
2011-01-15 19:47 ` Chong Yidong
2011-01-15 20:27   ` Thierry Volpiatto
2011-01-15 20:05 ` martin rudalics
2011-01-15 21:00   ` Thierry Volpiatto
2011-01-15 21:35   ` Chong Yidong
2011-01-15 21:54     ` martin rudalics
2011-01-15 22:33       ` Thierry Volpiatto
2011-01-16  0:04         ` martin rudalics
2011-01-16  7:16           ` Thierry Volpiatto
2011-01-16 10:37             ` martin rudalics
2011-01-17  9:49               ` Thierry Volpiatto
2011-01-17 10:28                 ` martin rudalics
2011-01-17 10:37                   ` Thierry Volpiatto
2011-01-17 10:47                     ` martin rudalics
2011-01-17 13:09                       ` Thierry Volpiatto
2011-01-17 10:45                   ` Thierry Volpiatto
2011-01-17 12:00                   ` Thierry Volpiatto
2011-01-17 17:48                     ` martin rudalics
2011-01-17 18:09                       ` Thierry Volpiatto
2011-01-18  7:47                         ` martin rudalics
2011-01-18  8:55                           ` Thierry Volpiatto
2011-01-18  9:12                             ` martin rudalics
2011-01-18 10:12                               ` Thierry Volpiatto
2011-01-18 12:02                                 ` Simon Leinen
2011-01-22  2:45                                   ` Chong Yidong
2011-01-18 15:11                             ` Eli Zaretskii
2011-01-18 15:50                               ` Thierry Volpiatto
2011-01-18 15:52                                 ` Eli Zaretskii
2011-01-18 18:52                                   ` Thierry Volpiatto
2011-01-20  1:17                                   ` David De La Harpe Golden
2011-01-20  7:37                                     ` Thierry Volpiatto
2011-01-20  8:25                                       ` Eli Zaretskii
2011-01-20 11:07                                         ` Stephen J. Turnbull
2011-01-16  4:26   ` Stefan Monnier
2011-01-16  9:30     ` Eli Zaretskii
2011-01-16 11:35       ` martin rudalics
2011-01-16 13:48         ` Eli Zaretskii
2011-01-16 17:51           ` martin rudalics
2011-01-16 15:16         ` Stefan Monnier
2011-01-16 17:51           ` martin rudalics
2011-01-16 22:48             ` Eli Zaretskii
2011-01-16 23:23               ` martin rudalics
2011-01-17 12:52                 ` Eli Zaretskii
2011-01-17 17:48                   ` martin rudalics
2011-01-16 10:35     ` martin rudalics
2011-01-17 10:09       ` Thierry Volpiatto [this message]
2011-01-17 10:43         ` martin rudalics

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

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

  git send-email \
    --in-reply-to=87hbd7u9ie.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.