unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: 'struct window' cleanup #3
Date: Wed, 27 Jun 2012 21:59:58 +0400	[thread overview]
Message-ID: <4FEB4A1E.5060203@yandex.ru> (raw)
In-Reply-To: <83ehp08y8f.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

On 06/27/2012 09:24 PM, Eli Zaretskii wrote:
>> Date: Wed, 27 Jun 2012 11:10:34 +0400
>> From: Dmitry Antipov <dmantipov@yandex.ru>
>> CC: emacs-devel@gnu.org
>>
>> 1. IIUC, `window_initialized' is redundant and obsolete.
>
> Does it still work to run "./temacs -Q", after this change:
>
>> -  if (window_initialized)
>> +  if (initialized)
>
> The reason I ask is because window_initialized was set non-zero in
> init_window_once, which was called from emacs.c when 'initialized' is
> zero.  So the above 'if' would trigger when 'initialized' was zero,
> but after your change it will only trigger when 'initialized' is
> non-zero.  Am I missing something?  'initialized' is zero when running
> un-dumped Emacs, e.g. 'temacs'.

I would like to propose alternate redesign for this: init_window_once
sets Vframe_list to Qnil. After calling make_initial_frame, Vframe_list
becomes non-nil, so !NILP (Vframe_list) means init_window_once was
passed.

Dmitry



[-- Attachment #2: window_init.patch --]
[-- Type: text/plain, Size: 1614 bytes --]

=== modified file 'src/frame.c'
--- src/frame.c	2012-06-26 14:41:01 +0000
+++ src/frame.c	2012-06-27 17:55:27 +0000
@@ -465,10 +465,7 @@
   Lisp_Object frame;
 
   eassert (initial_kboard);
-
-  /* The first call must initialize Vframe_list.  */
-  if (! (NILP (Vframe_list) || CONSP (Vframe_list)))
-    Vframe_list = Qnil;
+  eassert (NILP (Vframe_list));
 
   terminal = init_initial_terminal ();
 

=== modified file 'src/window.c'
--- src/window.c	2012-06-26 14:41:01 +0000
+++ src/window.c	2012-06-27 17:53:02 +0000
@@ -117,9 +117,6 @@
 /* Incremented for each window created.  */
 static int sequence_number;
 
-/* Nonzero after init_window_once has finished.  */
-static int window_initialized;
-
 /* Hook to run when window config changes.  */
 static Lisp_Object Qwindow_configuration_change_hook;
 
@@ -3019,9 +3016,7 @@
   windows_or_buffers_changed++;
 
   /* We must select BUFFER for running the window-scroll-functions.  */
-  /* We can't check ! NILP (Vwindow_scroll_functions) here
-     because that might itself be a local variable.  */
-  if (window_initialized)
+  if (!NILP (Vframe_list))
     {
       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
       Fset_buffer (buffer);
@@ -6472,14 +6467,15 @@
 void
 init_window_once (void)
 {
-  struct frame *f = make_initial_frame ();
+  struct frame *f;
+
+  Vframe_list = Qnil;
+  f = make_initial_frame ();
   XSETFRAME (selected_frame, f);
   Vterminal_frame = selected_frame;
   minibuf_window = f->minibuffer_window;
   selected_window = f->selected_window;
   last_nonminibuf_frame = f;
-
-  window_initialized = 1;
 }
 
 void


  reply	other threads:[~2012-06-27 17:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25  8:56 'struct window' cleanup #2 Dmitry Antipov
2012-06-25 14:22 ` John Wiegley
2012-06-25 14:42   ` Dmitry Antipov
2012-06-25 14:27 ` Paul Eggert
2012-06-25 14:53 ` Stefan Monnier
2012-06-25 16:30   ` Dmitry Antipov
2012-06-25 16:35   ` martin rudalics
2012-06-25 16:49     ` Dmitry Antipov
2012-06-26  7:26       ` martin rudalics
2012-06-26  9:06         ` Dmitry Antipov
2012-06-26 15:37           ` Eli Zaretskii
2012-06-26 15:32         ` Eli Zaretskii
2012-06-26 16:49           ` Dmitry Antipov
2012-06-26 17:12             ` Eli Zaretskii
2012-06-27  0:42           ` Stefan Monnier
2012-06-27  3:03             ` Eli Zaretskii
2012-06-27  7:10               ` 'struct window' cleanup #3 Dmitry Antipov
2012-06-27 13:32                 ` Stefan Monnier
2012-06-27 17:37                   ` Eli Zaretskii
2012-06-27 17:24                 ` Eli Zaretskii
2012-06-27 17:59                   ` Dmitry Antipov [this message]
2012-06-27 19:36                     ` Eli Zaretskii
2012-07-01 15:05                       ` Dmitry Antipov
2012-07-01 15:42                         ` Andreas Schwab
2012-06-28 12:51                   ` Dmitry Antipov
2012-06-27  7:06           ` 'struct window' cleanup #2 martin rudalics
2012-06-27 16:59             ` Eli Zaretskii
2012-06-25 16:39 ` Eli Zaretskii

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=4FEB4A1E.5060203@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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).