aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJoakim Verona2013-08-13 17:01:31 +0200
committerJoakim Verona2013-08-13 17:01:31 +0200
commit2da59f810184f36b4061eb422011de057bd0588e (patch)
treeb07deba1f2ce02fb4374fe972cf496a674502c00 /src/window.c
parent88790a579512914b5608d9756cae9bb982ce7c41 (diff)
parenteeaf9bf3377b6d4b9083159726da8bb67b36cb56 (diff)
downloademacs-2da59f810184f36b4061eb422011de057bd0588e.tar.gz
emacs-2da59f810184f36b4061eb422011de057bd0588e.zip
merge from trunk
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c79
1 files changed, 30 insertions, 49 deletions
diff --git a/src/window.c b/src/window.c
index 1328adcacd0..9d4bb4d4e11 100644
--- a/src/window.c
+++ b/src/window.c
@@ -154,11 +154,6 @@ wset_display_table (struct window *w, Lisp_Object val)
154 w->display_table = val; 154 w->display_table = val;
155} 155}
156static void 156static void
157wset_left_margin_cols (struct window *w, Lisp_Object val)
158{
159 w->left_margin_cols = val;
160}
161static void
162wset_new_normal (struct window *w, Lisp_Object val) 157wset_new_normal (struct window *w, Lisp_Object val)
163{ 158{
164 w->new_normal = val; 159 w->new_normal = val;
@@ -189,11 +184,6 @@ wset_pointm (struct window *w, Lisp_Object val)
189 w->pointm = val; 184 w->pointm = val;
190} 185}
191static void 186static void
192wset_right_margin_cols (struct window *w, Lisp_Object val)
193{
194 w->right_margin_cols = val;
195}
196static void
197wset_scroll_bar_width (struct window *w, Lisp_Object val) 187wset_scroll_bar_width (struct window *w, Lisp_Object val)
198{ 188{
199 w->scroll_bar_width = val; 189 w->scroll_bar_width = val;
@@ -3061,15 +3051,12 @@ adjust_window_margins (struct window *w)
3061 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) 3051 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0)
3062 { 3052 {
3063 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 3053 if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
3064 { 3054 w->left_margin_cols = w->right_margin_cols = margin_cols / 2;
3065 wset_left_margin_cols (w, make_number (margin_cols / 2));
3066 wset_right_margin_cols (w, make_number (margin_cols / 2));
3067 }
3068 else 3055 else
3069 wset_right_margin_cols (w, make_number (margin_cols)); 3056 w->right_margin_cols = margin_cols;
3070 } 3057 }
3071 else 3058 else
3072 wset_left_margin_cols (w, make_number (margin_cols)); 3059 w->left_margin_cols = margin_cols;
3073 return 1; 3060 return 1;
3074} 3061}
3075 3062
@@ -3226,11 +3213,11 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3226 3213
3227 /* This may call adjust_window_margins three times, so 3214 /* This may call adjust_window_margins three times, so
3228 temporarily disable window margins. */ 3215 temporarily disable window margins. */
3229 Lisp_Object save_left = w->left_margin_cols; 3216 int save_left = w->left_margin_cols;
3230 Lisp_Object save_right = w->right_margin_cols; 3217 int save_right = w->right_margin_cols;
3231 3218
3232 wset_left_margin_cols (w, Qnil); 3219 w->left_margin_cols = 0;
3233 wset_right_margin_cols (w, Qnil); 3220 w->right_margin_cols = 0;
3234 3221
3235 Fset_window_fringes (window, 3222 Fset_window_fringes (window,
3236 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), 3223 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3240,8 +3227,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3240 BVAR (b, scroll_bar_width), 3227 BVAR (b, scroll_bar_width),
3241 BVAR (b, vertical_scroll_bar_type), Qnil); 3228 BVAR (b, vertical_scroll_bar_type), Qnil);
3242 3229
3243 wset_left_margin_cols (w, save_left); 3230 w->left_margin_cols = save_left;
3244 wset_right_margin_cols (w, save_right); 3231 w->right_margin_cols = save_right;
3245 3232
3246 Fset_window_margins (window, 3233 Fset_window_margins (window,
3247 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); 3234 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3942,8 +3929,8 @@ set correctly. See the code of `split-window' for how this is done. */)
3942 memset (&n->last_cursor, 0, sizeof n->last_cursor); 3929 memset (&n->last_cursor, 0, sizeof n->last_cursor);
3943 3930
3944 /* Get special geometry settings from reference window. */ 3931 /* Get special geometry settings from reference window. */
3945 wset_left_margin_cols (n, r->left_margin_cols); 3932 n->left_margin_cols = r->left_margin_cols;
3946 wset_right_margin_cols (n, r->right_margin_cols); 3933 n->right_margin_cols = r->right_margin_cols;
3947 n->left_fringe_width = r->left_fringe_width; 3934 n->left_fringe_width = r->left_fringe_width;
3948 n->right_fringe_width = r->right_fringe_width; 3935 n->right_fringe_width = r->right_fringe_width;
3949 n->fringes_outside_margins = r->fringes_outside_margins; 3936 n->fringes_outside_margins = r->fringes_outside_margins;
@@ -5688,8 +5675,8 @@ the return value is nil. Otherwise the value is t. */)
5688 w->hscroll = XFASTINT (p->hscroll); 5675 w->hscroll = XFASTINT (p->hscroll);
5689 w->min_hscroll = XFASTINT (p->min_hscroll); 5676 w->min_hscroll = XFASTINT (p->min_hscroll);
5690 wset_display_table (w, p->display_table); 5677 wset_display_table (w, p->display_table);
5691 wset_left_margin_cols (w, p->left_margin_cols); 5678 w->left_margin_cols = XINT (p->left_margin_cols);
5692 wset_right_margin_cols (w, p->right_margin_cols); 5679 w->right_margin_cols = XINT (p->right_margin_cols);
5693 w->left_fringe_width = XINT (p->left_fringe_width); 5680 w->left_fringe_width = XINT (p->left_fringe_width);
5694 w->right_fringe_width = XINT (p->right_fringe_width); 5681 w->right_fringe_width = XINT (p->right_fringe_width);
5695 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5682 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
@@ -5989,8 +5976,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5989 XSETFASTINT (p->hscroll, w->hscroll); 5976 XSETFASTINT (p->hscroll, w->hscroll);
5990 XSETFASTINT (p->min_hscroll, w->min_hscroll); 5977 XSETFASTINT (p->min_hscroll, w->min_hscroll);
5991 p->display_table = w->display_table; 5978 p->display_table = w->display_table;
5992 p->left_margin_cols = w->left_margin_cols; 5979 p->left_margin_cols = make_number (w->left_margin_cols);
5993 p->right_margin_cols = w->right_margin_cols; 5980 p->right_margin_cols = make_number (w->right_margin_cols);
5994 p->left_fringe_width = make_number (w->left_fringe_width); 5981 p->left_fringe_width = make_number (w->left_fringe_width);
5995 p->right_fringe_width = make_number (w->right_fringe_width); 5982 p->right_fringe_width = make_number (w->right_fringe_width);
5996 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; 5983 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
@@ -6148,38 +6135,31 @@ WINDOW must be a live window and defaults to the selected one.
6148Second arg LEFT-WIDTH specifies the number of character cells to 6135Second arg LEFT-WIDTH specifies the number of character cells to
6149reserve for the left marginal area. Optional third arg RIGHT-WIDTH 6136reserve for the left marginal area. Optional third arg RIGHT-WIDTH
6150does the same for the right marginal area. A nil width parameter 6137does the same for the right marginal area. A nil width parameter
6151means no margin. */) 6138means no margin.
6139
6140Return t if any margin was actually changed and nil otherwise. */)
6152 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) 6141 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width)
6153{ 6142{
6154 struct window *w = decode_live_window (window); 6143 struct window *w = decode_live_window (window);
6144 int left, right;
6155 6145
6156 /* Translate negative or zero widths to nil. 6146 /* FIXME: what about margins that are too wide? */
6157 Margins that are too wide have to be checked elsewhere. */
6158 6147
6159 if (!NILP (left_width)) 6148 left = (NILP (left_width) ? 0
6160 { 6149 : (CHECK_NATNUM (left_width), XINT (left_width)));
6161 CHECK_NUMBER (left_width); 6150 right = (NILP (right_width) ? 0
6162 if (XINT (left_width) <= 0) 6151 : (CHECK_NATNUM (right_width), XINT (right_width)));
6163 left_width = Qnil;
6164 }
6165
6166 if (!NILP (right_width))
6167 {
6168 CHECK_NUMBER (right_width);
6169 if (XINT (right_width) <= 0)
6170 right_width = Qnil;
6171 }
6172 6152
6173 if (!EQ (w->left_margin_cols, left_width) 6153 if (w->left_margin_cols != left || w->right_margin_cols != right)
6174 || !EQ (w->right_margin_cols, right_width))
6175 { 6154 {
6176 wset_left_margin_cols (w, left_width); 6155 w->left_margin_cols = left;
6177 wset_right_margin_cols (w, right_width); 6156 w->right_margin_cols = right;
6178 6157
6179 adjust_window_margins (w); 6158 adjust_window_margins (w);
6180 6159
6181 ++windows_or_buffers_changed; 6160 ++windows_or_buffers_changed;
6182 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6161 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
6162 return Qt;
6183 } 6163 }
6184 6164
6185 return Qnil; 6165 return Qnil;
@@ -6197,7 +6177,8 @@ as nil. */)
6197 (Lisp_Object window) 6177 (Lisp_Object window)
6198{ 6178{
6199 struct window *w = decode_live_window (window); 6179 struct window *w = decode_live_window (window);
6200 return Fcons (w->left_margin_cols, w->right_margin_cols); 6180 return Fcons (make_number (w->left_margin_cols),
6181 make_number (w->right_margin_cols));
6201} 6182}
6202 6183
6203 6184