aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog22
-rw-r--r--src/character.c67
-rw-r--r--src/floatfns.c2
-rw-r--r--src/process.c10
-rw-r--r--src/window.c36
5 files changed, 74 insertions, 63 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index aa4e92b4134..c8b1e654830 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12012-01-21 Chong Yidong <cyd@gnu.org>
2
3 * floatfns.c (Fcopysign): Make the second argument non-optional,
4 since nil is not allowed anyway.
5
62012-01-21 Andreas Schwab <schwab@linux-m68k.org>
7
8 * process.c (read_process_output): Use p instead of XPROCESS (proc).
9 (send_process): Likewise.
10
112012-01-19 Martin Rudalics <rudalics@gmx.at>
12
13 * window.c (save_window_save, Fcurrent_window_configuration)
14 (Vwindow_persistent_parameters): Do not use Qstate. Rewrite
15 doc-strings.
16
172012-01-19 Kenichi Handa <handa@m17n.org>
18
19 * character.c (char_width): New function.
20 (Fchar_width, c_string_width, lisp_string_width):
21 Use char_width (Bug#9496).
22
12012-01-16 Martin Rudalics <rudalics@gmx.at> 232012-01-16 Martin Rudalics <rudalics@gmx.at>
2 24
3 * window.c (Vwindow_persistent_parameters): New variable. 25 * window.c (Vwindow_persistent_parameters): New variable.
diff --git a/src/character.c b/src/character.c
index a2cb416d770..593fbcece0b 100644
--- a/src/character.c
+++ b/src/character.c
@@ -308,6 +308,31 @@ If the multibyte character does not represent a byte, return -1. */)
308 } 308 }
309} 309}
310 310
311
312/* Return width (columns) of C considering the buffer display table DP. */
313
314static int
315char_width (int c, struct Lisp_Char_Table *dp)
316{
317 int width = CHAR_WIDTH (c);
318
319 if (dp)
320 {
321 Lisp_Object disp = DISP_CHAR_VECTOR (dp, c), ch;
322 int i;
323
324 if (VECTORP (disp))
325 for (i = 0, width = 0; i < ASIZE (disp); i++)
326 {
327 ch = AREF (disp, i);
328 if (CHARACTERP (ch))
329 width += CHAR_WIDTH (XFASTINT (ch));
330 }
331 }
332 return width;
333}
334
335
311DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, 336DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0,
312 doc: /* Return width of CHAR when displayed in the current buffer. 337 doc: /* Return width of CHAR when displayed in the current buffer.
313The width is measured by how many columns it occupies on the screen. 338The width is measured by how many columns it occupies on the screen.
@@ -315,21 +340,11 @@ Tab is taken to occupy `tab-width' columns.
315usage: (char-width CHAR) */) 340usage: (char-width CHAR) */)
316 (Lisp_Object ch) 341 (Lisp_Object ch)
317{ 342{
318 Lisp_Object disp;
319 int c, width; 343 int c, width;
320 struct Lisp_Char_Table *dp = buffer_display_table ();
321 344
322 CHECK_CHARACTER (ch); 345 CHECK_CHARACTER (ch);
323 c = XINT (ch); 346 c = XINT (ch);
324 347 width = char_width (c, buffer_display_table ());
325 /* Get the way the display table would display it. */
326 disp = dp ? DISP_CHAR_VECTOR (dp, c) : Qnil;
327
328 if (VECTORP (disp))
329 width = sanitize_char_width (ASIZE (disp));
330 else
331 width = CHAR_WIDTH (c);
332
333 return make_number (width); 348 return make_number (width);
334} 349}
335 350
@@ -350,22 +365,9 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision,
350 365
351 while (i_byte < len) 366 while (i_byte < len)
352 { 367 {
353 int bytes, thiswidth; 368 int bytes;
354 Lisp_Object val;
355 int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes); 369 int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
356 370 int thiswidth = char_width (c, dp);
357 if (dp)
358 {
359 val = DISP_CHAR_VECTOR (dp, c);
360 if (VECTORP (val))
361 thiswidth = sanitize_char_width (ASIZE (val));
362 else
363 thiswidth = CHAR_WIDTH (c);
364 }
365 else
366 {
367 thiswidth = CHAR_WIDTH (c);
368 }
369 371
370 if (precision > 0 372 if (precision > 0
371 && (width + thiswidth > precision)) 373 && (width + thiswidth > precision))
@@ -447,18 +449,7 @@ lisp_string_width (Lisp_Object string, EMACS_INT precision,
447 else 449 else
448 c = str[i_byte], bytes = 1; 450 c = str[i_byte], bytes = 1;
449 chars = 1; 451 chars = 1;
450 if (dp) 452 thiswidth = char_width (c, dp);
451 {
452 val = DISP_CHAR_VECTOR (dp, c);
453 if (VECTORP (val))
454 thiswidth = sanitize_char_width (ASIZE (val));
455 else
456 thiswidth = CHAR_WIDTH (c);
457 }
458 else
459 {
460 thiswidth = CHAR_WIDTH (c);
461 }
462 } 453 }
463 454
464 if (precision <= 0) 455 if (precision <= 0)
diff --git a/src/floatfns.c b/src/floatfns.c
index c44784f2120..305c78cae63 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -294,7 +294,7 @@ DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
294} 294}
295 295
296#ifdef HAVE_COPYSIGN 296#ifdef HAVE_COPYSIGN
297DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0, 297DEFUN ("copysign", Fcopysign, Scopysign, 2, 2, 0,
298 doc: /* Copy sign of X2 to value of X1, and return the result. 298 doc: /* Copy sign of X2 to value of X1, and return the result.
299Cause an error if X1 or X2 is not a float. */) 299Cause an error if X1 or X2 is not a float. */)
300 (Lisp_Object x1, Lisp_Object x2) 300 (Lisp_Object x1, Lisp_Object x2)
diff --git a/src/process.c b/src/process.c
index 3dc753f5159..bdf16b7dbd2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5060,9 +5060,8 @@ read_process_output (Lisp_Object proc, register int channel)
5060 proc_buffered_char[channel] = -1; 5060 proc_buffered_char[channel] = -1;
5061 } 5061 }
5062#ifdef HAVE_GNUTLS 5062#ifdef HAVE_GNUTLS
5063 if (XPROCESS (proc)->gnutls_p) 5063 if (p->gnutls_p)
5064 nbytes = emacs_gnutls_read (XPROCESS (proc), 5064 nbytes = emacs_gnutls_read (p, chars + carryover + buffered,
5065 chars + carryover + buffered,
5066 readmax - buffered); 5065 readmax - buffered);
5067 else 5066 else
5068#endif 5067#endif
@@ -5527,9 +5526,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5527#endif 5526#endif
5528 { 5527 {
5529#ifdef HAVE_GNUTLS 5528#ifdef HAVE_GNUTLS
5530 if (XPROCESS (proc)->gnutls_p) 5529 if (p->gnutls_p)
5531 written = emacs_gnutls_write (XPROCESS (proc), 5530 written = emacs_gnutls_write (p, buf, this);
5532 buf, this);
5533 else 5531 else
5534#endif 5532#endif
5535 written = emacs_write (outfd, buf, this); 5533 written = emacs_write (outfd, buf, this);
diff --git a/src/window.c b/src/window.c
index 3ee731e60bf..a3b58d648a1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -59,7 +59,7 @@ static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
59static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 59static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
60static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 60static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
61static Lisp_Object Qsafe, Qabove, Qbelow; 61static Lisp_Object Qsafe, Qabove, Qbelow;
62static Lisp_Object Qauto_buffer_name, Qclone_of, Qstate; 62static Lisp_Object Qauto_buffer_name, Qclone_of;
63 63
64static int displayed_window_lines (struct window *); 64static int displayed_window_lines (struct window *);
65static struct window *decode_window (Lisp_Object); 65static struct window *decode_window (Lisp_Object);
@@ -5894,9 +5894,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5894 tem = XCDR (tem)) 5894 tem = XCDR (tem))
5895 { 5895 {
5896 pers = XCAR (tem); 5896 pers = XCAR (tem);
5897 /* Save values for persistent window parameters whose cdr 5897 /* Save values for persistent window parameters. */
5898 is either nil or t. */ 5898 if (CONSP (pers) && !NILP (XCDR (pers)))
5899 if (CONSP (pers) && (NILP (XCDR (pers)) || EQ (XCDR (pers), Qt)))
5900 { 5899 {
5901 par = Fassq (XCAR (pers), w->window_parameters); 5900 par = Fassq (XCAR (pers), w->window_parameters);
5902 if (NILP (par)) 5901 if (NILP (par))
@@ -5971,7 +5970,9 @@ and for each displayed buffer, where display starts, and the positions of
5971point and mark. An exception is made for point in the current buffer: 5970point and mark. An exception is made for point in the current buffer:
5972its value is -not- saved. 5971its value is -not- saved.
5973This also records the currently selected frame, and FRAME's focus 5972This also records the currently selected frame, and FRAME's focus
5974redirection (see `redirect-frame-focus'). */) 5973redirection (see `redirect-frame-focus'). The variable
5974`window-persistent-parameters' specifies which window parameters are
5975saved by this function. */)
5975 (Lisp_Object frame) 5976 (Lisp_Object frame)
5976{ 5977{
5977 register Lisp_Object tem; 5978 register Lisp_Object tem;
@@ -6509,7 +6510,6 @@ syms_of_window (void)
6509 DEFSYM (Qbelow, "below"); 6510 DEFSYM (Qbelow, "below");
6510 DEFSYM (Qauto_buffer_name, "auto-buffer-name"); 6511 DEFSYM (Qauto_buffer_name, "auto-buffer-name");
6511 DEFSYM (Qclone_of, "clone-of"); 6512 DEFSYM (Qclone_of, "clone-of");
6512 DEFSYM (Qstate, "state");
6513 6513
6514 staticpro (&Vwindow_list); 6514 staticpro (&Vwindow_list);
6515 6515
@@ -6621,28 +6621,28 @@ function `set-window-combination-limit'. */);
6621 6621
6622 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, 6622 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters,
6623 doc: /* Alist of persistent window parameters. 6623 doc: /* Alist of persistent window parameters.
6624Parameters in this list are saved by `current-window-configuration' and 6624This alist specifies which window parameters shall get saved by
6625`window-state-get' and subsequently restored to their previous values by 6625`current-window-configuration' and `window-state-get' and subsequently
6626`set-window-configuration' and `window-state-put'. 6626restored to their previous values by `set-window-configuration' and
6627`window-state-put'.
6627 6628
6628The car of each entry of this alist is the symbol specifying the 6629The car of each entry of this alist is the symbol specifying the
6629parameter. The cdr is one of the following: 6630parameter. The cdr is one of the following:
6630 6631
6631The symbol `state' means the parameter is saved by `window-state-get' 6632nil means the parameter is neither saved by `window-state-get' nor by
6632provided its IGNORE argument is nil. `current-window-configuration' 6633`current-window-configuration'.
6633does not save this parameter.
6634 6634
6635nil means the parameter is saved by `current-window-configuration' and, 6635t means the parameter is saved by `current-window-configuration' and,
6636provided its IGNORE argument is nil, by `window-state-get'. 6636provided its WRITABLE argument is nil, by `window-state-get'.
6637 6637
6638t means the parameter is saved unconditionally by both 6638The symbol `writable' means the parameter is saved unconditionally by
6639`current-window-configuration' and `window-state-get'. Parameters 6639both `current-window-configuration' and `window-state-get'. Do not use
6640without read syntax (like windows or frames) should not use that. 6640this value for parameters without read syntax (like windows or frames).
6641 6641
6642Parameters not saved by `current-window-configuration' or 6642Parameters not saved by `current-window-configuration' or
6643`window-state-get' are left alone by `set-window-configuration' 6643`window-state-get' are left alone by `set-window-configuration'
6644respectively are not installed by `window-state-put'. */); 6644respectively are not installed by `window-state-put'. */);
6645 Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qstate)); 6645 Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qt));
6646 6646
6647 defsubr (&Sselected_window); 6647 defsubr (&Sselected_window);
6648 defsubr (&Sminibuffer_window); 6648 defsubr (&Sminibuffer_window);