Now on revision 109652. ------------------------------------------------------------ revno: 109652 committer: martin rudalics branch nick: trunk timestamp: Fri 2012-08-17 08:01:17 +0200 message: Fix latest fix of delete-window. * window.el (delete-window): Fix last fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-16 17:22:36 +0000 +++ lisp/ChangeLog 2012-08-17 06:01:17 +0000 @@ -1,3 +1,7 @@ +2012-08-17 Martin Rudalics + + * window.el (delete-window): Fix last fix. + 2012-08-16 Martin Rudalics * window.el (window-valid-p): Move to window.c. === modified file 'lisp/window.el' --- lisp/window.el 2012-08-16 17:22:36 +0000 +++ lisp/window.el 2012-08-17 06:01:17 +0000 @@ -2459,9 +2459,7 @@ (not (eq (window-parameter parent 'window-side) 'none)))) (error "Attempt to delete last non-side window")) ((not parent) - (error "Attempt to delete minibuffer or sole ordinary window")) - ((eq window (window--major-non-side-window frame)) - (error "Attempt to delete last non-side window"))) + (error "Attempt to delete minibuffer or sole ordinary window"))) (let* ((horizontal (window-left-child parent)) (size (window-total-size window horizontal)) ------------------------------------------------------------ revno: 109651 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2012-08-17 09:35:39 +0400 message: Do not use memcpy for copying intervals. * intervals.c (reproduce_interval): New function. (reproduce_tree, reproduce_tree_obj): Use it. (reproduce_tree_obj): Remove prototype. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 05:14:06 +0000 +++ src/ChangeLog 2012-08-17 05:35:39 +0000 @@ -1,3 +1,10 @@ +2012-08-17 Dmitry Antipov + + Do not use memcpy for copying intervals. + * intervals.c (reproduce_interval): New function. + (reproduce_tree, reproduce_tree_obj): Use it. + (reproduce_tree_obj): Remove prototype. + 2012-08-17 Paul Eggert * lisp.h (duration_to_sec_usec): Remove unused decl. === modified file 'src/intervals.c' --- src/intervals.c 2012-08-14 08:30:52 +0000 +++ src/intervals.c 2012-08-17 05:35:39 +0000 @@ -59,7 +59,6 @@ static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object); static INTERVAL merge_interval_right (INTERVAL); static INTERVAL reproduce_tree (INTERVAL, INTERVAL); -static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object); /* Utility functions for intervals. */ @@ -1498,6 +1497,26 @@ abort (); } +/* Create a copy of SOURCE but with the default value of UP. */ + +static INTERVAL +reproduce_interval (INTERVAL source) +{ + register INTERVAL target = make_interval (); + + target->total_length = source->total_length; + target->position = source->position; + + copy_properties (source, target); + + if (! NULL_LEFT_CHILD (source)) + interval_set_left (target, reproduce_tree (source->left, target)); + if (! NULL_RIGHT_CHILD (source)) + interval_set_right (target, reproduce_tree (source->right, target)); + + return target; +} + /* Make an exact copy of interval tree SOURCE which descends from PARENT. This is done by recursing through SOURCE, copying the current interval and its properties, and then adjusting @@ -1506,33 +1525,19 @@ static INTERVAL reproduce_tree (INTERVAL source, INTERVAL parent) { - register INTERVAL t = make_interval (); - - memcpy (t, source, sizeof *t); - copy_properties (source, t); - interval_set_parent (t, parent); - if (! NULL_LEFT_CHILD (source)) - interval_set_left (t, reproduce_tree (source->left, t)); - if (! NULL_RIGHT_CHILD (source)) - interval_set_right (t, reproduce_tree (source->right, t)); - - return t; + register INTERVAL target = reproduce_interval (source); + + interval_set_parent (target, parent); + return target; } static INTERVAL reproduce_tree_obj (INTERVAL source, Lisp_Object parent) { - register INTERVAL t = make_interval (); - - memcpy (t, source, sizeof *t); - copy_properties (source, t); - interval_set_object (t, parent); - if (! NULL_LEFT_CHILD (source)) - interval_set_left (t, reproduce_tree (source->left, t)); - if (! NULL_RIGHT_CHILD (source)) - interval_set_right (t, reproduce_tree (source->right, t)); - - return t; + register INTERVAL target = reproduce_interval (source); + + interval_set_object (target, parent); + return target; } /* Insert the intervals of SOURCE into BUFFER at POSITION. ------------------------------------------------------------ revno: 109650 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-08-16 22:14:06 -0700 message: * lisp.h (duration_to_sec_usec): Remove unused decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 04:12:50 +0000 +++ src/ChangeLog 2012-08-17 05:14:06 +0000 @@ -1,3 +1,7 @@ +2012-08-17 Paul Eggert + + * lisp.h (duration_to_sec_usec): Remove unused decl. + 2012-08-17 Alp Aker * nsfont.m (ns_ascii_average_width): Send initWithFormat selector @@ -3451,6 +3455,7 @@ has at least microseconds now. All uses removed. (update_frame, update_single_window, update_window, update_frame_1) (Fsleep_for, sit_for): Port to higher-resolution time stamps. + (duration_to_sec_usec): Remove; no longer needed. * editfns.c (time_overflow): Now extern. (Fcurrent_time, Fget_internal_run_time, make_time, lisp_time_argument) === modified file 'src/lisp.h' --- src/lisp.h 2012-08-16 07:58:24 +0000 +++ src/lisp.h 2012-08-17 05:14:06 +0000 @@ -2682,7 +2682,6 @@ #endif extern Lisp_Object selected_frame; extern Lisp_Object Vwindow_system; -void duration_to_sec_usec (double, int *, int *); extern Lisp_Object sit_for (Lisp_Object, int, int); extern void init_display (void); extern void syms_of_display (void); ------------------------------------------------------------ revno: 109649 committer: Alp Aker branch nick: trunk timestamp: Fri 2012-08-17 00:12:50 -0400 message: * nsfont.m (ns_ascii_average_width): Send initWithFormat selector to an allocated instance of NSString, not to the class itself. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-17 01:53:29 +0000 +++ src/ChangeLog 2012-08-17 04:12:50 +0000 @@ -1,3 +1,8 @@ +2012-08-17 Alp Aker + + * nsfont.m (ns_ascii_average_width): Send initWithFormat selector + to an allocated instance of NSString, not to the class itself. + 2012-08-17 Juanma Barranquero * makefile.w32-in (C_CTYPE_H): New macro. === modified file 'src/nsfont.m' --- src/nsfont.m 2012-08-16 06:40:57 +0000 +++ src/nsfont.m 2012-08-17 04:12:50 +0000 @@ -275,7 +275,7 @@ for (ch = 0; ch < 95; ch++) chars[ch] = ' ' + ch; - ascii_printable = [NSString initWithFormat: @"%s", chars]; + ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; } #ifdef NS_IMPL_COCOA ------------------------------------------------------------ revno: 109648 committer: Juanma Barranquero branch nick: trunk timestamp: Fri 2012-08-17 03:53:29 +0200 message: * lib-src/makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies. * src/makefile.w32-in (C_CTYPE_H): New macro. (LISP_H, $(BLD)/ccl.$(O), $(BLD)/doc.$(O), $(BLD)/w32console.$(O)): ($(BLD)/fontset.$(O), $(BLD)/frame.$(O), $(BLD)/composite.$(O)): ($(BLD)/sysdep.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-08-15 08:57:14 +0000 +++ lib-src/ChangeLog 2012-08-17 01:53:29 +0000 @@ -1,3 +1,7 @@ +2012-08-17 Juanma Barranquero + + * makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies. + 2012-08-15 Paul Eggert * etags.c (Pascal_functions): Fix parenthesization typo. === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2012-08-03 12:16:40 +0000 +++ lib-src/makefile.w32-in 2012-08-17 01:53:29 +0000 @@ -451,6 +451,7 @@ $(BLD)/regex.$(O) : \ $(SRC)/regex.c \ $(SRC)/regex.h \ + $(NT_INC)/stdbool.h \ $(NT_INC)/unistd.h \ $(CONFIG_H) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-16 21:58:44 +0000 +++ src/ChangeLog 2012-08-17 01:53:29 +0000 @@ -1,3 +1,10 @@ +2012-08-17 Juanma Barranquero + + * makefile.w32-in (C_CTYPE_H): New macro. + (LISP_H, $(BLD)/ccl.$(O), $(BLD)/doc.$(O), $(BLD)/w32console.$(O)): + ($(BLD)/fontset.$(O), $(BLD)/frame.$(O), $(BLD)/composite.$(O)): + ($(BLD)/sysdep.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies. + 2012-08-16 Paul Eggert Use ASCII tests for character types. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-08-02 06:19:48 +0000 +++ src/makefile.w32-in 2012-08-17 01:53:29 +0000 @@ -395,6 +395,8 @@ $(ATIMER_H) BUFFER_H = $(SRC)/buffer.h \ $(SYSTIME_H) +C_CTYPE_H = $(GNU_LIB)/c-ctype.h \ + $(NT_INC)/stdbool.h CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \ $(NT_INC)/unistd.h CHARACTER_H = $(SRC)/character.h \ @@ -441,7 +443,8 @@ $(SRC)/globals.h \ $(GNU_LIB)/intprops.h \ $(INTTYPES_H) \ - $(NT_INC)/stdalign.h + $(NT_INC)/stdalign.h \ + $(NT_INC)/stdbool.h MD5_H = $(GNU_LIB)/md5.h \ $(NT_INC)/stdint.h MENU_H = $(SRC)/menu.h \ @@ -626,6 +629,7 @@ $(CHARSET_H) \ $(CODING_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(LISP_H) $(BLD)/chartab.$(O) : \ @@ -747,6 +751,7 @@ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(KEYBOARD_H) \ $(LISP_H) @@ -820,6 +825,7 @@ $(CHARACTER_H) \ $(CODING_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FRAME_H) \ $(INTERVALS_H) \ @@ -881,6 +887,7 @@ $(CHARACTER_H) \ $(CHARSET_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FONT_H) \ $(FRAME_H) \ @@ -916,6 +923,7 @@ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FONT_H) \ $(FRAME_H) \ @@ -967,6 +975,7 @@ $(CHARACTER_H) \ $(CODING_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FONT_H) \ $(FRAME_H) \ @@ -1354,6 +1363,7 @@ $(BLOCKINPUT_H) \ $(CAREADLINKAT_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FRAME_H) \ $(GRP_H) \ @@ -1499,6 +1509,7 @@ $(CHARACTER_H) \ $(CHARSET_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(DISPEXTERN_H) \ $(FONT_H) \ $(FRAME_H) \ ------------------------------------------------------------ revno: 109647 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-08-16 14:58:44 -0700 message: Use ASCII tests for character types. * admin/merge-gnulib (GNULIB_MODULES): Add c-ctype. * lwlib/lwlib-Xaw.c, lwlib/lwlib.c, lwlib/xlwmenu.c: Don't include ; no longer needed. * lwlib/lwlib-Xaw.c (openFont): * lwlib/xlwmenu.c (openXftFont): Test just for ASCII digits. * src/category.c, src/dispnew.c, src/doprnt.c, src/editfns.c, src/syntax.c * src/term.c, src/xfns.c, src/xterm.c: Don't include ; was not needed. * src/charset.c, src/doc.c, src/fileio.c, src/font.c, src/frame.c: * src/gtkutil.c, src/image.c, src/sysdep.c, src/xfaces.c: Include instead of . * src/nsterm.m: Include . * src/charset.c (read_hex): * src/doc.c (Fsnarf_documentation): * src/fileio.c (IS_DRIVE) [WINDOWSNT]: (DRIVE_LETTER) [DOS_NT]: (Ffile_name_directory, Fexpand_file_name) (Fsubstitute_in_file_name): * src/font.c (font_parse_xlfd, font_parse_fcname): * src/frame.c (x_set_font_backend): * src/gtkutil.c (xg_get_font): * src/image.c (xbm_scan, xpm_scan, pbm_scan_number): * src/nsimage.m (hexchar): * src/nsterm.m (ns_xlfd_to_fontname): * src/sysdep.c (system_process_attributes): * src/xfaces.c (hash_string_case_insensitive): Use C-locale tests instead of locale-specific tests for character types, since we want the ASCII interpretation here, not the interpretation suitable for whatever happens to be the current locale. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-08-14 17:45:25 +0000 +++ admin/ChangeLog 2012-08-16 21:58:44 +0000 @@ -1,3 +1,10 @@ +2012-08-16 Paul Eggert + + Use ASCII tests for character types. + * merge-gnulib (GNULIB_MODULES): Add c-ctype. This documents a + new direct dependency; c-ctype was already being used indirectly + via other gnulib modules. + 2012-08-14 Paul Eggert Use bool for Emacs Lisp booleans. === modified file 'admin/merge-gnulib' --- admin/merge-gnulib 2012-08-14 17:45:25 +0000 +++ admin/merge-gnulib 2012-08-16 21:58:44 +0000 @@ -26,7 +26,7 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git GNULIB_MODULES=' - alloca-opt c-strcase + alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2012-08-01 17:55:15 +0000 +++ lwlib/ChangeLog 2012-08-16 21:58:44 +0000 @@ -1,3 +1,11 @@ +2012-08-16 Paul Eggert + + Use ASCII tests for character types. + * lwlib-Xaw.c, lwlib.c, xlwmenu.c: + Don't include ; no longer needed. + * lwlib-Xaw.c (openFont): + * xlwmenu.c (openXftFont): Test just for ASCII digits. + 2012-08-01 Glenn Morris * Makefile.in (config_h): Add conf_post.h. === modified file 'lwlib/lwlib-Xaw.c' --- lwlib/lwlib-Xaw.c 2012-06-26 01:05:39 +0000 +++ lwlib/lwlib-Xaw.c 2012-08-16 21:58:44 +0000 @@ -24,7 +24,6 @@ #include #include -#include #include @@ -125,7 +124,7 @@ XftFont *fn; /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */ - while (i > 0 && isdigit (fname[i])) + while (i > 0 && '0' <= fname[i] && fname[i] <= '9') --i; if (fname[i] == ' ') { === modified file 'lwlib/lwlib.c' --- lwlib/lwlib.c 2012-07-06 21:07:46 +0000 +++ lwlib/lwlib.c 2012-08-16 21:58:44 +0000 @@ -28,7 +28,6 @@ #include #include -#include #include "lwlib-int.h" #include "lwlib-utils.h" #include === modified file 'lwlib/xlwmenu.c' --- lwlib/xlwmenu.c 2012-06-26 01:05:39 +0000 +++ lwlib/xlwmenu.c 2012-08-16 21:58:44 +0000 @@ -28,7 +28,6 @@ #include #include -#include #include #if (defined __sun) && !(defined SUNOS41) @@ -1858,7 +1857,7 @@ int screen = XScreenNumberOfScreen (mw->core.screen); int len = strlen (fname), i = len-1; /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */ - while (i > 0 && isdigit (fname[i])) + while (i > 0 && '0' <= fname[i] && fname[i] <= '9') --i; if (fname[i] == ' ') { === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-16 07:58:24 +0000 +++ src/ChangeLog 2012-08-16 21:58:44 +0000 @@ -1,3 +1,31 @@ +2012-08-16 Paul Eggert + + Use ASCII tests for character types. + * category.c, dispnew.c, doprnt.c, editfns.c, syntax.c, term.c: + * xfns.c, xterm.c: + Don't include ; was not needed. + * charset.c, doc.c, fileio.c, font.c, frame.c, gtkutil.c, image.c: + * sysdep.c, xfaces.c: + Include instead of . + * nsterm.m: Include . + * charset.c (read_hex): + * doc.c (Fsnarf_documentation): + * fileio.c (IS_DRIVE) [WINDOWSNT]: + (DRIVE_LETTER) [DOS_NT]: + (Ffile_name_directory, Fexpand_file_name) + (Fsubstitute_in_file_name): + * font.c (font_parse_xlfd, font_parse_fcname): + * frame.c (x_set_font_backend): + * gtkutil.c (xg_get_font): + * image.c (xbm_scan, xpm_scan, pbm_scan_number): + * nsimage.m (hexchar): + * nsterm.m (ns_xlfd_to_fontname): + * sysdep.c (system_process_attributes): + * xfaces.c (hash_string_case_insensitive): + Use C-locale tests instead of locale-specific tests for character + types, since we want the ASCII interpretation here, not the + interpretation suitable for whatever happens to be the current locale. + 2012-08-16 Martin Rudalics Consistently check windows for validity/liveness === modified file 'src/category.c' --- src/category.c 2012-08-16 03:13:44 +0000 +++ src/category.c 2012-08-16 21:58:44 +0000 @@ -32,7 +32,6 @@ #define CATEGORY_INLINE EXTERN_INLINE -#include #include #include "lisp.h" #include "character.h" === modified file 'src/charset.c' --- src/charset.c 2012-08-03 23:36:11 +0000 +++ src/charset.c 2012-08-16 21:58:44 +0000 @@ -30,10 +30,10 @@ #include #include -#include #include #include #include +#include #include "lisp.h" #include "character.h" #include "charset.h" @@ -446,7 +446,7 @@ return 0; } n = 0; - while (isxdigit (c = getc (fp))) + while (c_isxdigit (c = getc (fp))) { if (UINT_MAX >> 4 < n) *overflow = 1; === modified file 'src/dispnew.c' --- src/dispnew.c 2012-08-07 07:33:18 +0000 +++ src/dispnew.c 2012-08-16 21:58:44 +0000 @@ -23,7 +23,6 @@ #include #include -#include #include #include === modified file 'src/doc.c' --- src/doc.c 2012-08-07 13:37:21 +0000 +++ src/doc.c 2012-08-16 21:58:44 +0000 @@ -22,11 +22,12 @@ #include #include /* Must be after sys/types.h for USG*/ -#include #include #include #include +#include + #include "lisp.h" #include "character.h" #include "buffer.h" @@ -597,9 +598,9 @@ { ptrdiff_t len; - while (*beg && isspace (*beg)) ++beg; + while (*beg && c_isspace (*beg)) ++beg; - for (end = beg; *end && ! isspace (*end); ++end) + for (end = beg; *end && ! c_isspace (*end); ++end) if (*end == '/') beg = end+1; /* skip directory part */ len = end - beg; === modified file 'src/doprnt.c' --- src/doprnt.c 2012-08-03 23:36:11 +0000 +++ src/doprnt.c 2012-08-16 21:58:44 +0000 @@ -102,7 +102,6 @@ #include #include -#include #include #include #include === modified file 'src/editfns.c' --- src/editfns.c 2012-08-14 17:10:38 +0000 +++ src/editfns.c 2012-08-16 21:58:44 +0000 @@ -44,7 +44,6 @@ #include #endif -#include #include #include #include === modified file 'src/fileio.c' --- src/fileio.c 2012-08-14 04:49:18 +0000 +++ src/fileio.c 2012-08-16 21:58:44 +0000 @@ -30,7 +30,6 @@ #include #endif -#include #include #ifdef HAVE_LIBSELINUX @@ -38,6 +37,8 @@ #include #endif +#include + #include "lisp.h" #include "intervals.h" #include "character.h" @@ -67,12 +68,12 @@ #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') #endif #ifdef WINDOWSNT -#define IS_DRIVE(x) isalpha ((unsigned char) (x)) +#define IS_DRIVE(x) c_isalpha (x) #endif /* Need to lower-case the drive letter, or else expanded filenames will sometimes compare unequal, because `expand-file-name' doesn't always down-case the drive letter. */ -#define DRIVE_LETTER(x) (tolower ((unsigned char) (x))) +#define DRIVE_LETTER(x) c_tolower (x) #endif #include "systime.h" @@ -364,7 +365,7 @@ r += 2; } - if (getdefdir (toupper ((unsigned char) *beg) - 'A' + 1, r)) + if (getdefdir (c_toupper (*beg) - 'A' + 1, r)) { if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) strcat (res, "/"); @@ -1053,7 +1054,7 @@ if (!IS_DIRECTORY_SEP (nm[0])) { adir = alloca (MAXPATHLEN + 1); - if (!getdefdir (toupper (drive) - 'A' + 1, adir)) + if (!getdefdir (c_toupper (drive) - 'A' + 1, adir)) adir = NULL; } if (!adir) @@ -1129,7 +1130,7 @@ adir = alloca (MAXPATHLEN + 1); if (drive) { - if (!getdefdir (toupper (drive) - 'A' + 1, adir)) + if (!getdefdir (c_toupper (drive) - 'A' + 1, adir)) newdir = "/"; } else @@ -1635,7 +1636,7 @@ else { o = p; - while (p != endp && (isalnum (*p) || *p == '_')) p++; + while (p != endp && (c_isalnum (*p) || *p == '_')) p++; s = p; } @@ -1698,7 +1699,7 @@ else { o = p; - while (p != endp && (isalnum (*p) || *p == '_')) p++; + while (p != endp && (c_isalnum (*p) || *p == '_')) p++; s = p; } === modified file 'src/font.c' --- src/font.c 2012-08-15 14:20:16 +0000 +++ src/font.c 2012-08-16 21:58:44 +0000 @@ -23,9 +23,10 @@ #include #include #include -#include #include +#include + #include "lisp.h" #include "character.h" #include "buffer.h" @@ -1079,7 +1080,7 @@ p = f[XLFD_POINT_INDEX]; if (*p == '[') point_size = parse_matrix (p); - else if (isdigit (*p)) + else if (c_isdigit (*p)) point_size = atoi (p), point_size /= 10; if (point_size >= 0) ASET (font, FONT_SIZE_INDEX, make_float (point_size)); @@ -1346,7 +1347,7 @@ { int decimal = 0, size_found = 1; for (q = p + 1; *q && *q != ':'; q++) - if (! isdigit (*q)) + if (! c_isdigit (*q)) { if (*q != '.' || decimal) { @@ -1474,7 +1475,7 @@ /* Scan backwards from the end, looking for a size. */ for (p = name + len - 1; p >= name; p--) - if (!isdigit (*p)) + if (!c_isdigit (*p)) break; if ((p < name + len - 1) && ((p + 1 == name) || *p == ' ')) === modified file 'src/frame.c' --- src/frame.c 2012-08-14 08:44:24 +0000 +++ src/frame.c 2012-08-16 21:58:44 +0000 @@ -20,10 +20,12 @@ #include #include -#include #include #include #include + +#include + #include "lisp.h" #include "character.h" #ifdef HAVE_X_WINDOWS @@ -3271,7 +3273,7 @@ new_value = Qnil; while (*p0) { - while (*p1 && ! isspace (*p1) && *p1 != ',') p1++; + while (*p1 && ! c_isspace (*p1) && *p1 != ',') p1++; if (p0 < p1) new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil), new_value); @@ -3279,7 +3281,7 @@ { int c; - while ((c = *++p1) && isspace (c)); + while ((c = *++p1) && c_isspace (c)); } p0 = p1; } === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-08-16 06:57:48 +0000 +++ src/gtkutil.c 2012-08-16 21:58:44 +0000 @@ -24,7 +24,9 @@ #include #include #include -#include + +#include + #include "lisp.h" #include "xterm.h" #include "blockinput.h" @@ -2072,7 +2074,7 @@ if (p) { char *ep = p+1; - while (isdigit (*ep)) + while (c_isdigit (*ep)) ++ep; if (*ep == '\0') *p = ' '; } === modified file 'src/image.c' --- src/image.c 2012-07-16 04:47:31 +0000 +++ src/image.c 2012-08-16 21:58:44 +0000 @@ -20,7 +20,6 @@ #include #include #include -#include #include #ifdef HAVE_PNG @@ -33,6 +32,8 @@ #include +#include + /* This makes the fields of a Display accessible, in Xlib header files. */ #define XLIB_ILLEGAL_ACCESS @@ -2405,12 +2406,12 @@ loop: /* Skip white space. */ - while (*s < end && (c = *(*s)++, isspace (c))) + while (*s < end && (c = *(*s)++, c_isspace (c))) ; if (*s >= end) c = 0; - else if (isdigit (c)) + else if (c_isdigit (c)) { int value = 0, digit; @@ -2422,7 +2423,7 @@ while (*s < end) { c = *(*s)++; - if (isdigit (c)) + if (c_isdigit (c)) digit = c - '0'; else if (c >= 'a' && c <= 'f') digit = c - 'a' + 10; @@ -2433,11 +2434,11 @@ value = 16 * value + digit; } } - else if (isdigit (c)) + else if (c_isdigit (c)) { value = c - '0'; while (*s < end - && (c = *(*s)++, isdigit (c))) + && (c = *(*s)++, c_isdigit (c))) value = 8 * value + c - '0'; } } @@ -2445,7 +2446,7 @@ { value = c - '0'; while (*s < end - && (c = *(*s)++, isdigit (c))) + && (c = *(*s)++, c_isdigit (c))) value = 10 * value + c - '0'; } @@ -2454,11 +2455,11 @@ *ival = value; c = XBM_TK_NUMBER; } - else if (isalpha (c) || c == '_') + else if (c_isalpha (c) || c == '_') { *sval++ = c; while (*s < end - && (c = *(*s)++, (isalnum (c) || c == '_'))) + && (c = *(*s)++, (c_isalnum (c) || c == '_'))) *sval++ = c; *sval = 0; if (*s < end) @@ -3661,16 +3662,17 @@ while (*s < end) { /* Skip white-space. */ - while (*s < end && (c = *(*s)++, isspace (c))) + while (*s < end && (c = *(*s)++, c_isspace (c))) ; /* gnus-pointer.xpm uses '-' in its identifier. sb-dir-plus.xpm uses '+' in its identifier. */ - if (isalpha (c) || c == '_' || c == '-' || c == '+') + if (c_isalpha (c) || c == '_' || c == '-' || c == '+') { *beg = *s - 1; while (*s < end - && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) + && (c = **s, c_isalnum (c) + || c == '_' || c == '-' || c == '+')) ++*s; *len = *s - *beg; return XPM_TK_IDENT; @@ -5014,7 +5016,7 @@ while (*s < end) { /* Skip white-space. */ - while (*s < end && (c = *(*s)++, isspace (c))) + while (*s < end && (c = *(*s)++, c_isspace (c))) ; if (c == '#') @@ -5023,11 +5025,11 @@ while (*s < end && (c = *(*s)++, c != '\n')) ; } - else if (isdigit (c)) + else if (c_isdigit (c)) { /* Read decimal number. */ val = c - '0'; - while (*s < end && (c = *(*s)++, isdigit (c))) + while (*s < end && (c = *(*s)++, c_isdigit (c))) val = 10 * val + c - '0'; break; } @@ -8554,7 +8556,7 @@ don't either. Let the Lisp loader use `unwind-protect' instead. */ printnum1 = FRAME_X_WINDOW (f); printnum2 = img->pixmap; - window_and_pixmap_id + window_and_pixmap_id = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); printnum1 = FRAME_FOREGROUND_PIXEL (f); === modified file 'src/nsimage.m' --- src/nsimage.m 2012-07-13 18:03:10 +0000 +++ src/nsimage.m 2012-08-16 21:58:44 +0000 @@ -302,7 +302,7 @@ [bmRep release]; return nil; } -#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) +#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10) s1 = *s++; s2 = *s++; c = hexchar (s1) * 0x10 + hexchar (s2); @@ -501,4 +501,3 @@ } @end - === modified file 'src/nsterm.m' --- src/nsterm.m 2012-08-15 18:58:19 +0000 +++ src/nsterm.m 2012-08-16 21:58:44 +0000 @@ -36,6 +36,8 @@ #include #include #include + +#include #include #include @@ -6785,20 +6787,20 @@ /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' ' also uppercase after '-' or ' ' */ - name[0] = toupper (name[0]); + name[0] = c_toupper (name[0]); for (len =strlen (name), i =0; i -#include #include #include #include "lisp.h" === modified file 'src/sysdep.c' --- src/sysdep.c 2012-08-07 07:42:34 +0000 +++ src/sysdep.c 2012-08-16 21:58:44 +0000 @@ -21,7 +21,6 @@ #define SYSTIME_INLINE EXTERN_INLINE -#include #include #include #include @@ -33,6 +32,7 @@ #include #include +#include #include #include #include @@ -2733,7 +2733,7 @@ if (emacs_read (fd, &ch, 1) != 1) break; c = ch; - if (isspace (c) || c == '\\') + if (c_isspace (c) || c == '\\') cmdline_size++; /* for later quoting, see below */ } if (cmdline_size) @@ -2757,7 +2757,7 @@ for (p = cmdline; p < cmdline + nread; p++) { /* Escape-quote whitespace and backslashes. */ - if (isspace (*p) || *p == '\\') + if (c_isspace (*p) || *p == '\\') { memmove (p + 1, p, nread - (p - cmdline)); nread++; === modified file 'src/term.c' --- src/term.c 2012-08-13 03:44:27 +0000 +++ src/term.c 2012-08-16 21:58:44 +0000 @@ -21,7 +21,6 @@ #include #include -#include #include #include #include === modified file 'src/xfaces.c' --- src/xfaces.c 2012-08-15 07:58:34 +0000 +++ src/xfaces.c 2012-08-16 21:58:44 +0000 @@ -279,7 +279,7 @@ #endif /* HAVE_X_WINDOWS */ -#include +#include /* Number of pt per inch (from the TeXbook). */ @@ -4059,7 +4059,7 @@ unsigned hash = 0; eassert (STRINGP (string)); for (s = SDATA (string); *s; ++s) - hash = (hash << 1) ^ tolower (*s); + hash = (hash << 1) ^ c_tolower (*s); return hash; } === modified file 'src/xfns.c' --- src/xfns.c 2012-08-15 07:58:34 +0000 +++ src/xfns.c 2012-08-16 21:58:44 +0000 @@ -49,7 +49,6 @@ #ifdef HAVE_X_WINDOWS -#include #include #include === modified file 'src/xterm.c' --- src/xterm.c 2012-08-13 03:44:27 +0000 +++ src/xterm.c 2012-08-16 21:58:44 +0000 @@ -50,7 +50,6 @@ #include "systime.h" #include -#include #include #include #include ------------------------------------------------------------ revno: 109646 committer: martin rudalics branch nick: trunk timestamp: Thu 2012-08-16 19:22:36 +0200 message: In window.el tell whether functions operate on valid, live or any windows. * window.el (window-child, window-child-count, window-last-child) (window-normalize-window, window-combined-p) (window-combinations, window-atom-root, window-min-size) (window-sizable, window-sizable-p, window-size-fixed-p) (window-min-delta, window-max-delta, window--resizable) (window--resizable-p, window-resizable, window-total-size) (window-full-height-p, window-full-width-p, window-body-size) (window-at-side-p, adjust-window-trailing-edge, maximize-window) (minimize-window, window-deletable-p, delete-window) (delete-other-windows, set-window-buffer-start-and-point) (next-buffer, previous-buffer, split-window, balance-windows-2) (set-window-text-height, window-buffer-height) (fit-window-to-buffer, shrink-window-if-larger-than-buffer) (truncated-partial-width-window-p): Minor code adjustments. In doc-strings state whether the argument window has to denote a live, valid or any window. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-16 07:58:24 +0000 +++ lisp/ChangeLog 2012-08-16 17:22:36 +0000 @@ -1,6 +1,22 @@ 2012-08-16 Martin Rudalics * window.el (window-valid-p): Move to window.c. + (window-child, window-child-count, window-last-child) + (window-normalize-window, window-combined-p) + (window-combinations, window-atom-root, window-min-size) + (window-sizable, window-sizable-p, window-size-fixed-p) + (window-min-delta, window-max-delta, window--resizable) + (window--resizable-p, window-resizable, window-total-size) + (window-full-height-p, window-full-width-p, window-body-size) + (window-at-side-p, adjust-window-trailing-edge, maximize-window) + (minimize-window, window-deletable-p, delete-window) + (delete-other-windows, set-window-buffer-start-and-point) + (next-buffer, previous-buffer, split-window, balance-windows-2) + (set-window-text-height, window-buffer-height) + (fit-window-to-buffer, shrink-window-if-larger-than-buffer) + (truncated-partial-width-window-p): Minor code adjustments. In + doc-strings state whether the argument window has to denote a + live, valid or any window. 2012-08-16 Phil Sainty (tiny change) === modified file 'lisp/window.el' --- lisp/window.el 2012-08-16 07:58:24 +0000 +++ lisp/window.el 2012-08-16 17:22:36 +0000 @@ -91,11 +91,13 @@ (and window (window-parent window) (window-prev-sibling window))) (defun window-child (window) - "Return WINDOW's first child window." + "Return WINDOW's first child window. +WINDOW can be any window." (or (window-top-child window) (window-left-child window))) (defun window-child-count (window) - "Return number of WINDOW's child windows." + "Return number of WINDOW's child windows. +WINDOW can be any window." (let ((count 0)) (when (and (windowp window) (setq window (window-child window))) (while window @@ -104,7 +106,8 @@ count)) (defun window-last-child (window) - "Return last child window of WINDOW." + "Return last child window of WINDOW. +WINDOW can be any window." (when (and (windowp window) (setq window (window-child window))) (while (window-next-sibling window) (setq window (window-next-sibling window)))) @@ -135,20 +138,22 @@ (selected-frame))) (defun window-normalize-window (window &optional live-only) - "Return window specified by WINDOW. -If WINDOW is nil, return `selected-window'. -If WINDOW is a live window or internal window, return WINDOW; - if LIVE-ONLY is non-nil, return WINDOW for a live window only. + "Return the window specified by WINDOW. +If WINDOW is nil, return the selected window. Otherwise, if +WINDOW is a live or an internal window, return WINDOW; if +LIVE-ONLY is non-nil, return WINDOW for a live window only. Otherwise, signal an error." - (cond ((null window) - (selected-window)) - (live-only - (if (window-live-p window) - window - (error "%s is not a live window" window))) - ((if (window-valid-p window) - window - (error "%s is not a window" window))))) + (cond + ((null window) + (selected-window)) + (live-only + (if (window-live-p window) + window + (error "%s is not a live window" window))) + ((window-valid-p window) + window) + (t + (error "%s is not a valid window" window)))) (defvar ignore-window-parameters nil "If non-nil, standard functions ignore window parameters. @@ -199,7 +204,7 @@ (defun window-combined-p (&optional window horizontal) "Return non-nil if WINDOW has siblings in a given direction. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. HORIZONTAL determines a direction for the window combination. If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part @@ -215,7 +220,7 @@ (defun window-combinations (window &optional horizontal) "Return largest number of windows vertically arranged within WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. If HORIZONTAL is non-nil, return the largest number of windows horizontally arranged within WINDOW." (setq window (window-normalize-window window)) @@ -313,7 +318,7 @@ ;;; Atomic windows. (defun window-atom-root (&optional window) "Return root of atomic window WINDOW is a part of. -WINDOW can be any window and defaults to the selected one. +WINDOW must be a valid window and defaults to the selected one. Return nil if WINDOW is not part of an atomic window." (setq window (window-normalize-window window)) (let (root) @@ -517,10 +522,10 @@ (defun window-min-size (&optional window horizontal ignore) "Return the minimum size of WINDOW. -WINDOW can be an arbitrary window and defaults to the selected -one. Optional argument HORIZONTAL non-nil means return the -minimum number of columns of WINDOW; otherwise return the minimum -number of WINDOW's lines. +WINDOW must be a valid window and defaults to the selected one. +Optional argument HORIZONTAL non-nil means return the minimum +number of columns of WINDOW; otherwise return the minimum number +of WINDOW's lines. Optional argument IGNORE, if non-nil, means ignore restrictions imposed by fixed size windows, `window-min-height' or @@ -600,6 +605,7 @@ (defun window-sizable (window delta &optional horizontal ignore) "Return DELTA if DELTA lines can be added to WINDOW. +WINDOW must be a valid window and defaults to the selected one. Optional argument HORIZONTAL non-nil means return DELTA if DELTA columns can be added to WINDOW. A return value of zero means that no lines (or columns) can be added to WINDOW. @@ -641,6 +647,7 @@ (defun window-sizable-p (window delta &optional horizontal ignore) "Return t if WINDOW can be resized by DELTA lines. +WINDOW must be a valid window and defaults to the selected one. For the meaning of the arguments of this function see the doc-string of `window-sizable'." (setq window (window-normalize-window window)) @@ -683,9 +690,9 @@ (defun window-size-fixed-p (&optional window horizontal) "Return non-nil if WINDOW's height is fixed. -WINDOW can be an arbitrary window and defaults to the selected -window. Optional argument HORIZONTAL non-nil means return -non-nil if WINDOW's width is fixed. +WINDOW must be a valid window and defaults to the selected one. +Optional argument HORIZONTAL non-nil means return non-nil if +WINDOW's width is fixed. If this function returns nil, this does not necessarily mean that WINDOW can be resized in the desired direction. The function @@ -733,8 +740,8 @@ (defun window-min-delta (&optional window horizontal ignore trail noup nodown) "Return number of lines by which WINDOW can be shrunk. -WINDOW can be an arbitrary window and defaults to the selected -window. Return zero if WINDOW cannot be shrunk. +WINDOW must be a valid window and defaults to the selected one. +Return zero if WINDOW cannot be shrunk. Optional argument HORIZONTAL non-nil means return number of columns by which WINDOW can be shrunk. @@ -815,8 +822,8 @@ (defun window-max-delta (&optional window horizontal ignore trail noup nodown) "Return maximum number of lines by which WINDOW can be enlarged. -WINDOW can be an arbitrary window and defaults to the selected -window. The return value is zero if WINDOW cannot be enlarged. +WINDOW must be a valid window and defaults to the selected one. +The return value is zero if WINDOW cannot be enlarged. Optional argument HORIZONTAL non-nil means return maximum number of columns by which WINDOW can be enlarged. @@ -853,6 +860,7 @@ ;; Make NOUP also inhibit the min-size check. (defun window--resizable (window delta &optional horizontal ignore trail noup nodown) "Return DELTA if WINDOW can be resized vertically by DELTA lines. +WINDOW must be a valid window and defaults to the selected one. Optional argument HORIZONTAL non-nil means return DELTA if WINDOW can be resized horizontally by DELTA columns. A return value of zero means that WINDOW is not resizable. @@ -899,6 +907,7 @@ (defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown) "Return t if WINDOW can be resized vertically by DELTA lines. +WINDOW must be a valid window and defaults to the selected one. For the meaning of the arguments of this function see the doc-string of `window--resizable'." (setq window (window-normalize-window window)) @@ -910,6 +919,7 @@ (defun window-resizable (window delta &optional horizontal ignore) "Return DELTA if WINDOW can be resized vertically by DELTA lines. +WINDOW must be a valid window and defaults to the selected one. Optional argument HORIZONTAL non-nil means return DELTA if WINDOW can be resized horizontally by DELTA columns. A return value of zero means that WINDOW is not resizable. @@ -936,7 +946,7 @@ (defun window-total-size (&optional window horizontal) "Return the total height or width of WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. If HORIZONTAL is omitted or nil, return the total height of WINDOW, in lines, like `window-total-height'. Otherwise return @@ -953,8 +963,8 @@ "Return t if WINDOW is as high as its containing frame. More precisely, return t if and only if the total height of WINDOW equals the total height of the root window of WINDOW's -frame. WINDOW can be any window and defaults to the selected -one." +frame. WINDOW must be a valid window and defaults to the +selected one." (setq window (window-normalize-window window)) (= (window-total-size window) (window-total-size (frame-root-window window)))) @@ -963,15 +973,14 @@ "Return t if WINDOW is as wide as its containing frame. More precisely, return t if and only if the total width of WINDOW equals the total width of the root window of WINDOW's frame. -WINDOW can be any window and defaults to the selected one." +WINDOW must be a valid window and defaults to the selected one." (setq window (window-normalize-window window)) (= (window-total-size window t) (window-total-size (frame-root-window window) t))) (defun window-body-size (&optional window horizontal) "Return the height or width of WINDOW's text area. -If WINDOW is omitted or nil, it defaults to the selected window. -Signal an error if the window is not live. +WINDOW must be a live window and defaults to the selected one. If HORIZONTAL is omitted or nil, return the height of the text area, like `window-body-height'. Otherwise, return the width of @@ -1081,9 +1090,9 @@ (defun window-at-side-p (&optional window side) "Return t if WINDOW is at SIDE of its containing frame. -WINDOW can be any window and defaults to the selected one. SIDE -can be any of the symbols `left', `top', `right' or `bottom'. -The default value nil is handled like `bottom'." +WINDOW must be a valid window and defaults to the selected one. +SIDE can be any of the symbols `left', `top', `right' or +`bottom'. The default value nil is handled like `bottom'." (setq window (window-normalize-window window)) (let ((edge (cond @@ -2019,7 +2028,8 @@ (defun adjust-window-trailing-edge (window delta &optional horizontal) "Move WINDOW's bottom edge by DELTA lines. Optional argument HORIZONTAL non-nil means move WINDOW's right -edge by DELTA columns. WINDOW defaults to the selected window. +edge by DELTA columns. WINDOW must be a valid window and +defaults to the selected one. If DELTA is greater than zero, move the edge downwards or to the right. If DELTA is less than zero, move the edge upwards or to @@ -2203,7 +2213,7 @@ (defun maximize-window (&optional window) "Maximize WINDOW. Make WINDOW as large as possible without deleting any windows. -WINDOW can be any window and defaults to the selected window." +WINDOW must be a valid window and defaults to the selected one." (interactive) (setq window (window-normalize-window window)) (window-resize window (window-max-delta window)) @@ -2212,7 +2222,7 @@ (defun minimize-window (&optional window) "Minimize WINDOW. Make WINDOW as small as possible without deleting any windows. -WINDOW can be any window and defaults to the selected window." +WINDOW must be a valid window and defaults to the selected one." (interactive) (setq window (window-normalize-window window)) (window-resize window (- (window-min-delta window))) @@ -2368,8 +2378,8 @@ ;;; Deleting windows. (defun window-deletable-p (&optional window) "Return t if WINDOW can be safely deleted from its frame. -Return `frame' if deleting WINDOW should also delete its -frame." +WINDOW must be a valid window and defaults to the selected one. +Return `frame' if deleting WINDOW should also delete its frame." (setq window (window-normalize-window window)) (unless ignore-window-parameters @@ -2407,8 +2417,8 @@ (defun delete-window (&optional window) "Delete WINDOW. -WINDOW can be an arbitrary window and defaults to the selected -one. Return nil. +WINDOW must be a valid window and defaults to the selected one. +Return nil. If the variable `ignore-window-parameters' is non-nil or the `delete-window' parameter of WINDOW equals t, do not process any @@ -2419,8 +2429,9 @@ Otherwise, if WINDOW is part of an atomic window, call `delete-window' with the root of the atomic window as its -argument. If WINDOW is the only window on its frame or the last -non-side window, signal an error." +argument. Signal an error if WINDOW is either the only window on +its frame, the last non-side window, or part of an atomic window +that is its frame's root window." (interactive) (setq window (window-normalize-window window)) (let* ((frame (window-frame window)) @@ -2448,7 +2459,9 @@ (not (eq (window-parameter parent 'window-side) 'none)))) (error "Attempt to delete last non-side window")) ((not parent) - (error "Attempt to delete minibuffer or sole ordinary window"))) + (error "Attempt to delete minibuffer or sole ordinary window")) + ((eq window (window--major-non-side-window frame)) + (error "Attempt to delete last non-side window"))) (let* ((horizontal (window-left-child parent)) (size (window-total-size window horizontal)) @@ -2487,7 +2500,7 @@ (defun delete-other-windows (&optional window) "Make WINDOW fill its frame. -WINDOW may be any window and defaults to the selected one. +WINDOW must be a valid window and defaults to the selected one. Return nil. If the variable `ignore-window-parameters' is non-nil or the @@ -2630,11 +2643,13 @@ (defun set-window-buffer-start-and-point (window buffer &optional start point) "Set WINDOW's buffer to BUFFER. +WINDOW must be a live window and defaults to the selected one. Optional argument START non-nil means set WINDOW's start position to START. Optional argument POINT non-nil means set WINDOW's point to POINT. If WINDOW is selected this also sets BUFFER's `point' to POINT. If WINDOW is selected and the buffer it showed before was current this also makes BUFFER the current buffer." + (setq window (window-normalize-window window t)) (let ((selected (eq window (selected-window))) (current (eq (window-buffer window) (current-buffer)))) (set-window-buffer window buffer) @@ -2948,16 +2963,24 @@ (defun next-buffer () "In selected window switch to next buffer." (interactive) - (if (window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) - (switch-to-next-buffer)) + (cond + ((window-minibuffer-p) + (error "Cannot switch buffers in minibuffer window")) + ((eq (window-dedicated-p) t) + (error "Window is strongly dedicated to its buffer")) + (t + (switch-to-next-buffer)))) (defun previous-buffer () "In selected window switch to previous buffer." (interactive) - (if (window-minibuffer-p) - (error "Cannot switch buffers in minibuffer window")) - (switch-to-prev-buffer)) + (cond + ((window-minibuffer-p) + (error "Cannot switch buffers in minibuffer window")) + ((eq (window-dedicated-p) t) + (error "Window is strongly dedicated to its buffer")) + (t + (switch-to-prev-buffer)))) (defun delete-windows-on (&optional buffer-or-name frame) "Delete all windows showing BUFFER-OR-NAME. @@ -3130,7 +3153,7 @@ (defun split-window (&optional window size side) "Make a new window adjacent to WINDOW. -WINDOW can be any window and defaults to the selected one. +WINDOW must be a valid window and defaults to the selected one. Return the new window which is always a live window. Optional argument SIZE a positive number means make WINDOW SIZE @@ -3451,7 +3474,7 @@ (defun balance-windows-2 (window horizontal) "Subroutine of `balance-windows-1'. WINDOW must be a vertical combination (horizontal if HORIZONTAL -is non-nil." +is non-nil)." (let* ((first (window-child window)) (sub first) (number-of-children 0) @@ -5179,9 +5202,9 @@ (defun set-window-text-height (window height) "Set the height in lines of the text display area of WINDOW to HEIGHT. -WINDOW must be a live window. HEIGHT doesn't include the mode -line or header line, if any, or any partial-height lines in the -text display area. +WINDOW must be a live window and defaults to the selected one. +HEIGHT doesn't include the mode line or header line, if any, or +any partial-height lines in the text display area. Note that the current implementation of this function cannot always set the height exactly, but attempts to be conservative, @@ -5248,7 +5271,9 @@ (1+ (vertical-motion (buffer-size) window)))))) (defun window-buffer-height (window) - "Return the height (in screen lines) of the buffer that WINDOW is displaying." + "Return the height (in screen lines) of the buffer that WINDOW is displaying. +WINDOW must be a live window and defaults to the selected one." + (setq window (window-normalize-window window t)) (with-current-buffer (window-buffer window) (max 1 (count-screen-lines (point-min) (point-max) @@ -5260,7 +5285,7 @@ ;;; Resizing buffers to fit their contents exactly. (defun fit-window-to-buffer (&optional window max-height min-height override) "Adjust height of WINDOW to display its buffer's contents exactly. -WINDOW can be any live window and defaults to the selected one. +WINDOW must be a live window and defaults to the selected one. Optional argument MAX-HEIGHT specifies the maximum height of WINDOW and defaults to the height of WINDOW's frame. Optional @@ -5379,7 +5404,7 @@ "Shrink height of WINDOW if its buffer doesn't need so many lines. More precisely, shrink WINDOW vertically to be as small as possible, while still showing the full contents of its buffer. -WINDOW defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. Do not shrink WINDOW to less than `window-min-height' lines. Do nothing if the buffer contains more lines than the present window @@ -5801,13 +5826,12 @@ (defun truncated-partial-width-window-p (&optional window) "Return non-nil if lines in WINDOW are specifically truncated due to its width. -WINDOW defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. Return nil if WINDOW is not a partial-width window (regardless of the value of `truncate-lines'). Otherwise, consult the value of `truncate-partial-width-windows' for the buffer shown in WINDOW." - (unless window - (setq window (selected-window))) + (setq window (window-normalize-window window t)) (unless (window-full-width-p window) (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows (window-buffer window)))) ------------------------------------------------------------ revno: 109645 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-08-16 06:17:33 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2012-08-10 10:17:28 +0000 +++ autogen/configure 2012-08-16 10:17:33 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for emacs 24.1.50. +# Generated by GNU Autoconf 2.65 for emacs 24.2.50. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -549,8 +549,8 @@ # Identity of this package. PACKAGE_NAME='emacs' PACKAGE_TARNAME='emacs' -PACKAGE_VERSION='24.1.50' -PACKAGE_STRING='emacs 24.1.50' +PACKAGE_VERSION='24.2.50' +PACKAGE_STRING='emacs 24.2.50' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1928,7 +1928,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures emacs 24.1.50 to adapt to many kinds of systems. +\`configure' configures emacs 24.2.50 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2002,7 +2002,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of emacs 24.1.50:";; + short | recursive ) echo "Configuration of emacs 24.2.50:";; esac cat <<\_ACEOF @@ -2169,7 +2169,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -emacs configure 24.1.50 +emacs configure 24.2.50 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2891,7 +2891,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by emacs $as_me 24.1.50, which was +It was created by emacs $as_me 24.2.50, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -3751,7 +3751,7 @@ # Define the identity of the package. PACKAGE='emacs' - VERSION='24.1.50' + VERSION='24.2.50' cat >>confdefs.h <<_ACEOF @@ -24668,7 +24668,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by emacs $as_me 24.1.50, which was +This file was extended by emacs $as_me 24.2.50, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24734,7 +24734,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -emacs config.status 24.1.50 +emacs config.status 24.2.50 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" ------------------------------------------------------------ revno: 109644 committer: martin rudalics branch nick: trunk timestamp: Thu 2012-08-16 09:58:24 +0200 message: Consistently check windows for validity/liveness (Bug#11984, Bug#12025, Bug#12026). * lisp.h (CHECK_VALID_WINDOW): New macro. * window.c (decode_window): Rename to decode_live_window. (decode_valid_window, Fwindow_valid_p): New functions. (Fwindow_frame, Fframe_root_window, Fwindow_minibuffer_p) (Fframe_first_window, Fframe_selected_window, Fwindow_parent) (Fwindow_top_child, Fwindow_left_child, Fwindow_next_sibling) (Fwindow_prev_sibling, Fwindow_combination_limit) (Fset_window_combination_limit, Fwindow_use_time) (Fwindow_total_height, Fwindow_total_width, Fwindow_new_total) (Fwindow_normal_size, Fwindow_new_normal, Fwindow_left_column) (Fwindow_top_line, Fwindow_body_height, Fwindow_body_width) (Fwindow_hscroll, Fset_window_hscroll) (Fwindow_redisplay_end_trigger) (Fset_window_redisplay_end_trigger, Fwindow_edges) (Fwindow_pixel_edges, Fwindow_absolute_pixel_edges) (Fwindow_inside_edges, Fwindow_inside_pixel_edges) (Fcoordinates_in_window_p, Fwindow_point, Fwindow_start) (Fwindow_end, Fset_window_point, Fset_window_start) (Fpos_visible_in_window_p, Fwindow_line_height) (Fwindow_dedicated_p, Fset_window_dedicated_p) (Fwindow_prev_buffers, Fset_window_prev_buffers) (Fwindow_next_buffers, Fwindow_parameters, Fwindow_parameter) (Fset_window_parameter, Fwindow_display_table) (Fset_window_display_table, Fdelete_other_windows_internal) (Fset_window_buffer, Fset_window_new_total) (Fset_window_new_normal, Fdelete_window_internal) (Fwindow_text_height, Fset_window_margins, Fwindow_margins) (Fset_window_fringes, Fwindow_fringes, Fset_window_scroll_bars) (Fwindow_scroll_bars): Check whether argument window is a valid or live window. Update doc-strings. (syms_of_window): New symbol Qwindow_valid_p. * keyboard.c (Fposn_at_x_y): Check whether argument frame_or_window denotes a valid window. * window.el (window-valid-p): Move to window.c. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-16 06:25:27 +0000 +++ lisp/ChangeLog 2012-08-16 07:58:24 +0000 @@ -1,3 +1,7 @@ +2012-08-16 Martin Rudalics + + * window.el (window-valid-p): Move to window.c. + 2012-08-16 Phil Sainty (tiny change) * progmodes/subword.el (subword-forward-function) === modified file 'lisp/window.el' --- lisp/window.el 2012-08-13 14:05:24 +0000 +++ lisp/window.el 2012-08-16 07:58:24 +0000 @@ -110,14 +110,6 @@ (setq window (window-next-sibling window)))) window) -(defun window-valid-p (object) - "Return t if OBJECT denotes a live window or internal window. -Otherwise, return nil; this includes the case where OBJECT is a -deleted window." - (and (windowp object) - (or (window-buffer object) (window-child object)) - t)) - (defun window-normalize-buffer (buffer-or-name) "Return buffer specified by BUFFER-OR-NAME. BUFFER-OR-NAME must be either a buffer or a string naming a live === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-16 07:26:18 +0000 +++ src/ChangeLog 2012-08-16 07:58:24 +0000 @@ -1,3 +1,41 @@ +2012-08-16 Martin Rudalics + + Consistently check windows for validity/liveness + (Bug#11984, Bug#12025, Bug#12026). + * lisp.h (CHECK_VALID_WINDOW): New macro. + * window.c (decode_window): Rename to decode_live_window. + (decode_valid_window, Fwindow_valid_p): New functions. + (Fwindow_frame, Fframe_root_window, Fwindow_minibuffer_p) + (Fframe_first_window, Fframe_selected_window, Fwindow_parent) + (Fwindow_top_child, Fwindow_left_child, Fwindow_next_sibling) + (Fwindow_prev_sibling, Fwindow_combination_limit) + (Fset_window_combination_limit, Fwindow_use_time) + (Fwindow_total_height, Fwindow_total_width, Fwindow_new_total) + (Fwindow_normal_size, Fwindow_new_normal, Fwindow_left_column) + (Fwindow_top_line, Fwindow_body_height, Fwindow_body_width) + (Fwindow_hscroll, Fset_window_hscroll) + (Fwindow_redisplay_end_trigger) + (Fset_window_redisplay_end_trigger, Fwindow_edges) + (Fwindow_pixel_edges, Fwindow_absolute_pixel_edges) + (Fwindow_inside_edges, Fwindow_inside_pixel_edges) + (Fcoordinates_in_window_p, Fwindow_point, Fwindow_start) + (Fwindow_end, Fset_window_point, Fset_window_start) + (Fpos_visible_in_window_p, Fwindow_line_height) + (Fwindow_dedicated_p, Fset_window_dedicated_p) + (Fwindow_prev_buffers, Fset_window_prev_buffers) + (Fwindow_next_buffers, Fwindow_parameters, Fwindow_parameter) + (Fset_window_parameter, Fwindow_display_table) + (Fset_window_display_table, Fdelete_other_windows_internal) + (Fset_window_buffer, Fset_window_new_total) + (Fset_window_new_normal, Fdelete_window_internal) + (Fwindow_text_height, Fset_window_margins, Fwindow_margins) + (Fset_window_fringes, Fwindow_fringes, Fset_window_scroll_bars) + (Fwindow_scroll_bars): Check whether argument window is a valid or + live window. Update doc-strings. + (syms_of_window): New symbol Qwindow_valid_p. + * keyboard.c (Fposn_at_x_y): Check whether argument + frame_or_window denotes a valid window. + 2012-08-16 Dmitry Antipov Fix previous char table change. === modified file 'src/keyboard.c' --- src/keyboard.c 2012-08-14 19:44:55 +0000 +++ src/keyboard.c 2012-08-16 07:58:24 +0000 @@ -11200,11 +11200,8 @@ if (WINDOWP (frame_or_window)) { - struct window *w; - - CHECK_LIVE_WINDOW (frame_or_window); - - w = XWINDOW (frame_or_window); + struct window *w = decode_valid_window (frame_or_window); + XSETINT (x, (XINT (x) + WINDOW_LEFT_EDGE_X (w) + (NILP (whole) === modified file 'src/lisp.h' --- src/lisp.h 2012-08-16 07:26:18 +0000 +++ src/lisp.h 2012-08-16 07:58:24 +0000 @@ -1758,15 +1758,18 @@ #define CHECK_WINDOW_CONFIGURATION(x) \ CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) -/* This macro rejects windows on the interior of the window tree as - "dead", which is what we want; this is an argument-checking macro, and - the user should never get access to interior windows. - - A window of any sort, leaf or interior, is dead if the buffer, - vchild, and hchild members are all nil. */ - -#define CHECK_LIVE_WINDOW(x) \ - CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \ +/* 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) \ === modified file 'src/window.c' --- src/window.c 2012-08-13 03:39:07 +0000 +++ src/window.c 2012-08-16 07:58:24 +0000 @@ -51,7 +51,7 @@ #include "nsterm.h" #endif -Lisp_Object Qwindowp, Qwindow_live_p; +Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p; static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; @@ -61,7 +61,6 @@ static Lisp_Object Qauto_buffer_name, Qclone_of; static int displayed_window_lines (struct window *); -static struct window *decode_window (Lisp_Object); static int count_windows (struct window *); static int get_leaf_windows (struct window *, struct window **, int); static void window_scroll (Lisp_Object, EMACS_INT, int, int); @@ -131,8 +130,8 @@ static EMACS_INT window_scroll_preserve_hpos; static EMACS_INT window_scroll_preserve_vpos; -static struct window * -decode_window (register Lisp_Object window) +struct window * +decode_live_window (register Lisp_Object window) { if (NILP (window)) return XWINDOW (selected_window); @@ -154,6 +153,19 @@ return w; } +struct window * +decode_valid_window (register Lisp_Object window) +{ + struct window *w; + + if (NILP (window)) + return XWINDOW (selected_window); + + CHECK_VALID_WINDOW (window); + w = XWINDOW (window); + return w; +} + DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, doc: /* Return t if OBJECT is a window and nil otherwise. */) (Lisp_Object object) @@ -161,6 +173,15 @@ return WINDOWP (object) ? Qt : Qnil; } +DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0, + doc: /* Return t if OBJECT is a valid window and nil otherwise. +A valid window is either a window that displays a buffer or an internal +window. Deleted windows are not live. */) + (Lisp_Object object) +{ + return WINDOW_VALID_P (object) ? Qt : Qnil; +} + DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, doc: /* Return t if OBJECT is a live window and nil otherwise. A live window is a window that displays a buffer. @@ -173,10 +194,10 @@ /* Frames and windows. */ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, doc: /* Return the frame that window WINDOW is on. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_any_window (window)->frame; + return decode_valid_window (window)->frame; } DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, @@ -190,8 +211,8 @@ if (NILP (frame_or_window)) window = SELECTED_FRAME ()->root_window; - else if (WINDOWP (frame_or_window)) - window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; + else if (WINDOW_VALID_P (frame_or_window)) + window = XFRAME (XWINDOW (frame_or_window)->frame)->root_window; else { CHECK_LIVE_FRAME (frame_or_window); @@ -215,18 +236,18 @@ DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, doc: /* Return non-nil if WINDOW is a minibuffer window. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; + return MINI_WINDOW_P (decode_valid_window (window)) ? Qt : Qnil; } /* Don't move this to window.el - this must be a safe routine. */ DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. -Else if FRAME-OR-WINDOW denotes any window, return the first window of -that window's frame. If FRAME-OR-WINDOW denotes a live frame, return +Else if FRAME-OR-WINDOW denotes a valid window, return the first window +of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return the first window of that frame. */) (Lisp_Object frame_or_window) { @@ -234,7 +255,7 @@ if (NILP (frame_or_window)) window = SELECTED_FRAME ()->root_window; - else if (WINDOWP (frame_or_window)) + else if (WINDOW_VALID_P (frame_or_window)) window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; else { @@ -259,16 +280,16 @@ Sframe_selected_window, 0, 1, 0, doc: /* Return the selected window of FRAME-OR-WINDOW. If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. -Else if FRAME-OR-WINDOW denotes any window, return the selected window -of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return -the selected window of that frame. */) +Else if FRAME-OR-WINDOW denotes a valid window, return the selected +window of that window's frame. If FRAME-OR-WINDOW denotes a live frame, +return the selected window of that frame. */) (Lisp_Object frame_or_window) { Lisp_Object window; if (NILP (frame_or_window)) window = SELECTED_FRAME ()->selected_window; - else if (WINDOWP (frame_or_window)) + else if (WINDOW_VALID_P (frame_or_window)) window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; else { @@ -421,88 +442,92 @@ DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, doc: /* Return the parent window of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. Return nil for a window with no parent (e.g. a root window). */) (Lisp_Object window) { - return decode_any_window (window)->parent; + return decode_valid_window (window)->parent; } DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, doc: /* Return the topmost child window of window WINDOW. +WINDOW must be a valid window and defaults to the selected one. Return nil if WINDOW is a live window (live windows have no children). Return nil if WINDOW is an internal window whose children form a horizontal combination. */) (Lisp_Object window) { CHECK_WINDOW (window); - return decode_any_window (window)->vchild; + return decode_valid_window (window)->vchild; } DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, doc: /* Return the leftmost child window of window WINDOW. +WINDOW must be a valid window and defaults to the selected one. Return nil if WINDOW is a live window (live windows have no children). Return nil if WINDOW is an internal window whose children form a vertical combination. */) (Lisp_Object window) { CHECK_WINDOW (window); - return decode_any_window (window)->hchild; + return decode_valid_window (window)->hchild; } DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, doc: /* Return the next sibling window of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. Return nil if WINDOW has no next sibling. */) (Lisp_Object window) { - return decode_any_window (window)->next; + return decode_valid_window (window)->next; } DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, doc: /* Return the previous sibling window of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. Return nil if WINDOW has no previous sibling. */) (Lisp_Object window) { - return decode_any_window (window)->prev; + return decode_valid_window (window)->prev; } DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, doc: /* Return combination limit of window WINDOW. +WINDOW must be a valid window and defaults to the selected one. If the return value is nil, child windows of WINDOW can be recombined with WINDOW's siblings. A return value of t means that child windows of WINDOW are never \(re-)combined with WINDOW's siblings. */) (Lisp_Object window) { - return decode_any_window (window)->combination_limit; + return decode_valid_window (window)->combination_limit; } DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. +WINDOW must be a valid window and defaults to the selected one. If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's siblings. LIMIT t means that child windows of WINDOW are never \(re-)combined with WINDOW's siblings. Other values are reserved for future use. */) (Lisp_Object window, Lisp_Object limit) { - return WSET (decode_any_window (window), combination_limit, limit); + return WSET (decode_valid_window (window), combination_limit, limit); } DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, doc: /* Return the use time of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. The window with the highest use time is the most recently selected one. The window with the lowest use time is the least recently selected one. */) (Lisp_Object window) { - return make_number (decode_window (window)->use_time); + return make_number (decode_live_window (window)->use_time); } DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, doc: /* Return the total height, in lines, of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. The return value includes the mode line and header line, if any. If WINDOW is an internal window, the total height is the height @@ -512,12 +537,12 @@ integer multiple of the default character height. */) (Lisp_Object window) { - return decode_any_window (window)->total_lines; + return decode_valid_window (window)->total_lines; } DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, doc: /* Return the total width, in columns, of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. The return value includes any vertical dividers or scroll bars belonging to WINDOW. If WINDOW is an internal window, the total width @@ -527,34 +552,34 @@ integer multiple of the default character width. */) (Lisp_Object window) { - return decode_any_window (window)->total_cols; + return decode_valid_window (window)->total_cols; } DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, doc: /* Return the new total size of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_any_window (window)->new_total; + return decode_valid_window (window)->new_total; } DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, doc: /* Return the normal height of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a valid window and defaults to the selected one. If HORIZONTAL is non-nil, return the normal width of WINDOW. */) (Lisp_Object window, Lisp_Object horizontal) { - struct window *w = decode_any_window (window); + struct window *w = decode_valid_window (window); return NILP (horizontal) ? w->normal_lines : w->normal_cols; } DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, doc: /* Return new normal size of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_any_window (window)->new_normal; + return decode_valid_window (window)->new_normal; } DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, @@ -563,10 +588,10 @@ the left edge of the frame's window area. For instance, the return value is 0 if there is no window to the left of WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_any_window (window)->left_col; + return decode_valid_window (window)->left_col; } DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, @@ -575,10 +600,10 @@ of the frame's window area. For instance, the return value is 0 if there is no window above WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window) { - return decode_any_window (window)->top_line; + return decode_valid_window (window)->top_line; } /* Return the number of lines of W's body. Don't count any mode or @@ -632,8 +657,7 @@ DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, doc: /* Return the height, in lines, of WINDOW's text area. -If WINDOW is omitted or nil, it defaults to the selected window. -Signal an error if the window is not live. +WINDOW must be a live window and defaults to the selected one. The returned height does not include the mode line or header line. On a graphical display, the height is expressed as an integer multiple @@ -642,21 +666,20 @@ exclude partially-visible lines, use `window-text-height'. */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); return make_number (window_body_lines (w)); } DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, doc: /* Return the width, in columns, of WINDOW's text area. -If WINDOW is omitted or nil, it defaults to the selected window. -Signal an error if the window is not live. +WINDOW must be a live window and defaults to the selected one. The return value does not include any vertical dividers, fringe or marginal areas, or scroll bars. On a graphical display, the width is expressed as an integer multiple of the default character width. */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); return make_number (window_body_cols (w)); } @@ -665,7 +688,7 @@ WINDOW must be a live window and defaults to the selected one. */) (Lisp_Object window) { - return make_number (decode_window (window)->hscroll); + return make_number (decode_live_window (window)->hscroll); } /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable @@ -692,7 +715,7 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. -If WINDOW is nil, the selected window is used. +WINDOW must be a live window and defaults to the selected one. Clip the number to a reasonable value if out of range. Return the new number. NCOL should be zero or positive. @@ -700,7 +723,7 @@ window so that the location of point moves off-window. */) (Lisp_Object window, Lisp_Object ncol) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); CHECK_NUMBER (ncol); return set_window_hscroll (w, XINT (ncol)); @@ -709,41 +732,43 @@ DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, Swindow_redisplay_end_trigger, 0, 1, 0, doc: /* Return WINDOW's redisplay end trigger value. -WINDOW defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. See `set-window-redisplay-end-trigger' for more information. */) (Lisp_Object window) { - return decode_window (window)->redisplay_end_trigger; + return decode_live_window (window)->redisplay_end_trigger; } DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, Sset_window_redisplay_end_trigger, 2, 2, 0, doc: /* Set WINDOW's redisplay end trigger value to VALUE. -VALUE should be a buffer position (typically a marker) or nil. -If it is a buffer position, then if redisplay in WINDOW reaches a position -beyond VALUE, the functions in `redisplay-end-trigger-functions' are called -with two arguments: WINDOW, and the end trigger value. -Afterwards the end-trigger value is reset to nil. */) +WINDOW must be a live window and defaults to the selected one. VALUE +should be a buffer position (typically a marker) or nil. If it is a +buffer position, then if redisplay in WINDOW reaches a position beyond +VALUE, the functions in `redisplay-end-trigger-functions' are called +with two arguments: WINDOW, and the end trigger value. Afterwards the +end-trigger value is reset to nil. */) (register Lisp_Object window, Lisp_Object value) { - return WSET (decode_window (window), redisplay_end_trigger, value); + return WSET (decode_live_window (window), redisplay_end_trigger, value); } DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, doc: /* Return a list of the edge coordinates of WINDOW. -The list has the form (LEFT TOP RIGHT BOTTOM). -TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, -all relative to 0, 0 at top left corner of frame. - -RIGHT is one more than the rightmost column occupied by WINDOW. -BOTTOM is one more than the bottommost row occupied by WINDOW. -The edges include the space used by WINDOW's scroll bar, display -margins, fringes, header line, and/or mode line. For the edges of -just the text area, use `window-inside-edges'. */) +WINDOW must be a valid window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM +count by lines, and LEFT and RIGHT count by columns, all relative to 0, +0 at top left corner of frame. + +RIGHT is one more than the rightmost column occupied by WINDOW. BOTTOM +is one more than the bottommost row occupied by WINDOW. The edges +include the space used by WINDOW's scroll bar, display margins, fringes, +header line, and/or mode line. For the edges of just the text area, use +`window-inside-edges'. */) (Lisp_Object window) { - register struct window *w = decode_any_window (window); - CHECK_LIVE_FRAME (w->frame); + register struct window *w = decode_valid_window (window); return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), @@ -754,8 +779,10 @@ DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, doc: /* Return a list of the edge pixel coordinates of WINDOW. -The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at -the top left corner of the frame. +WINDOW must be a valid window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to +0, 0 at the top left corner of the frame. RIGHT is one more than the rightmost x position occupied by WINDOW. BOTTOM is one more than the bottommost y position occupied by WINDOW. @@ -764,8 +791,7 @@ of just the text area, use `window-inside-pixel-edges'. */) (Lisp_Object window) { - register struct window *w = decode_any_window (window); - CHECK_LIVE_FRAME (w->frame); + register struct window *w = decode_valid_window (window); return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), @@ -799,8 +825,10 @@ DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, Swindow_absolute_pixel_edges, 0, 1, 0, doc: /* Return a list of the edge pixel coordinates of WINDOW. -The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at -the top left corner of the display. +WINDOW must be a valid window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to +0, 0 at the top left corner of the display. RIGHT is one more than the rightmost x position occupied by WINDOW. BOTTOM is one more than the bottommost y position occupied by WINDOW. @@ -809,10 +837,8 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */) (Lisp_Object window) { - register struct window *w = decode_any_window (window); + register struct window *w = decode_valid_window (window); int add_x, add_y; - - CHECK_LIVE_FRAME (w->frame); calc_absolute_offset (w, &add_x, &add_y); return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), @@ -824,17 +850,19 @@ DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, doc: /* Return a list of the edge coordinates of WINDOW. -The list has the form (LEFT TOP RIGHT BOTTOM). -TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, -all relative to 0, 0 at top left corner of frame. +WINDOW must be a live window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM +count by lines, and LEFT and RIGHT count by columns, all relative to 0, +0 at top left corner of frame. RIGHT is one more than the rightmost column of WINDOW's text area. -BOTTOM is one more than the bottommost row of WINDOW's text area. -The inside edges do not include the space used by the WINDOW's scroll -bar, display margins, fringes, header line, and/or mode line. */) +BOTTOM is one more than the bottommost row of WINDOW's text area. The +inside edges do not include the space used by the WINDOW's scroll bar, +display margins, fringes, header line, and/or mode line. */) (Lisp_Object window) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) + WINDOW_LEFT_MARGIN_COLS (w) @@ -850,8 +878,10 @@ DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. -The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) -at the top left corner of the frame's window area. +WINDOW must be a live window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to +(0,0) at the top left corner of the frame's window area. RIGHT is one more than the rightmost x position of WINDOW's text area. BOTTOM is one more than the bottommost y position of WINDOW's text area. @@ -859,7 +889,7 @@ display margins, fringes, header line, and/or mode line. */) (Lisp_Object window) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) + WINDOW_LEFT_MARGIN_WIDTH (w) @@ -877,8 +907,10 @@ Fwindow_inside_absolute_pixel_edges, Swindow_inside_absolute_pixel_edges, 0, 1, 0, doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. -The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) -at the top left corner of the frame's window area. +WINDOW must be a live window and defaults to the selected one. + +The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to +(0,0) at the top left corner of the frame's window area. RIGHT is one more than the rightmost x position of WINDOW's text area. BOTTOM is one more than the bottommost y position of WINDOW's text area. @@ -886,7 +918,7 @@ display margins, fringes, header line, and/or mode line. */) (Lisp_Object window) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); int add_x, add_y; calc_absolute_offset (w, &add_x, &add_y); @@ -1065,7 +1097,7 @@ DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, Scoordinates_in_window_p, 2, 2, 0, doc: /* Return non-nil if COORDINATES are in WINDOW. -WINDOW must be a live window. +WINDOW must be a live window and defaults to the selected one. COORDINATES is a cons of the form (X . Y), X and Y being distances measured in characters from the upper-left corner of the frame. \(0 . 0) denotes the character in the upper left corner of the @@ -1087,8 +1119,7 @@ int x, y; Lisp_Object lx, ly; - CHECK_LIVE_WINDOW (window); - w = XWINDOW (window); + w = decode_live_window (window); f = XFRAME (w->frame); CHECK_CONS (coordinates); lx = Fcar (coordinates); @@ -1266,7 +1297,7 @@ But that is hard to define. */) (Lisp_Object window) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); if (w == XWINDOW (selected_window) && current_buffer == XBUFFER (w->buffer)) @@ -1280,7 +1311,7 @@ This is updated by redisplay or by calling `set-window-start'. */) (Lisp_Object window) { - return Fmarker_position (decode_window (window)->start); + return Fmarker_position (decode_live_window (window)->start); } /* This is text temporarily removed from the doc string below. @@ -1307,7 +1338,7 @@ (Lisp_Object window, Lisp_Object update) { Lisp_Object value; - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); Lisp_Object buf; struct buffer *b; @@ -1374,10 +1405,11 @@ DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. +WINDOW must be a live window and defaults to the selected one. Return POS. */) (Lisp_Object window, Lisp_Object pos) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); CHECK_NUMBER_COERCE_MARKER (pos); if (w == XWINDOW (selected_window) @@ -1396,12 +1428,12 @@ DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. -If WINDOW is nil, the selected window is used. Return POS. -Optional third arg NOFORCE non-nil inhibits next redisplay from +WINDOW must be a live window and defaults to the selected one. Return +POS. Optional third arg NOFORCE non-nil inhibits next redisplay from overriding motion of point in order to display at this exact start. */) (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) { - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); CHECK_NUMBER_COERCE_MARKER (pos); set_marker_restricted (w->start, pos, w->buffer); @@ -1421,12 +1453,14 @@ DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, Spos_visible_in_window_p, 0, 3, 0, doc: /* Return non-nil if position POS is currently on the frame in WINDOW. -Return nil if that position is scrolled vertically out of view. -If a character is only partially visible, nil is returned, unless the -optional argument PARTIALLY is non-nil. -If POS is only out of view because of horizontal scrolling, return non-nil. -If POS is t, it specifies the position of the last visible glyph in WINDOW. -POS defaults to point in WINDOW; WINDOW defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. + +Return nil if that position is scrolled vertically out of view. If a +character is only partially visible, nil is returned, unless the +optional argument PARTIALLY is non-nil. If POS is only out of view +because of horizontal scrolling, return non-nil. If POS is t, it +specifies the position of the last visible glyph in WINDOW. POS +defaults to point in WINDOW; WINDOW defaults to the selected window. If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), @@ -1445,7 +1479,7 @@ int rtop, rbot, rowh, vpos, fully_p = 1; int x, y; - w = decode_window (window); + w = decode_live_window (window); buf = XBUFFER (w->buffer); SET_TEXT_POS_FROM_MARKER (top, w->start); @@ -1487,7 +1521,7 @@ DEFUN ("window-line-height", Fwindow_line_height, Swindow_line_height, 0, 2, 0, doc: /* Return height in pixels of text line LINE in window WINDOW. -WINDOW defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. Return height of current line if LINE is omitted or nil. Return height of header or mode line if LINE is `header-line' or `mode-line'. @@ -1511,7 +1545,7 @@ int max_y, crop, i; EMACS_INT n; - w = decode_window (window); + w = decode_live_window (window); if (noninteractive || w->pseudo_window_p) return Qnil; @@ -1599,8 +1633,8 @@ More precisely, return the value assigned by the last call of `set-window-dedicated-p' for WINDOW. Return nil if that function was never called with WINDOW as its argument, or the value set by that -function was internally reset since its last call. WINDOW defaults to -the selected window. +function was internally reset since its last call. WINDOW must be a +live window and defaults to the selected one. When a window is dedicated to its buffer, `display-buffer' will refrain from displaying another buffer in it. `get-lru-window' and @@ -1613,7 +1647,7 @@ is the value returned by `window-dedicated-p' is t. */) (Lisp_Object window) { - return decode_window (window)->dedicated; + return decode_live_window (window)->dedicated; } DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, @@ -1637,7 +1671,7 @@ window, it also makes sure that the window is no more dedicated. */) (Lisp_Object window, Lisp_Object flag) { - return WSET (decode_window (window), dedicated, flag); + return WSET (decode_live_window (window), dedicated, flag); } DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, @@ -1650,7 +1684,7 @@ window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window) { - return decode_window (window)->prev_buffers; + return decode_live_window (window)->prev_buffers; } DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, @@ -1663,7 +1697,7 @@ window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window, Lisp_Object prev_buffers) { - return WSET (decode_window (window), prev_buffers, prev_buffers); + return WSET (decode_live_window (window), prev_buffers, prev_buffers); } DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, @@ -1672,7 +1706,7 @@ WINDOW must be a live window and defaults to the selected one. */) (Lisp_Object window) { - return decode_window (window)->next_buffers; + return decode_live_window (window)->next_buffers; } DEFUN ("set-window-next-buffers", Fset_window_next_buffers, @@ -1682,38 +1716,39 @@ NEXT-BUFFERS should be a list of buffers. */) (Lisp_Object window, Lisp_Object next_buffers) { - return WSET (decode_window (window), next_buffers, next_buffers); + return WSET (decode_live_window (window), next_buffers, next_buffers); } DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 0, 1, 0, doc: /* Return the parameters of WINDOW and their values. -WINDOW defaults to the selected window. The return value is a list of -elements of the form (PARAMETER . VALUE). */) +WINDOW must be a valid window and defaults to the selected one. The +return value is a list of elements of the form (PARAMETER . VALUE). */) (Lisp_Object window) { - return Fcopy_alist (decode_any_window (window)->window_parameters); + return Fcopy_alist (decode_valid_window (window)->window_parameters); } DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 2, 2, 0, doc: /* Return WINDOW's value for PARAMETER. -WINDOW defaults to the selected window. */) +WINDOW must be a valid window and defaults to the selected one. */) (Lisp_Object window, Lisp_Object parameter) { Lisp_Object result; - result = Fassq (parameter, decode_any_window (window)->window_parameters); + result = Fassq (parameter, decode_valid_window (window)->window_parameters); return CDR_SAFE (result); } DEFUN ("set-window-parameter", Fset_window_parameter, Sset_window_parameter, 3, 3, 0, doc: /* Set WINDOW's value of PARAMETER to VALUE. -WINDOW defaults to the selected window. Return VALUE. */) +WINDOW must be a valid window and defaults to the selected one. +Return VALUE. */) (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) { - register struct window *w = decode_any_window (window); + register struct window *w = decode_valid_window (window); Lisp_Object old_alist_elt; old_alist_elt = Fassq (parameter, w->window_parameters); @@ -1728,10 +1763,10 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 0, 1, 0, doc: /* Return the display-table that WINDOW is using. -WINDOW defaults to the selected window. */) +WINDOW must be a live window and defaults to the selected one. */) (Lisp_Object window) { - return decode_window (window)->display_table; + return decode_live_window (window)->display_table; } /* Get the display table for use on window W. This is either W's @@ -1760,10 +1795,11 @@ } DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, - doc: /* Set WINDOW's display-table to TABLE. */) + doc: /* Set WINDOW's display-table to TABLE. +WINDOW must be a live window and defaults to the selected one. */) (register Lisp_Object window, Lisp_Object table) { - return WSET (decode_window (window), display_table, table); + return WSET (decode_live_window (window), display_table, table); } /* Record info on buffer window W is displaying @@ -2559,8 +2595,8 @@ DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, Sdelete_other_windows_internal, 0, 2, "", doc: /* Make WINDOW fill its frame. -Only the frame WINDOW is on is affected. WINDOW may be any window and -defaults to the selected one. +Only the frame WINDOW is on is affected. WINDOW must be a valid window +and defaults to the selected one. Optional argument ROOT, if non-nil, must specify an internal window such that WINDOW is in its window subtree. If this is the case, replace ROOT @@ -2579,8 +2615,7 @@ ptrdiff_t startpos IF_LINT (= 0); int top IF_LINT (= 0), new_top, resize_failed; - w = decode_any_window (window); - CHECK_LIVE_FRAME (w->frame); + w = decode_valid_window (window); XSETWINDOW (window, w); f = XFRAME (w->frame); @@ -2593,8 +2628,7 @@ else /* ROOT must be an ancestor of WINDOW. */ { - r = decode_any_window (root); - CHECK_LIVE_FRAME (r->frame); + r = decode_valid_window (root); pwindow = XWINDOW (window)->parent; while (!NILP (pwindow)) if (EQ (pwindow, root)) @@ -3079,7 +3113,7 @@ DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. -WINDOW has to be a live window and defaults to the selected one. +WINDOW must be a live window and defaults to the selected one. BUFFER-OR-NAME must be a buffer or the name of an existing buffer. Optional third argument KEEP-MARGINS non-nil means that WINDOW's current @@ -3096,7 +3130,7 @@ (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) { register Lisp_Object tem, buffer; - register struct window *w = decode_window (window); + register struct window *w = decode_live_window (window); XSETWINDOW (window, w); buffer = Fget_buffer (buffer_or_name); @@ -3318,6 +3352,7 @@ DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, doc: /* Set new total size of WINDOW to SIZE. +WINDOW must be a valid window and defaults to the selected one. Return SIZE. Optional argument ADD non-nil means add SIZE to the new total size of @@ -3326,7 +3361,7 @@ Note: This function does not operate on any child windows of WINDOW. */) (Lisp_Object window, Lisp_Object size, Lisp_Object add) { - struct window *w = decode_any_window (window); + struct window *w = decode_valid_window (window); CHECK_NUMBER (size); if (NILP (add)) @@ -3339,12 +3374,13 @@ DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, doc: /* Set new normal size of WINDOW to SIZE. +WINDOW must be a valid window and defaults to the selected one. Return SIZE. Note: This function does not operate on any child windows of WINDOW. */) (Lisp_Object window, Lisp_Object size) { - return WSET (decode_any_window (window), new_normal, size); + return WSET (decode_valid_window (window), new_normal, size); } /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is @@ -3838,8 +3874,6 @@ int before_sibling = 0; w = decode_any_window (window); - CHECK_LIVE_FRAME (w->frame); - XSETWINDOW (window, w); if (NILP (w->buffer) && NILP (w->hchild) && NILP (w->vchild)) @@ -5201,13 +5235,13 @@ DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, 0, 1, 0, doc: /* Return the height in lines of the text display area of WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. The returned height does not include the mode line, any header line, nor any partial-height lines at the bottom of the text area. */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); int pixel_height = window_box_height (w); int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); return make_number (line_height); @@ -6034,14 +6068,15 @@ DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, 2, 3, 0, doc: /* Set width of marginal areas of window WINDOW. -If WINDOW is nil, set margins of the currently selected window. +WINDOW must be a live window and defaults to the selected one. + Second arg LEFT-WIDTH specifies the number of character cells to reserve for the left marginal area. Optional third arg RIGHT-WIDTH does the same for the right marginal area. A nil width parameter means no margin. */) (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); /* Translate negative or zero widths to nil. Margins that are too wide have to be checked elsewhere. */ @@ -6079,13 +6114,14 @@ DEFUN ("window-margins", Fwindow_margins, Swindow_margins, 0, 1, 0, doc: /* Get width of marginal areas of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. + Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). If a marginal area does not exist, its width will be returned as nil. */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); return Fcons (w->left_margin_cols, w->right_margin_cols); } @@ -6098,8 +6134,8 @@ DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, 2, 4, 0, doc: /* Set the fringe widths of window WINDOW. -If WINDOW is nil, set the fringe widths of the currently selected -window. +WINDOW must be a live window and defaults to the selected one. + Second arg LEFT-WIDTH specifies the number of pixels to reserve for the left fringe. Optional third arg RIGHT-WIDTH specifies the right fringe width. If a fringe width arg is nil, that means to use the @@ -6110,7 +6146,7 @@ display marginal areas and the text area. */) (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); int outside = !NILP (outside_margins); if (!NILP (left_width)) @@ -6144,11 +6180,12 @@ DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, 0, 1, 0, doc: /* Get width of fringes of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. + Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), @@ -6165,7 +6202,8 @@ DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, Sset_window_scroll_bars, 2, 4, 0, doc: /* Set width and type of scroll bars of window WINDOW. -If window is nil, set scroll bars of the currently selected window. +WINDOW must be a live window and defaults to the selected one. + Second parameter WIDTH specifies the pixel width for the scroll bar; this is automatically adjusted to a multiple of the frame column width. Third parameter VERTICAL-TYPE specifies the type of the vertical scroll @@ -6175,7 +6213,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); if (!NILP (width)) { @@ -6213,13 +6251,14 @@ DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, 0, 1, 0, doc: /* Get width and type of scroll bars of window WINDOW. -If WINDOW is omitted or nil, it defaults to the selected window. +WINDOW must be a live window and defaults to the selected one. + Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). If WIDTH is nil or TYPE is t, the window is using the frame's corresponding value. */) (Lisp_Object window) { - struct window *w = decode_window (window); + struct window *w = decode_live_window (window); return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), @@ -6513,6 +6552,7 @@ DEFSYM (Qwindowp, "windowp"); DEFSYM (Qwindow_configuration_p, "window-configuration-p"); DEFSYM (Qwindow_live_p, "window-live-p"); + DEFSYM (Qwindow_valid_p, "window-valid-p"); DEFSYM (Qwindow_deletable_p, "window-deletable-p"); DEFSYM (Qdelete_window, "delete-window"); DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); @@ -6665,6 +6705,7 @@ defsubr (&Sminibuffer_window); defsubr (&Swindow_minibuffer_p); defsubr (&Swindowp); + defsubr (&Swindow_valid_p); defsubr (&Swindow_live_p); defsubr (&Swindow_frame); defsubr (&Sframe_root_window); === modified file 'src/window.h' --- src/window.h 2012-08-07 07:33:18 +0000 +++ src/window.h 2012-08-16 07:58:24 +0000 @@ -885,8 +885,15 @@ struct glyph *get_phys_cursor_glyph (struct window *w); +/* Value is non-zero if WINDOW is a valid window. */ +#define WINDOW_VALID_P(WINDOW) \ + (WINDOWP (WINDOW) \ + && (!NILP (XWINDOW (WINDOW)->buffer) \ + || !NILP (XWINDOW (WINDOW)->vchild) \ + || !NILP (XWINDOW (WINDOW)->hchild))) + + /* Value is non-zero if WINDOW is a live window. */ - #define WINDOW_LIVE_P(WINDOW) \ (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) @@ -895,6 +902,8 @@ extern Lisp_Object Qwindowp, Qwindow_live_p; extern Lisp_Object Vwindow_list; +extern struct window *decode_valid_window (Lisp_Object); +extern struct window *decode_live_window (Lisp_Object); extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); extern void mark_window_cursors_off (struct window *); extern int window_internal_height (struct window *); ------------------------------------------------------------ revno: 109643 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-08-16 11:26:18 +0400 message: Fix previous char table change. * lisp.h (CHAR_TABLE_SET): Use sub_char_table_set_contents. * chartab.c (optimize_sub_char_table): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-16 06:57:48 +0000 +++ src/ChangeLog 2012-08-16 07:26:18 +0000 @@ -1,3 +1,9 @@ +2012-08-16 Dmitry Antipov + + Fix previous char table change. + * lisp.h (CHAR_TABLE_SET): Use sub_char_table_set_contents. + * chartab.c (optimize_sub_char_table): Likewise. + 2012-08-16 Chong Yidong * gtkutil.c (xg_get_font): Demand an Xft font (Bug#3228). === modified file 'src/chartab.c' --- src/chartab.c 2012-08-16 03:13:44 +0000 +++ src/chartab.c 2012-08-16 07:26:18 +0000 @@ -693,15 +693,19 @@ elt = XSUB_CHAR_TABLE (table)->contents[0]; if (SUB_CHAR_TABLE_P (elt)) - elt = XSUB_CHAR_TABLE (table)->contents[0] - = optimize_sub_char_table (elt, test); + { + elt = optimize_sub_char_table (elt, test); + sub_char_table_set_contents (table, 0, elt); + } optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; for (i = 1; i < chartab_size[depth]; i++) { this = XSUB_CHAR_TABLE (table)->contents[i]; if (SUB_CHAR_TABLE_P (this)) - this = XSUB_CHAR_TABLE (table)->contents[i] - = optimize_sub_char_table (this, test); + { + this = optimize_sub_char_table (this, test); + sub_char_table_set_contents (table, i, this); + } if (optimizable && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */ === modified file 'src/lisp.h' --- src/lisp.h 2012-08-16 03:13:44 +0000 +++ src/lisp.h 2012-08-16 07:26:18 +0000 @@ -923,7 +923,7 @@ 8-bit European characters. Do not check validity of CT. */ #define CHAR_TABLE_SET(CT, IDX, VAL) \ (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ - ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ + ? sub_char_table_set_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ : char_table_set (CT, IDX, VAL)) enum CHARTAB_SIZE_BITS ------------------------------------------------------------ revno: 109642 fixes bug: http://debbugs.gnu.org/3228 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-08-16 14:57:48 +0800 message: * gtkutil.c (xg_get_font): Demand an Xft font. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-16 06:35:13 +0000 +++ src/ChangeLog 2012-08-16 06:57:48 +0000 @@ -1,5 +1,7 @@ 2012-08-16 Chong Yidong + * gtkutil.c (xg_get_font): Demand an Xft font (Bug#3228). + * xfont.c (xfont_open): * xftfont.c (xftfont_open): Set the font's max_width field. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-08-15 18:34:46 +0000 +++ src/gtkutil.c 2012-08-16 06:57:48 +0000 @@ -2016,7 +2016,7 @@ #if USE_NEW_GTK_FONT_CHOOSER -extern Lisp_Object Qnormal; +extern Lisp_Object Qxft, Qnormal; extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold; extern Lisp_Object Qbold, Qextra_bold, Qultra_bold; extern Lisp_Object Qoblique, Qitalic; @@ -2099,7 +2099,7 @@ if (desc) { - Lisp_Object args[8]; + Lisp_Object args[10]; const char *name = pango_font_description_get_family (desc); gint size = pango_font_description_get_size (desc); PangoWeight weight = pango_font_description_get_weight (desc); @@ -2117,6 +2117,9 @@ args[6] = QCslant; args[7] = XG_STYLE_TO_SYMBOL (style); + args[8] = QCtype; + args[9] = Qxft; + font = Ffont_spec (8, args); pango_font_description_free (desc); === modified file 'src/xftfont.c' --- src/xftfont.c 2012-08-16 06:35:13 +0000 +++ src/xftfont.c 2012-08-16 06:57:48 +0000 @@ -39,7 +39,7 @@ /* Xft font driver. */ -static Lisp_Object Qxft; +Lisp_Object Qxft; static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden, QClcdfilter;