diff options
| author | Joakim Verona <joakim@verona.se> | 2012-01-23 15:10:06 +0100 |
|---|---|---|
| committer | Joakim Verona <joakim@verona.se> | 2012-01-23 15:10:06 +0100 |
| commit | 0322b140eead7c94de7f0f6d19a90bd15690b4eb (patch) | |
| tree | 950c011783cc896d0450084cb5155e54548bfe5b /src | |
| parent | d5114bfea3ea4c37c57e2af0f3b095be9fcd8bac (diff) | |
| parent | cb5850f27c1b4d26957d58e2da2314dd12498671 (diff) | |
upstream
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 22 | ||||
| -rw-r--r-- | src/character.c | 67 | ||||
| -rw-r--r-- | src/floatfns.c | 2 | ||||
| -rw-r--r-- | src/process.c | 10 | ||||
| -rw-r--r-- | src/window.c | 36 |
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 @@ +2012-01-21 Chong Yidong <cyd@gnu.org> + + * floatfns.c (Fcopysign): Make the second argument non-optional, + since nil is not allowed anyway. + +2012-01-21 Andreas Schwab <schwab@linux-m68k.org> + + * process.c (read_process_output): Use p instead of XPROCESS (proc). + (send_process): Likewise. + +2012-01-19 Martin Rudalics <rudalics@gmx.at> + + * window.c (save_window_save, Fcurrent_window_configuration) + (Vwindow_persistent_parameters): Do not use Qstate. Rewrite + doc-strings. + +2012-01-19 Kenichi Handa <handa@m17n.org> + + * character.c (char_width): New function. + (Fchar_width, c_string_width, lisp_string_width): + Use char_width (Bug#9496). + 2012-01-16 Martin Rudalics <rudalics@gmx.at> * 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. */) } } + +/* Return width (columns) of C considering the buffer display table DP. */ + +static int +char_width (int c, struct Lisp_Char_Table *dp) +{ + int width = CHAR_WIDTH (c); + + if (dp) + { + Lisp_Object disp = DISP_CHAR_VECTOR (dp, c), ch; + int i; + + if (VECTORP (disp)) + for (i = 0, width = 0; i < ASIZE (disp); i++) + { + ch = AREF (disp, i); + if (CHARACTERP (ch)) + width += CHAR_WIDTH (XFASTINT (ch)); + } + } + return width; +} + + DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, doc: /* Return width of CHAR when displayed in the current buffer. The width is measured by how many columns it occupies on the screen. @@ -315,21 +340,11 @@ Tab is taken to occupy `tab-width' columns. usage: (char-width CHAR) */) (Lisp_Object ch) { - Lisp_Object disp; int c, width; - struct Lisp_Char_Table *dp = buffer_display_table (); CHECK_CHARACTER (ch); c = XINT (ch); - - /* Get the way the display table would display it. */ - disp = dp ? DISP_CHAR_VECTOR (dp, c) : Qnil; - - if (VECTORP (disp)) - width = sanitize_char_width (ASIZE (disp)); - else - width = CHAR_WIDTH (c); - + width = char_width (c, buffer_display_table ()); return make_number (width); } @@ -350,22 +365,9 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision, while (i_byte < len) { - int bytes, thiswidth; - Lisp_Object val; + int bytes; int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes); - - if (dp) - { - val = DISP_CHAR_VECTOR (dp, c); - if (VECTORP (val)) - thiswidth = sanitize_char_width (ASIZE (val)); - else - thiswidth = CHAR_WIDTH (c); - } - else - { - thiswidth = CHAR_WIDTH (c); - } + int thiswidth = char_width (c, dp); if (precision > 0 && (width + thiswidth > precision)) @@ -447,18 +449,7 @@ lisp_string_width (Lisp_Object string, EMACS_INT precision, else c = str[i_byte], bytes = 1; chars = 1; - if (dp) - { - val = DISP_CHAR_VECTOR (dp, c); - if (VECTORP (val)) - thiswidth = sanitize_char_width (ASIZE (val)); - else - thiswidth = CHAR_WIDTH (c); - } - else - { - thiswidth = CHAR_WIDTH (c); - } + thiswidth = char_width (c, dp); } 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, } #ifdef HAVE_COPYSIGN -DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0, +DEFUN ("copysign", Fcopysign, Scopysign, 2, 2, 0, doc: /* Copy sign of X2 to value of X1, and return the result. Cause an error if X1 or X2 is not a float. */) (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) proc_buffered_char[channel] = -1; } #ifdef HAVE_GNUTLS - if (XPROCESS (proc)->gnutls_p) - nbytes = emacs_gnutls_read (XPROCESS (proc), - chars + carryover + buffered, + if (p->gnutls_p) + nbytes = emacs_gnutls_read (p, chars + carryover + buffered, readmax - buffered); else #endif @@ -5527,9 +5526,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, #endif { #ifdef HAVE_GNUTLS - if (XPROCESS (proc)->gnutls_p) - written = emacs_gnutls_write (XPROCESS (proc), - buf, this); + if (p->gnutls_p) + written = emacs_gnutls_write (p, buf, this); else #endif 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; static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; static Lisp_Object Qsafe, Qabove, Qbelow; -static Lisp_Object Qauto_buffer_name, Qclone_of, Qstate; +static Lisp_Object Qauto_buffer_name, Qclone_of; static int displayed_window_lines (struct window *); static struct window *decode_window (Lisp_Object); @@ -5894,9 +5894,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) tem = XCDR (tem)) { pers = XCAR (tem); - /* Save values for persistent window parameters whose cdr - is either nil or t. */ - if (CONSP (pers) && (NILP (XCDR (pers)) || EQ (XCDR (pers), Qt))) + /* Save values for persistent window parameters. */ + if (CONSP (pers) && !NILP (XCDR (pers))) { par = Fassq (XCAR (pers), w->window_parameters); if (NILP (par)) @@ -5971,7 +5970,9 @@ and for each displayed buffer, where display starts, and the positions of point and mark. An exception is made for point in the current buffer: its value is -not- saved. This also records the currently selected frame, and FRAME's focus -redirection (see `redirect-frame-focus'). */) +redirection (see `redirect-frame-focus'). The variable +`window-persistent-parameters' specifies which window parameters are +saved by this function. */) (Lisp_Object frame) { register Lisp_Object tem; @@ -6509,7 +6510,6 @@ syms_of_window (void) DEFSYM (Qbelow, "below"); DEFSYM (Qauto_buffer_name, "auto-buffer-name"); DEFSYM (Qclone_of, "clone-of"); - DEFSYM (Qstate, "state"); staticpro (&Vwindow_list); @@ -6621,28 +6621,28 @@ function `set-window-combination-limit'. */); DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, doc: /* Alist of persistent window parameters. -Parameters in this list are saved by `current-window-configuration' and -`window-state-get' and subsequently restored to their previous values by -`set-window-configuration' and `window-state-put'. +This alist specifies which window parameters shall get saved by +`current-window-configuration' and `window-state-get' and subsequently +restored to their previous values by `set-window-configuration' and +`window-state-put'. The car of each entry of this alist is the symbol specifying the parameter. The cdr is one of the following: -The symbol `state' means the parameter is saved by `window-state-get' -provided its IGNORE argument is nil. `current-window-configuration' -does not save this parameter. +nil means the parameter is neither saved by `window-state-get' nor by +`current-window-configuration'. -nil means the parameter is saved by `current-window-configuration' and, -provided its IGNORE argument is nil, by `window-state-get'. +t means the parameter is saved by `current-window-configuration' and, +provided its WRITABLE argument is nil, by `window-state-get'. -t means the parameter is saved unconditionally by both -`current-window-configuration' and `window-state-get'. Parameters -without read syntax (like windows or frames) should not use that. +The symbol `writable' means the parameter is saved unconditionally by +both `current-window-configuration' and `window-state-get'. Do not use +this value for parameters without read syntax (like windows or frames). Parameters not saved by `current-window-configuration' or `window-state-get' are left alone by `set-window-configuration' respectively are not installed by `window-state-put'. */); - Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qstate)); + Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qt)); defsubr (&Sselected_window); defsubr (&Sminibuffer_window); |
