emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110768: Window-related stuff cleanup


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110768: Window-related stuff cleanup here and there.
Date: Fri, 02 Nov 2012 14:34:26 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110768
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-11-02 14:34:26 +0400
message:
  Window-related stuff cleanup here and there.
  * dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p):
  Use decode_any_window.
  * fringe.c (Ffringe_bitmaps_at_pos): Likewise.
  * xdisp.c (Fformat_mode_line): Likewise.
  * font.c (Ffont_at): Use decode_live_window.
  * indent.c (Fcompute_motion, Fvertical_motion): Likewise.
  * window.c (decode_next_window_args): Likewise.
  (decode_any_window): Remove static.
  * window.h (decode_any_window): Add prototype.
  * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here...
  * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P,
  respectively.
modified:
  src/ChangeLog
  src/dispnew.c
  src/font.c
  src/fringe.c
  src/indent.c
  src/lisp.h
  src/window.c
  src/window.h
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-11-02 09:44:08 +0000
+++ b/src/ChangeLog     2012-11-02 10:34:26 +0000
@@ -1,5 +1,21 @@
 2012-11-02  Dmitry Antipov  <address@hidden>
 
+       Window-related stuff cleanup here and there.
+       * dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p):
+       Use decode_any_window.
+       * fringe.c (Ffringe_bitmaps_at_pos): Likewise.
+       * xdisp.c (Fformat_mode_line): Likewise.
+       * font.c (Ffont_at): Use decode_live_window.
+       * indent.c (Fcompute_motion, Fvertical_motion): Likewise.
+       * window.c (decode_next_window_args): Likewise.
+       (decode_any_window): Remove static.
+       * window.h (decode_any_window): Add prototype.
+       * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here...
+       * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P,
+       respectively.
+
+2012-11-02  Dmitry Antipov  <address@hidden>
+
        Remove pad from struct input_event.
        * termhooks.h (struct input_event): Remove padding field.
        Adjust comment.

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2012-10-31 17:27:29 +0000
+++ b/src/dispnew.c     2012-11-02 10:34:26 +0000
@@ -6375,15 +6375,7 @@
   /* Don't change cursor state while redisplaying.  This could confuse
      output routines.  */
   if (!redisplaying_p)
-    {
-      if (NILP (window))
-       window = selected_window;
-      else
-       CHECK_WINDOW (window);
-
-      XWINDOW (window)->cursor_off_p = NILP (show);
-    }
-
+    decode_any_window (window)->cursor_off_p = NILP (show);
   return Qnil;
 }
 
@@ -6394,15 +6386,7 @@
 WINDOW nil or omitted means report on the selected window.  */)
   (Lisp_Object window)
 {
-  struct window *w;
-
-  if (NILP (window))
-    window = selected_window;
-  else
-    CHECK_WINDOW (window);
-
-  w = XWINDOW (window);
-  return w->cursor_off_p ? Qnil : Qt;
+  return decode_any_window (window)->cursor_off_p ? Qnil : Qt;
 }
 
 DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,

=== modified file 'src/font.c'
--- a/src/font.c        2012-10-30 11:14:15 +0000
+++ b/src/font.c        2012-11-02 10:34:26 +0000
@@ -4765,13 +4765,9 @@
 character at index specified by POSITION.  */)
   (Lisp_Object position, Lisp_Object window, Lisp_Object string)
 {
-  struct window *w;
+  struct window *w = decode_live_window (window);
   ptrdiff_t pos;
 
-  if (NILP (window))
-    window = selected_window;
-  CHECK_LIVE_WINDOW (window);
-  w = XWINDOW (window);
   if (NILP (string))
     {
       if (XBUFFER (w->buffer) != current_buffer)

=== modified file 'src/fringe.c'
--- a/src/fringe.c      2012-09-23 08:44:20 +0000
+++ b/src/fringe.c      2012-11-02 10:34:26 +0000
@@ -1731,10 +1731,8 @@
   struct glyph_row *row;
   ptrdiff_t textpos;
 
-  if (NILP (window))
-    window = selected_window;
-  CHECK_WINDOW (window);
-  w = XWINDOW (window);
+  w = decode_any_window (window);
+  XSETWINDOW (window, w);
 
   if (!NILP (pos))
     {

=== modified file 'src/indent.c'
--- a/src/indent.c      2012-10-16 07:56:44 +0000
+++ b/src/indent.c      2012-11-02 10:34:26 +0000
@@ -1764,11 +1764,7 @@
   else
     hscroll = tab_offset = 0;
 
-  if (NILP (window))
-    window = Fselected_window ();
-  else
-    CHECK_LIVE_WINDOW (window);
-  w = XWINDOW (window);
+  w = decode_live_window (window);
 
   if (XINT (from) < BEGV || XINT (from) > ZV)
     args_out_of_range_3 (from, make_number (BEGV), make_number (ZV));
@@ -1790,8 +1786,7 @@
                               1))
                         : XINT (XCAR (topos))),
                        (NILP (width) ? -1 : XINT (width)),
-                       hscroll, tab_offset,
-                       XWINDOW (window));
+                       hscroll, tab_offset, w);
 
   XSETFASTINT (bufpos, pos->bufpos);
   XSETINT (hpos, pos->hpos);
@@ -1988,11 +1983,7 @@
     }
 
   CHECK_NUMBER (lines);
-  if (! NILP (window))
-    CHECK_WINDOW (window);
-  else
-    window = selected_window;
-  w = XWINDOW (window);
+  w = decode_live_window (window);
 
   old_buffer = Qnil;
   GCPRO3 (old_buffer, old_charpos, old_bytepos);

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-10-31 17:27:29 +0000
+++ b/src/lisp.h        2012-11-02 10:34:26 +0000
@@ -1791,20 +1791,6 @@
 #define CHECK_WINDOW_CONFIGURATION(x) \
   CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
 
-/* A window of any sort, leaf or interior, is "valid" if one of its
-   buffer, vchild, or hchild members is non-nil.  */
-#define CHECK_VALID_WINDOW(x)                          \
-  CHECK_TYPE (WINDOWP (x)                              \
-             && (!NILP (XWINDOW (x)->buffer)           \
-                 || !NILP (XWINDOW (x)->vchild)        \
-                 || !NILP (XWINDOW (x)->hchild)),      \
-             Qwindow_valid_p, x)
-
-/* A window is "live" if and only if it shows a buffer.  */
-#define CHECK_LIVE_WINDOW(x)                                           \
-  CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer),              \
-             Qwindow_live_p, x)
-
 #define CHECK_PROCESS(x) \
   CHECK_TYPE (PROCESSP (x), Qprocessp, x)
 

=== modified file 'src/window.c'
--- a/src/window.c      2012-10-18 08:27:49 +0000
+++ b/src/window.c      2012-11-02 10:34:26 +0000
@@ -244,7 +244,7 @@
   return XWINDOW (window);
 }
 
-static struct window *
+struct window *
 decode_any_window (register Lisp_Object window)
 {
   struct window *w;
@@ -2252,10 +2252,7 @@
 static void
 decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, 
Lisp_Object *all_frames)
 {
-  if (NILP (*window))
-    *window = selected_window;
-  else
-    CHECK_LIVE_WINDOW (*window);
+  struct window *w = decode_live_window (*window);
 
   /* MINIBUF nil may or may not include minibuffers.  Decide if it
      does.  */
@@ -2272,7 +2269,7 @@
   if (NILP (*all_frames))
     *all_frames
       = (!EQ (*minibuf, Qlambda)
-        ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame))
+        ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame))
         : Qnil);
   else if (EQ (*all_frames, Qvisible))
     ;

=== modified file 'src/window.h'
--- a/src/window.h      2012-09-20 03:10:52 +0000
+++ b/src/window.h      2012-11-02 10:34:26 +0000
@@ -970,17 +970,26 @@
        || !NILP (XWINDOW (WINDOW)->vchild)             \
        || !NILP (XWINDOW (WINDOW)->hchild)))
 
+/* A window of any sort, leaf or interior, is "valid" if one
+   of its buffer, vchild, or hchild members is non-nil.  */
+#define CHECK_VALID_WINDOW(WINDOW)                             \
+  CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW)
 
 /* Value is non-zero if WINDOW is a live window.  */
 #define WINDOW_LIVE_P(WINDOW)                                  \
   (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
 
+/* A window is "live" if and only if it shows a buffer.  */
+#define CHECK_LIVE_WINDOW(WINDOW)                              \
+  CHECK_TYPE (WINDOW_LIVE_P (WINDOW), Qwindow_live_p, WINDOW)
+
 /* These used to be in lisp.h.  */
 
 extern Lisp_Object Qwindowp, Qwindow_live_p;
 extern Lisp_Object Vwindow_list;
 
 extern struct window *decode_live_window (Lisp_Object);
+extern struct window *decode_any_window (Lisp_Object);
 extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
 extern void mark_window_cursors_off (struct window *);
 extern int window_internal_height (struct window *);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-10-20 21:30:51 +0000
+++ b/src/xdisp.c       2012-11-02 10:34:26 +0000
@@ -21018,10 +21018,8 @@
   Lisp_Object str;
   int string_start = 0;
 
-  if (NILP (window))
-    window = selected_window;
-  CHECK_WINDOW (window);
-  w = XWINDOW (window);
+  w = decode_any_window (window);
+  XSETWINDOW (window, w);
 
   if (NILP (buffer))
     buffer = w->buffer;
@@ -21050,7 +21048,7 @@
      and set that to nil so that we don't alter the outer value.  */
   record_unwind_protect (unwind_format_mode_line,
                         format_mode_line_unwind_data
-                          (XFRAME (WINDOW_FRAME (XWINDOW (window))),
+                          (XFRAME (WINDOW_FRAME (w)),
                            old_buffer, selected_window, 1));
   mode_line_proptrans_alist = Qnil;
 


reply via email to

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