Now on revision 109861. ------------------------------------------------------------ revno: 109861 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-02 10:10:35 -0700 message: * emacs.c, eval.c: Use bool for boolean. * emacs.c (initialized, inhibit_window_system, running_asynch_code): (malloc_using_checking) [DOUG_LEA_MALLOC]: (display_arg) [HAVE_X_WINDOWS || HAVE_NS]: (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch) (main, decode_env_path, Fdaemon_initialized): * eval.c (call_debugger, Finteractive_p, interactive_p): (unwind_to_catch, Fsignal, wants_debugger, skip_debugger) (maybe_call_debugger, Fbacktrace): * process.c (read_process_output, exec_sentinel): Use bool for booleans. * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X. All callers changed. * eval.c (interactive_p): Omit always-true boolean argument EXCLUDE_SUBRS_P. All callers changed. * dispextern.h, lisp.h: Reflect above API changes. * firstfile.c (dummy): Use the address of 'main', whose signature won't change, instead of the address of 'initialize', whose signature just changed from int to bool. * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ... * msdos.c (fatal_error_in_progress): ... from here. * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead of incrementing it. (redisplay_internal, unwind_redisplay): Simply clear REDISPLAYING_P when unwinding, instead of saving its previous, always-false value and then restoring it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 16:56:31 +0000 +++ src/ChangeLog 2012-09-02 17:10:35 +0000 @@ -1,5 +1,32 @@ 2012-09-02 Paul Eggert + * emacs.c, eval.c: Use bool for boolean. + * emacs.c (initialized, inhibit_window_system, running_asynch_code): + (malloc_using_checking) [DOUG_LEA_MALLOC]: + (display_arg) [HAVE_X_WINDOWS || HAVE_NS]: + (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch) + (main, decode_env_path, Fdaemon_initialized): + * eval.c (call_debugger, Finteractive_p, interactive_p): + (unwind_to_catch, Fsignal, wants_debugger, skip_debugger) + (maybe_call_debugger, Fbacktrace): + * process.c (read_process_output, exec_sentinel): + Use bool for booleans. + * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X. + All callers changed. + * eval.c (interactive_p): Omit always-true boolean argument + EXCLUDE_SUBRS_P. All callers changed. + * dispextern.h, lisp.h: Reflect above API changes. + * firstfile.c (dummy): Use the address of 'main', whose signature + won't change, instead of the address of 'initialize', whose + signature just changed from int to bool. + * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ... + * msdos.c (fatal_error_in_progress): ... from here. + * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead + of incrementing it. + (redisplay_internal, unwind_redisplay): Simply clear + REDISPLAYING_P when unwinding, instead of saving its previous, + always-false value and then restoring it. + Clean up some extern decls. Mostly, this hoists extern decls out of .c files and into .h files. That way, we're more likely to catch errors if the interfaces change. === modified file 'src/dispextern.h' --- src/dispextern.h 2012-09-02 16:56:31 +0000 +++ src/dispextern.h 2012-09-02 17:10:35 +0000 @@ -3055,7 +3055,7 @@ int in_display_vector_p (struct it *); int frame_mode_line_height (struct frame *); extern Lisp_Object Qtool_bar; -extern int redisplaying_p; +extern bool redisplaying_p; extern int help_echo_showing_p; extern int current_mode_line_height, current_header_line_height; extern Lisp_Object help_echo_string, help_echo_window; === modified file 'src/emacs.c' --- src/emacs.c 2012-09-01 08:01:36 +0000 +++ src/emacs.c 2012-09-02 17:10:35 +0000 @@ -95,10 +95,10 @@ /* Empty lisp strings. To avoid having to build any others. */ Lisp_Object empty_unibyte_string, empty_multibyte_string; -/* Set nonzero after Emacs has started up the first time. - Prevents reinitialization of the Lisp world and keymaps - on subsequent starts. */ -int initialized; +/* Set after Emacs has started up the first time. + Prevents reinitialization of the Lisp world and keymaps + on subsequent starts. */ +bool initialized; #ifdef DARWIN_OS extern void unexec_init_emacs_zone (void); @@ -112,9 +112,9 @@ extern void *malloc_get_state (void); /* From glibc, a routine that overwrites the malloc internal state. */ extern int malloc_set_state (void*); -/* Non-zero if the MALLOC_CHECK_ environment variable was set while +/* True if the MALLOC_CHECK_ environment variable was set while dumping. Used to work around a bug in glibc's malloc. */ -static int malloc_using_checking; +static bool malloc_using_checking; #endif Lisp_Object Qfile_name_handler_alist; @@ -123,17 +123,17 @@ Lisp_Object Qkill_emacs; -/* If non-zero, Emacs should not attempt to use a window-specific code, +/* If true, Emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ -int inhibit_window_system; +bool inhibit_window_system; -/* If non-zero, a filter or a sentinel is running. Tested to save the match +/* If true, a filter or a sentinel is running. Tested to save the match data on the first attempt to change it inside asynchronous code. */ -int running_asynch_code; +bool running_asynch_code; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) -/* If non-zero, -d was specified, meaning we're using some window system. */ -int display_arg; +/* If true, -d was specified, meaning we're using some window system. */ +bool display_arg; #endif /* An address near the bottom of the stack. @@ -150,11 +150,11 @@ static uprintmax_t heap_bss_diff; #endif -/* Nonzero means running Emacs without interactive terminal. */ -int noninteractive; +/* True means running Emacs without interactive terminal. */ +bool noninteractive; -/* Nonzero means remove site-lisp directories from load-path. */ -int no_site_lisp; +/* True means remove site-lisp directories from load-path. */ +bool no_site_lisp; /* Name for the server started by the daemon.*/ static char *daemon_name; @@ -272,8 +272,8 @@ /* Signal code for the fatal signal that was received. */ static int fatal_error_code; -/* Nonzero if handling a fatal error already. */ -int fatal_error_in_progress; +/* True if handling a fatal error already. */ +bool fatal_error_in_progress; #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD /* When compiled with GTK and running under Gnome, @@ -311,7 +311,7 @@ if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT) Fkill_emacs (make_number (sig)); - shut_down_emacs (sig, 0, Qnil); + shut_down_emacs (sig, Qnil); } /* Signal the same code; this time it will really be fatal. @@ -568,7 +568,7 @@ Too bad we can't just use getopt for all of this, but we don't have enough information to do it right. */ -static int +static bool argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr) { @@ -675,12 +675,12 @@ Lisp_Object dummy; #endif char stack_bottom_variable; - int do_initial_setlocale; + bool do_initial_setlocale; int skip_args = 0; #ifdef HAVE_SETRLIMIT struct rlimit rlim; #endif - int no_loadup = 0; + bool no_loadup = 0; char *junk = 0; char *dname_arg = 0; #ifdef NS_IMPL_COCOA @@ -1955,7 +1955,7 @@ x_clipboard_manager_save_all (); #endif - shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil); + shut_down_emacs (0, STRINGP (arg) ? arg : Qnil); #ifdef HAVE_NS ns_release_autorelease_pool (ns_pool); @@ -1991,7 +1991,7 @@ and Fkill_emacs. */ void -shut_down_emacs (int sig, int no_x, Lisp_Object stuff) +shut_down_emacs (int sig, Lisp_Object stuff) { /* Prevent running of hooks from now on. */ Vrun_hooks = Qnil; @@ -2026,17 +2026,6 @@ unlock_all_files (); #endif -#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */ -#ifdef HAVE_X_WINDOWS - /* It's not safe to call intern here. Maybe we are crashing. */ - if (!noninteractive && SYMBOLP (Vinitial_window_system) - && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1 - && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x' - && ! no_x) - Fx_close_current_connection (); -#endif /* HAVE_X_WINDOWS */ -#endif - #ifdef SIGIO /* There is a tendency for a SIGIO signal to arrive within exit, and cause a SIGHUP because the input descriptor is already closed. */ @@ -2228,7 +2217,7 @@ const char *path, *p; Lisp_Object lpath, element, tem; #ifdef WINDOWSNT - int defaulted = 0; + bool defaulted = 0; const char *emacs_dir = egetenv ("emacs_dir"); static const char *emacs_dir_env = "%emacs_dir%/"; const size_t emacs_dir_len = strlen (emacs_dir_env); @@ -2324,7 +2313,7 @@ (void) { int nfd; - int err = 0; + bool err = 0; if (!IS_DAEMON) error ("This function can only be called if emacs is run as a daemon"); === modified file 'src/eval.c' --- src/eval.c 2012-09-02 16:56:31 +0000 +++ src/eval.c 2012-09-02 17:10:35 +0000 @@ -131,7 +131,7 @@ Lisp_Object inhibit_lisp_code; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static int interactive_p (int); +static bool interactive_p (void); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); /* Functions to set Lisp_Object slots of struct specbinding. */ @@ -194,7 +194,7 @@ static Lisp_Object call_debugger (Lisp_Object arg) { - int debug_while_redisplaying; + bool debug_while_redisplaying; ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object val; EMACS_INT old_max = max_specpdl_size; @@ -525,7 +525,7 @@ use `called-interactively-p'. */) (void) { - return interactive_p (1) ? Qt : Qnil; + return interactive_p () ? Qt : Qnil; } @@ -550,19 +550,17 @@ \(not (or executing-kbd-macro noninteractive)). */) (Lisp_Object kind) { - return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) - && interactive_p (1)) ? Qt : Qnil; + return (((INTERACTIVE || !EQ (kind, intern ("interactive"))) + && interactive_p ()) + ? Qt : Qnil); } -/* Return 1 if function in which this appears was called using - call-interactively. - - EXCLUDE_SUBRS_P non-zero means always return 0 if the function - called is a built-in. */ - -static int -interactive_p (int exclude_subrs_p) +/* Return true if function in which this appears was called using + call-interactively and is not a built-in. */ + +static bool +interactive_p (void) { struct backtrace *btp; Lisp_Object fun; @@ -591,9 +589,9 @@ /* `btp' now points at the frame of the innermost function that isn't a special form, ignoring frames for Finteractive_p and/or Fbytecode at the top. If this frame is for a built-in function - (such as load or eval-region) return nil. */ + (such as load or eval-region) return false. */ fun = Findirect_function (*btp->function, Qnil); - if (exclude_subrs_p && SUBRP (fun)) + if (SUBRP (fun)) return 0; /* `btp' points to the frame of a Lisp function that called interactive-p. @@ -1101,7 +1099,7 @@ static _Noreturn void unwind_to_catch (struct catchtag *catch, Lisp_Object value) { - int last_time; + bool last_time; /* Save the value in the tag. */ catch->val = value; @@ -1450,8 +1448,8 @@ static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); -static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, - Lisp_Object data); +static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, + Lisp_Object data); void process_quit_flag (void) @@ -1556,7 +1554,7 @@ if requested". */ || EQ (h->handler, Qerror))) { - int debugger_called + bool debugger_called = maybe_call_debugger (conditions, error_symbol, data); /* We can't return values to code which signaled an error, but we can continue code which has signaled a quit. */ @@ -1650,10 +1648,10 @@ } -/* Return nonzero if LIST is a non-nil atom or +/* Return true if LIST is a non-nil atom or a list containing one of CONDITIONS. */ -static int +static bool wants_debugger (Lisp_Object list, Lisp_Object conditions) { if (NILP (list)) @@ -1673,15 +1671,15 @@ return 0; } -/* Return 1 if an error with condition-symbols CONDITIONS, +/* Return true if an error with condition-symbols CONDITIONS, and described by SIGNAL-DATA, should skip the debugger according to debugger-ignored-errors. */ -static int +static bool skip_debugger (Lisp_Object conditions, Lisp_Object data) { Lisp_Object tail; - int first_string = 1; + bool first_string = 1; Lisp_Object error_message; error_message = Qnil; @@ -1716,7 +1714,7 @@ = SIG is the error symbol, and DATA is the rest of the data. = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). This is for memory-full errors only. */ -static int +static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) { Lisp_Object combined_data; @@ -2939,7 +2937,7 @@ Lisp_Object val, syms_left, next, lexenv; ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t i; - int optional, rest; + bool optional, rest; if (CONSP (fun)) { @@ -3342,13 +3340,13 @@ write_string ("(", -1); if (backlist->nargs == MANY) { /* FIXME: Can this happen? */ - int i; - for (tail = *backlist->args, i = 0; - !NILP (tail); - tail = Fcdr (tail), i = 1) + bool later_arg = 0; + for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail)) { - if (i) write_string (" ", -1); + if (later_arg) + write_string (" ", -1); Fprin1 (Fcar (tail), Qnil); + later_arg = 1; } } else === modified file 'src/firstfile.c' --- src/firstfile.c 2012-01-19 07:21:25 +0000 +++ src/firstfile.c 2012-09-02 17:10:35 +0000 @@ -27,7 +27,6 @@ char * my_begbss_static = _my_begbss; /* Add a dummy reference to ensure emacs.obj is linked in. */ -extern int initialized; -static int * dummy = &initialized; +extern int main (int, char **); +static int (*dummy) (int, char **) = main; #endif - === modified file 'src/lisp.h' --- src/lisp.h 2012-09-02 16:56:31 +0000 +++ src/lisp.h 2012-09-02 17:10:35 +0000 @@ -3258,7 +3258,7 @@ extern char **initial_argv; extern int initial_argc; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) -extern int display_arg; +extern bool display_arg; #endif extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; @@ -3277,22 +3277,26 @@ #define synchronize_system_messages_locale() #define synchronize_system_time_locale() #endif -void shut_down_emacs (int, int, Lisp_Object); -/* Nonzero means don't do interactive redisplay and don't change tty modes. */ -extern int noninteractive; - -/* Nonzero means remove site-lisp directories from load-path. */ -extern int no_site_lisp; +extern void shut_down_emacs (int, Lisp_Object); + +/* True means don't do interactive redisplay and don't change tty modes. */ +extern bool noninteractive; + +/* True means remove site-lisp directories from load-path. */ +extern bool no_site_lisp; /* Pipe used to send exit notification to the daemon parent at startup. */ extern int daemon_pipe[2]; #define IS_DAEMON (daemon_pipe[1] != 0) -/* Nonzero means don't do use window-system-specific display code. */ -extern int inhibit_window_system; -/* Nonzero means that a filter or a sentinel is running. */ -extern int running_asynch_code; +/* True if handling a fatal error already. */ +extern bool fatal_error_in_progress; + +/* True means don't do use window-system-specific display code. */ +extern bool inhibit_window_system; +/* True means that a filter or a sentinel is running. */ +extern bool running_asynch_code; /* Defined in process.c. */ extern Lisp_Object QCtype, Qlocal; @@ -3514,9 +3518,9 @@ extern char *emacs_root_dir (void); #endif /* DOS_NT */ -/* Nonzero means Emacs has already been initialized. +/* True means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ -extern int initialized; +extern bool initialized; extern int immediate_quit; /* Nonzero means ^G can quit instantly */ === modified file 'src/msdos.c' --- src/msdos.c 2012-08-21 10:21:04 +0000 +++ src/msdos.c 2012-09-02 17:10:35 +0000 @@ -1029,7 +1029,6 @@ { char *spaces, *sp; int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); - extern int fatal_error_in_progress; struct tty_display_info *tty = FRAME_TTY (f); if (new_pos_X >= first_unused || fatal_error_in_progress) === modified file 'src/process.c' --- src/process.c 2012-09-02 16:56:31 +0000 +++ src/process.c 2012-09-02 17:10:35 +0000 @@ -5194,7 +5194,7 @@ if (!NILP (outstream)) { Lisp_Object text; - int outer_running_asynch_code = running_asynch_code; + bool outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; /* No need to gcpro these, because all we do with them later @@ -6558,9 +6558,9 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason) { Lisp_Object sentinel, odeactivate; - register struct Lisp_Process *p = XPROCESS (proc); + struct Lisp_Process *p = XPROCESS (proc); ptrdiff_t count = SPECPDL_INDEX (); - int outer_running_asynch_code = running_asynch_code; + bool outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; if (inhibit_sentinels) === modified file 'src/w32.c' --- src/w32.c 2012-08-26 10:29:37 +0000 +++ src/w32.c 2012-09-02 17:10:35 +0000 @@ -6773,7 +6773,7 @@ || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */ { /* Shut down cleanly, making sure autosave files are up to date. */ - shut_down_emacs (0, 0, Qnil); + shut_down_emacs (0, Qnil); } /* Allow other handlers to handle this signal. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2012-08-28 05:49:02 +0000 +++ src/xdisp.c 2012-09-02 17:10:35 +0000 @@ -768,9 +768,9 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; #endif -/* Non-zero while redisplay_internal is in progress. */ +/* True while redisplay_internal is in progress. */ -int redisplaying_p; +bool redisplaying_p; static Lisp_Object Qinhibit_free_realized_faces; static Lisp_Object Qmode_line_default_help_echo; @@ -12966,12 +12966,11 @@ if (redisplaying_p) return; - /* Record a function that resets redisplaying_p to its old value + /* Record a function that clears redisplaying_p when we leave this function. */ count = SPECPDL_INDEX (); - record_unwind_protect (unwind_redisplay, - Fcons (make_number (redisplaying_p), selected_frame)); - ++redisplaying_p; + record_unwind_protect (unwind_redisplay, selected_frame); + redisplaying_p = 1; specbind (Qinhibit_free_realized_faces, Qnil); { @@ -13709,21 +13708,15 @@ } -/* Function registered with record_unwind_protect in - redisplay_internal. Reset redisplaying_p to the value it had - before redisplay_internal was called, and clear - prevent_freeing_realized_faces_p. It also selects the previously +/* Function registered with record_unwind_protect in redisplay_internal. + Clear redisplaying_p. Also, select the previously selected frame, unless it has been deleted (by an X connection failure during redisplay, for example). */ static Lisp_Object -unwind_redisplay (Lisp_Object val) +unwind_redisplay (Lisp_Object old_frame) { - Lisp_Object old_redisplaying_p, old_frame; - - old_redisplaying_p = XCAR (val); - redisplaying_p = XFASTINT (old_redisplaying_p); - old_frame = XCDR (val); + redisplaying_p = 0; if (! EQ (old_frame, selected_frame) && FRAME_LIVE_P (XFRAME (old_frame))) select_frame_for_redisplay (old_frame); === modified file 'src/xterm.c' --- src/xterm.c 2012-09-02 16:56:31 +0000 +++ src/xterm.c 2012-09-02 17:10:35 +0000 @@ -7843,7 +7843,7 @@ (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once, the resulting Glib error message loop filled a user's disk. To avoid this, kill Emacs unconditionally on disconnect. */ - shut_down_emacs (0, 0, Qnil); + shut_down_emacs (0, Qnil); fprintf (stderr, "%s\n\ When compiled with GTK, Emacs cannot recover from X disconnects.\n\ This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ ------------------------------------------------------------ revno: 109860 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-02 09:56:31 -0700 message: Clean up some extern decls. Mostly, this hoists extern decls out of .c files and into .h files. That way, we're more likely to catch errors if the interfaces change. * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not declare xg_mark_data. * dispextern.h (x_frame_parm_handlers): * font.h (Qxft): * lisp.h (Qlexical_binding, Qinternal_interpreter_environment) (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold) (Qultra_bold, Qoblique, Qitalic): Move extern decl here from .c file. * alloc.c (xg_mark_data) [USE_GTK]: * doc.c (Qclosure): * eval.c (Qlexical_binding): * fns.c (time) [!HAVE_UNISTD_H]: * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light) (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic): * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]: * lread.c (Qinternal_interpreter_environment): * minibuf.c (Qbuffer): * process.c (QCfamily, QCfilter): * widget.c (free_frame_faces): * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]: * xfont.c (x_clear_errors): * xterm.c (x_frame_parm_handlers): Remove now-redundant extern decls. * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]: * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic): Now static. * xfaces.c: Remove unnecessary static decls. * xterm.c (updating_frame): Remove decl of nonexistent object. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 14:26:47 +0000 +++ src/ChangeLog 2012-09-02 16:56:31 +0000 @@ -1,5 +1,37 @@ 2012-09-02 Paul Eggert + Clean up some extern decls. + Mostly, this hoists extern decls out of .c files and into .h files. + That way, we're more likely to catch errors if the interfaces change. + * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not + declare xg_mark_data. + * dispextern.h (x_frame_parm_handlers): + * font.h (Qxft): + * lisp.h (Qlexical_binding, Qinternal_interpreter_environment) + (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold) + (Qultra_bold, Qoblique, Qitalic): + Move extern decl here from .c file. + * alloc.c (xg_mark_data) [USE_GTK]: + * doc.c (Qclosure): + * eval.c (Qlexical_binding): + * fns.c (time) [!HAVE_UNISTD_H]: + * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light) + (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic): + * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]: + * lread.c (Qinternal_interpreter_environment): + * minibuf.c (Qbuffer): + * process.c (QCfamily, QCfilter): + * widget.c (free_frame_faces): + * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]: + * xfont.c (x_clear_errors): + * xterm.c (x_frame_parm_handlers): + Remove now-redundant extern decls. + * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]: + * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic): + Now static. + * xfaces.c: Remove unnecessary static decls. + * xterm.c (updating_frame): Remove decl of nonexistent object. + * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS) when building globals.h, as the objects that are not built on this host are not needed to compile C files on this host. === modified file 'src/alloc.c' --- src/alloc.c 2012-08-31 10:53:19 +0000 +++ src/alloc.c 2012-09-02 16:56:31 +0000 @@ -69,6 +69,9 @@ #include +#ifdef USE_GTK +# include "gtkutil.h" +#endif #ifdef WINDOWSNT #include "w32.h" #endif @@ -5478,10 +5481,7 @@ mark_kboards (); #ifdef USE_GTK - { - extern void xg_mark_data (void); - xg_mark_data (); - } + xg_mark_data (); #endif #if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \ === modified file 'src/dispextern.h' --- src/dispextern.h 2012-08-28 00:33:56 +0000 +++ src/dispextern.h 2012-09-02 16:56:31 +0000 @@ -3251,9 +3251,12 @@ extern Lisp_Object tip_frame; extern Window tip_window; +extern frame_parm_handler x_frame_parm_handlers[]; + extern void start_hourglass (void); extern void cancel_hourglass (void); extern int hourglass_shown_p; + struct atimer; /* Defined in atimer.h. */ /* If non-null, an asynchronous timer that, when it expires, displays an hourglass cursor on all frames. */ === modified file 'src/doc.c' --- src/doc.c 2012-09-02 07:10:10 +0000 +++ src/doc.c 2012-09-02 16:56:31 +0000 @@ -37,7 +37,6 @@ Lisp_Object Qfunction_documentation; -extern Lisp_Object Qclosure; /* Buffer used for reading from documentation file. */ static char *get_doc_string_buffer; static ptrdiff_t get_doc_string_buffer_size; === modified file 'src/eval.c' --- src/eval.c 2012-08-28 16:01:59 +0000 +++ src/eval.c 2012-09-02 16:56:31 +0000 @@ -2232,7 +2232,6 @@ if (EQ (funcar, Qmacro)) { ptrdiff_t count = SPECPDL_INDEX (); - extern Lisp_Object Qlexical_binding; Lisp_Object exp; /* Bind lexical-binding during expansion of the macro, so the macro can know reliably if the code it outputs will be === modified file 'src/fns.c' --- src/fns.c 2012-09-01 01:04:26 +0000 +++ src/fns.c 2012-09-02 16:56:31 +0000 @@ -52,10 +52,6 @@ static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; static int internal_equal (Lisp_Object , Lisp_Object, int, int); - -#ifndef HAVE_UNISTD_H -extern long time (); -#endif DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, doc: /* Return the argument unchanged. */) === modified file 'src/font.h' --- src/font.h 2012-08-16 06:35:13 +0000 +++ src/font.h 2012-09-02 16:56:31 +0000 @@ -817,6 +817,7 @@ extern void syms_of_xfont (void); extern void syms_of_ftxfont (void); #ifdef HAVE_XFT +extern Lisp_Object Qxft; extern struct font_driver xftfont_driver; extern void syms_of_xftfont (void); #elif defined HAVE_FREETYPE === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-08-30 16:07:44 +0000 +++ src/gtkutil.c 2012-09-02 16:56:31 +0000 @@ -2019,11 +2019,6 @@ #if USE_NEW_GTK_FONT_CHOOSER -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; - #define XG_WEIGHT_TO_SYMBOL(w) \ (w <= PANGO_WEIGHT_THIN ? Qextra_light \ : w <= PANGO_WEIGHT_ULTRALIGHT ? Qlight \ === modified file 'src/image.c' --- src/image.c 2012-09-01 09:29:17 +0000 +++ src/image.c 2012-09-02 16:56:31 +0000 @@ -570,7 +570,6 @@ static int x_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); #ifdef HAVE_NTGUI -extern Lisp_Object Vlibrary_cache, QCloaded_from; #define CACHE_IMAGE_TYPE(type, status) \ do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) #else === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-02 07:10:10 +0000 +++ src/keyboard.c 2012-09-02 16:56:31 +0000 @@ -1315,7 +1315,7 @@ If ignore_mouse_drag_p is non-zero, ignore (implicit) mouse movement after resizing the tool-bar window. */ -#if !defined HAVE_WINDOW_SYSTEM +#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS static #endif int ignore_mouse_drag_p; === modified file 'src/keyboard.h' --- src/keyboard.h 2012-09-01 06:38:52 +0000 +++ src/keyboard.h 2012-09-02 16:56:31 +0000 @@ -469,7 +469,7 @@ happens. */ extern EMACS_TIME *input_available_clear_time; -#if defined HAVE_WINDOW_SYSTEM +#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS extern int ignore_mouse_drag_p; #endif === modified file 'src/lisp.h' --- src/lisp.h 2012-09-02 07:10:10 +0000 +++ src/lisp.h 2012-09-02 16:56:31 +0000 @@ -2988,6 +2988,7 @@ /* Defined in lread.c. */ extern Lisp_Object Qvariable_documentation, Qstandard_input; extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; +extern Lisp_Object Qlexical_binding; extern Lisp_Object check_obarray (Lisp_Object); extern Lisp_Object intern_1 (const char *, ptrdiff_t); extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t); @@ -3021,7 +3022,7 @@ /* Defined in eval.c. */ extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro; -extern Lisp_Object Qinhibit_quit, Qclosure; +extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure; extern Lisp_Object Qand_rest; extern Lisp_Object Vautoload_queue; extern Lisp_Object Vsignaling_function; @@ -3466,6 +3467,9 @@ extern Lisp_Object Qnormal; extern Lisp_Object QCfamily, QCweight, QCslant; extern Lisp_Object QCheight, QCname, QCwidth, QCforeground, QCbackground; +extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold; +extern Lisp_Object Qbold, Qextra_bold, Qultra_bold; +extern Lisp_Object Qoblique, Qitalic; extern Lisp_Object Vface_alternative_font_family_alist; extern Lisp_Object Vface_alternative_font_registry_alist; extern void syms_of_xfaces (void); === modified file 'src/lread.c' --- src/lread.c 2012-08-30 00:47:33 +0000 +++ src/lread.c 2012-09-02 16:56:31 +0000 @@ -89,8 +89,6 @@ static Lisp_Object Qload_force_doc_strings; -extern Lisp_Object Qinternal_interpreter_environment; - static Lisp_Object Qload_in_progress; /* The association list of objects read with the #n=object form. === modified file 'src/minibuf.c' --- src/minibuf.c 2012-08-28 06:20:08 +0000 +++ src/minibuf.c 2012-09-02 16:56:31 +0000 @@ -1860,7 +1860,6 @@ } static Lisp_Object Qmetadata; -extern Lisp_Object Qbuffer; DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0, doc: /* Perform completion on buffer names. === modified file 'src/process.c' --- src/process.c 2012-09-01 06:38:52 +0000 +++ src/process.c 2012-09-02 16:56:31 +0000 @@ -165,16 +165,6 @@ static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; static Lisp_Object QCsentinel, QClog, QCoptions, QCplist; static Lisp_Object Qlast_nonmenu_event; -/* QCfamily is declared and initialized in xfaces.c, - QCfilter in keyboard.c. */ -extern Lisp_Object QCfamily, QCfilter; - -/* Qexit is declared and initialized in eval.c. */ - -/* QCfamily is defined in xfaces.c. */ -extern Lisp_Object QCfamily; -/* QCfilter is defined in keyboard.c. */ -extern Lisp_Object QCfilter; #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) #define NETCONN1_P(p) (EQ (p->type, Qnetwork)) === modified file 'src/widget.c' --- src/widget.c 2012-07-10 21:48:34 +0000 +++ src/widget.c 2012-09-02 16:56:31 +0000 @@ -671,8 +671,6 @@ update_wm_hints (ew); } -extern void free_frame_faces (struct frame *); - static void EmacsFrameDestroy (Widget widget) { === modified file 'src/xfaces.c' --- src/xfaces.c 2012-09-01 06:38:52 +0000 +++ src/xfaces.c 2012-09-02 16:56:31 +0000 @@ -315,9 +315,10 @@ Lisp_Object Qnormal; Lisp_Object Qbold; static Lisp_Object Qline, Qwave; -Lisp_Object Qultra_light, Qextra_light, Qlight; +static Lisp_Object Qultra_light, Qreverse_oblique, Qreverse_italic; +Lisp_Object Qextra_light, Qlight; Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold; -Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic; +Lisp_Object Qoblique; Lisp_Object Qitalic; static Lisp_Object Qultra_condensed, Qextra_condensed; Lisp_Object Qcondensed; @@ -452,18 +453,7 @@ struct table_entry; struct named_merge_point; -static void map_tty_color (struct frame *, struct face *, - enum lface_attribute_index, int *); -static Lisp_Object resolve_face_name (Lisp_Object, int); static void set_font_frame_param (Lisp_Object, Lisp_Object); -static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *, - int, struct named_merge_point *); -static ptrdiff_t load_pixmap (struct frame *, Lisp_Object, - unsigned *, unsigned *); -static struct frame *frame_or_selected_frame (Lisp_Object, int); -static void load_face_colors (struct frame *, struct face *, Lisp_Object *); -static void free_face_colors (struct frame *, struct face *); -static int face_color_gray_p (struct frame *, const char *); static struct face *realize_face (struct face_cache *, Lisp_Object *, int); static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, @@ -473,38 +463,11 @@ static int realize_basic_faces (struct frame *); static int realize_default_face (struct frame *); static void realize_named_face (struct frame *, Lisp_Object, int); -static int lface_fully_specified_p (Lisp_Object *); -static int lface_equal_p (Lisp_Object *, Lisp_Object *); -static unsigned hash_string_case_insensitive (Lisp_Object); -static unsigned lface_hash (Lisp_Object *); -static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *); static struct face_cache *make_face_cache (struct frame *); static void clear_face_gcs (struct face_cache *); static void free_face_cache (struct face_cache *); -static int face_fontset (Lisp_Object *); -static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*, - struct named_merge_point *); static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, int, struct named_merge_point *); -static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object, - int); -static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int); -static struct face *make_realized_face (Lisp_Object *); -static void cache_face (struct face_cache *, struct face *, unsigned); -static void uncache_face (struct face_cache *, struct face *); - -#ifdef HAVE_WINDOW_SYSTEM - -static GC x_create_gc (struct frame *, unsigned long, XGCValues *); -static void x_free_gc (struct frame *, GC); - -#ifdef USE_X_TOOLKIT -static void x_update_menu_appearance (struct frame *); - -extern void free_frame_menubar (struct frame *); -#endif /* USE_X_TOOLKIT */ - -#endif /* HAVE_WINDOW_SYSTEM */ /*********************************************************************** === modified file 'src/xfont.c' --- src/xfont.c 2012-08-21 10:21:04 +0000 +++ src/xfont.c 2012-09-02 16:56:31 +0000 @@ -46,7 +46,6 @@ }; /* Prototypes of support functions. */ -extern void x_clear_errors (Display *); static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *); === modified file 'src/xterm.c' --- src/xterm.c 2012-08-25 20:31:04 +0000 +++ src/xterm.c 2012-09-02 16:56:31 +0000 @@ -165,13 +165,6 @@ Lisp_Object x_display_name_list; -/* Frame being updated by update_frame. This is declared in term.c. - This is set by update_begin and looked at by all the XT functions. - It is zero while not inside an update. In that case, the XT - functions assume that `selected_frame' is the frame to apply to. */ - -extern struct frame *updating_frame; - /* This is a frame waiting to be auto-raised, within XTread_socket. */ static struct frame *pending_autoraise_frame; @@ -10609,8 +10602,6 @@ /* Set up use of X before we make the first connection. */ -extern frame_parm_handler x_frame_parm_handlers[]; - static struct redisplay_interface x_redisplay_interface = { x_frame_parm_handlers, ------------------------------------------------------------ revno: 109859 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-02 07:26:47 -0700 message: * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS) when building globals.h, as the objects that are not built on this host are not needed to compile C files on this host. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 10:53:46 +0000 +++ src/ChangeLog 2012-09-02 14:26:47 +0000 @@ -1,3 +1,9 @@ +2012-09-02 Paul Eggert + + * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS) + when building globals.h, as the objects that are not built on + this host are not needed to compile C files on this host. + 2012-09-02 Jan Djärv * gtkutil.h: Remove prototype for x_wm_set_size_hint. === modified file 'src/Makefile.in' --- src/Makefile.in 2012-09-01 06:38:52 +0000 +++ src/Makefile.in 2012-09-02 14:26:47 +0000 @@ -448,7 +448,7 @@ gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES) @rm -f gl-tmp - $(libsrc)/make-docfile -d $(srcdir) -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp + $(libsrc)/make-docfile -d $(srcdir) -g $(obj) > gl-tmp $(srcdir)/../build-aux/move-if-change gl-tmp globals.h echo timestamp > $@ ------------------------------------------------------------ revno: 109858 fixes bug: http://debbugs.gnu.org/12332 committer: Jan D. branch nick: trunk timestamp: Sun 2012-09-02 13:13:24 +0200 message: * configure.ac (HAVE_GOBJECT): Check for gobject-2.0. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-01 18:54:38 +0000 +++ ChangeLog 2012-09-02 11:13:24 +0000 @@ -1,3 +1,7 @@ +2012-09-02 Jan Djärv + + * configure.ac (HAVE_GOBJECT): Check for gobject-2.0 (Bug#12332). + 2012-09-01 Paul Eggert * configure.ac (_FORTIFY_SOURCE): Define only when optimizing. === modified file 'configure.ac' --- configure.ac 2012-09-01 18:54:38 +0000 +++ configure.ac 2012-09-02 11:13:24 +0000 @@ -2053,6 +2053,11 @@ fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then + PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no) + if test "$HAVE_GOBJECT" = "yes"; then + SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" + SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" + fi SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" CFLAGS="$SETTINGS_CFLAGS $CFLAGS" ------------------------------------------------------------ revno: 109857 committer: Jan D. branch nick: trunk timestamp: Sun 2012-09-02 12:53:46 +0200 message: Prototype for x_wm_set_size_hint restored. * frame.h: Add missing prototype for x_wm_set_size_hint. * gtkutil.h: Remove prototype for x_wm_set_size_hint. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 07:10:10 +0000 +++ src/ChangeLog 2012-09-02 10:53:46 +0000 @@ -1,3 +1,9 @@ +2012-09-02 Jan Djärv + + * gtkutil.h: Remove prototype for x_wm_set_size_hint. + + * frame.h: Add missing prototype for x_wm_set_size_hint. + 2012-09-02 Paul Eggert * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean. === modified file 'src/frame.h' --- src/frame.h 2012-09-01 06:38:52 +0000 +++ src/frame.h 2012-09-02 10:53:46 +0000 @@ -1206,6 +1206,7 @@ extern void x_set_scroll_bar_default_width (struct frame *); extern void x_set_offset (struct frame *, int, int, int); extern void x_wm_set_icon_position (struct frame *, int, int); +extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position); extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); === modified file 'src/gtkutil.h' --- src/gtkutil.h 2012-09-01 06:38:52 +0000 +++ src/gtkutil.h 2012-09-02 10:53:46 +0000 @@ -150,9 +150,6 @@ extern int xg_create_frame_widgets (FRAME_PTR f); extern void xg_free_frame_widgets (FRAME_PTR f); -extern void x_wm_set_size_hint (FRAME_PTR f, - long flags, - int user_position); extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); extern int xg_check_special_colors (struct frame *f, const char *color_name, ------------------------------------------------------------ revno: 109856 committer: Glenn Morris branch nick: trunk timestamp: Sun 2012-09-02 06:19:02 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2012-09-01 10:17:31 +0000 +++ autogen/config.in 2012-09-02 10:19:02 +0000 @@ -161,6 +161,13 @@ or signaling SIGFPE/SIGILL. */ #undef FLOAT_CHECK_DOMAIN +/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + + /* Define to 1 if futimesat mishandles a NULL file name. */ #undef FUTIMESAT_NULL_BUG @@ -1458,9 +1465,6 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* enable compile-time and run-time bounds-checking, and some warnings */ -#undef _FORTIFY_SOURCE - /* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct stat.st_size becomes 64-bit. */ #undef _GL_WINDOWS_64_BIT_ST_SIZE === modified file 'autogen/configure' --- autogen/configure 2012-09-01 10:17:31 +0000 +++ autogen/configure 2012-09-02 10:19:02 +0000 @@ -7784,8 +7784,6 @@ $as_echo "#define lint 1" >>confdefs.h -$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h - $as_echo "#define GNULIB_PORTCHECK 1" >>confdefs.h ------------------------------------------------------------ revno: 109855 committer: Michael Albinus branch nick: trunk timestamp: Sun 2012-09-02 11:57:19 +0200 message: * eshell/em-unix.el (eshell/sudo): When we have an ad-hoc remote definition of `default-directory', ensure we can connect. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-02 09:31:45 +0000 +++ lisp/ChangeLog 2012-09-02 09:57:19 +0000 @@ -1,3 +1,8 @@ +2012-09-02 Michael Albinus + + * eshell/em-unix.el (eshell/sudo): When we have an ad-hoc + remote definition of `default-directory', ensure we can connect. + 2012-09-02 Juri Linkov Toggle whitespace matching mode with M-s SPC. === modified file 'lisp/eshell/em-unix.el' --- lisp/eshell/em-unix.el 2012-07-16 11:42:01 +0000 +++ lisp/eshell/em-unix.el 2012-09-02 09:57:19 +0000 @@ -1110,6 +1110,8 @@ (format "%s|sudo:%s@%s:%s" (substring prefix 0 -1) user host dir) (format "/sudo:%s@%s:%s" user host dir)))) + ;; Ensure, that Tramp has connected to that construct already. + (file-exists-p default-directory) (eshell-named-command (car orig-args) (cdr orig-args)))))))) (put 'eshell/sudo 'eshell-no-numeric-conversions t) ------------------------------------------------------------ revno: 109854 committer: Juri Linkov branch nick: trunk timestamp: Sun 2012-09-02 12:31:45 +0300 message: Toggle whitespace matching mode with M-s SPC. http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html * lisp/isearch.el (search-whitespace-regexp): Doc fix. Remove cons cell customization. (isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace. (isearch-lax-whitespace, isearch-regexp-lax-whitespace): New variables. (isearch-forward, isearch-forward-regexp): Doc fix. (isearch-toggle-lax-whitespace): New command. (search-forward-lax-whitespace, search-backward-lax-whitespace) (re-search-forward-lax-whitespace) (re-search-backward-lax-whitespace): New functions. (isearch-whitespace-regexp): Remove function. (isearch-query-replace): Let-bind replace-search-function and replace-re-search-function. (isearch-occur): Let-bind search-spaces-regexp according to the value of isearch-lax-whitespace and isearch-regexp-lax-whitespace. (isearch-quote-char): Check isearch-regexp-lax-whitespace in the condition for C-q SPC. (isearch-search-fun-default): Use new functions mentioned above. (isearch-search-forward, isearch-search-backward): Remove functions. (isearch-search): Don't let-bind search-spaces-regexp. (isearch-lazy-highlight-space-regexp): Remove variable. (isearch-lazy-highlight-lax-whitespace) (isearch-lazy-highlight-regexp-lax-whitespace): New variables. (isearch-lazy-highlight-new-loop): Use them. (isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-02 02:30:06 +0000 +++ etc/NEWS 2012-09-02 09:31:45 +0000 @@ -183,12 +183,14 @@ and `M-s _' in Isearch toggles symbol search mode. `M-s c' in Isearch toggles search case-sensitivity. -*** `search-whitespace-regexp' now acts on ordinary incremental search -as well, so that each sequence of spaces in the search string matches -any combination of one or more whitespace characters. To change this -behavior, you can give `search-whitespace-regexp' a cons cell value, -where the car and cdr specify values for ordinary and regular -expression incremental search respectively. +*** `M-s SPC' in Isearch toggles whitespace matching mode +in both ordinary and regexp incremental search, so that each +sequence of spaces in the search string matches any combination +of one or more whitespace characters defined by the variable +`search-whitespace-regexp'. In ordinary incremental search, +`isearch-toggle-lax-whitespace' toggles the value of the variable +`isearch-lax-whitespace'. In regexp incremental search, it toggles +the value of the variable `isearch-regexp-lax-whitespace'. ** M-x move-to-column, if called interactively with no prefix arg, now prompts for a column number. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-02 02:47:02 +0000 +++ lisp/ChangeLog 2012-09-02 09:31:45 +0000 @@ -1,3 +1,34 @@ +2012-09-02 Juri Linkov + + Toggle whitespace matching mode with M-s SPC. + http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html + + * isearch.el (search-whitespace-regexp): Doc fix. + Remove cons cell customization. + (isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace. + (isearch-lax-whitespace, isearch-regexp-lax-whitespace): + New variables. + (isearch-forward, isearch-forward-regexp): Doc fix. + (isearch-toggle-lax-whitespace): New command. + (search-forward-lax-whitespace, search-backward-lax-whitespace) + (re-search-forward-lax-whitespace) + (re-search-backward-lax-whitespace): New functions. + (isearch-whitespace-regexp): Remove function. + (isearch-query-replace): Let-bind replace-search-function and + replace-re-search-function. + (isearch-occur): Let-bind search-spaces-regexp according to the + value of isearch-lax-whitespace and isearch-regexp-lax-whitespace. + (isearch-quote-char): Check isearch-regexp-lax-whitespace in the + condition for C-q SPC. + (isearch-search-fun-default): Use new functions mentioned above. + (isearch-search-forward, isearch-search-backward): Remove functions. + (isearch-search): Don't let-bind search-spaces-regexp. + (isearch-lazy-highlight-space-regexp): Remove variable. + (isearch-lazy-highlight-lax-whitespace) + (isearch-lazy-highlight-regexp-lax-whitespace): New variables. + (isearch-lazy-highlight-new-loop): Use them. + (isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp. + 2012-09-02 Chong Yidong * dired.el (dired-mode-map): Menu string fixes (Bug#11616). === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-08-26 04:08:32 +0000 +++ lisp/isearch.el 2012-09-02 09:31:45 +0000 @@ -116,24 +116,16 @@ spaces are treated normally in regexp incremental search if they occur in a regexp construct like [...] or *, + or ?. -If the value is a string, it applies to both ordinary and regexp -incremental search. If the value is nil, each space you type -matches literally, against one space. - -The value can also be a cons cell (REGEXP-1 . REGEXP-2). In that -case, REGEXP-1 is used as the value for ordinary incremental -search, and REGEXP-2 is used for regexp incremental search. +If the value is a string, it applies to both ordinary and +regexp incremental search. If the value is nil, or +`isearch-lax-whitespace' is nil for ordinary incremental search, or +`isearch-regexp-lax-whitespace' is nil for regexp incremental search, +then each space you type matches literally, against one space. You might want to use something like \"[ \\t\\r\\n]+\" instead. In the Customization buffer, that is `[' followed by a space, a tab, a carriage return (control-M), a newline, and `]+'." - :type '(choice (const :tag "Treat Spaces Literally" nil) - (cons (choice :tag "For Ordinary Isearch" - regexp - (const :tag "Treat Spaces Literally" nil)) - (choice :tag "For Regexp Isearch" - regexp - (const :tag "Treat Spaces Literally" nil))) + :type '(choice (const :tag "Match Spaces Literally" nil) regexp) :group 'isearch :version "24.3") @@ -514,6 +506,7 @@ (define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sw" 'isearch-toggle-word) (define-key map "\M-s_" 'isearch-toggle-symbol) + (define-key map "\M-s " 'isearch-toggle-lax-whitespace) (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) @@ -556,6 +549,22 @@ The property `isearch-message-prefix' put on this function specifies the prefix string displayed in the search message.") +(defvar isearch-lax-whitespace t + "If non-nil, a space will match a sequence of whitespace chars. +When you enter a space or spaces in ordinary incremental search, it +will match any sequence matched by the regexp defined by the variable +`search-whitespace-regexp'. If the value is nil, each space you type +matches literally, against one space. You can toggle the value of this +variable by the command `isearch-toggle-lax-whitespace'.") + +(defvar isearch-regexp-lax-whitespace nil + "If non-nil, a space will match a sequence of whitespace chars. +When you enter a space or spaces in regexp incremental search, it +will match any sequence matched by the regexp defined by the variable +`search-whitespace-regexp'. If the value is nil, each space you type +matches literally, against one space. You can toggle the value of this +variable by the command `isearch-toggle-lax-whitespace'.") + (defvar isearch-cmds nil "Stack of search status sets. Each set is a vector of the form: @@ -681,6 +690,12 @@ Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-symbol] to toggle symbol mode. + +Type \\[isearch-toggle-lax-whitespace] to toggle whitespace matching. +In incremental searches, a space or spaces normally matches any whitespace +defined by the variable `search-whitespace-regexp'; see also the variables +`isearch-lax-whitespace' and `isearch-regexp-lax-whitespace'. + Type \\[isearch-edit-string] to edit the search string in the minibuffer. Also supported is a search ring of the previous 16 search strings. @@ -702,9 +717,6 @@ Type \\[isearch-describe-key] to display documentation of Isearch key. Type \\[isearch-describe-mode] to display documentation of Isearch mode. -In incremental searches, a space or spaces normally matches any -whitespace; see the variable `search-whitespace-regexp'. - If an input method is turned on in the current buffer, that input method is also active while you are typing characters to search. To toggle the input method, type \\[isearch-toggle-input-method]. \ @@ -734,8 +746,9 @@ as a regexp. See the command `isearch-forward' for more information. In incremental searches, a space or spaces normally matches any -whitespace; see the variable `search-whitespace-regexp'. To -search for a literal space and nothing else, enter C-q SPC." +whitespace defined by the variable `search-whitespace-regexp'. +To search for a literal space and nothing else, enter C-q SPC. +To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." (interactive "P\np") (isearch-mode t (null not-regexp) nil (not no-recursive-edit))) @@ -1395,6 +1408,28 @@ (setq isearch-success t isearch-adjusted t) (isearch-update)) +(defun isearch-toggle-lax-whitespace () + "Toggle whitespace matching in searching on or off. +In ordinary search, toggles the value of the variable +`isearch-lax-whitespace'. In regexp search, toggles the +value of the variable `isearch-regexp-lax-whitespace'." + (interactive) + (if isearch-regexp + (setq isearch-regexp-lax-whitespace (not isearch-regexp-lax-whitespace)) + (setq isearch-lax-whitespace (not isearch-lax-whitespace))) + (let ((message-log-max nil)) + (message "%s%s [%s]" + (isearch-message-prefix nil isearch-nonincremental) + isearch-message + (if (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace) + "match spaces loosely" + "match spaces literally"))) + (setq isearch-success t isearch-adjusted t) + (sit-for 1) + (isearch-update)) + (defun isearch-toggle-case-fold () "Toggle case folding in searching on or off." (interactive) @@ -1506,6 +1541,28 @@ (put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") +;; Search with lax whitespace + +(defun search-forward-lax-whitespace (string &optional bound noerror count) + "Search forward for STRING, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-forward (regexp-quote string) bound noerror count))) + +(defun search-backward-lax-whitespace (string &optional bound noerror count) + "Search backward for STRING, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-backward (regexp-quote string) bound noerror count))) + +(defun re-search-forward-lax-whitespace (regexp &optional bound noerror count) + "Search forward for REGEXP, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-forward regexp bound noerror count))) + +(defun re-search-backward-lax-whitespace (regexp &optional bound noerror count) + "Search backward for REGEXP, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-backward regexp bound noerror count))) + (defun isearch-query-replace (&optional delimited regexp-flag) "Start `query-replace' with string to replace from last search string. @@ -1522,6 +1579,14 @@ ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) + (replace-search-function + (if (and isearch-lax-whitespace (not regexp-flag)) + #'search-forward-lax-whitespace + replace-search-function)) + (replace-re-search-function + (if (and isearch-regexp-lax-whitespace regexp-flag) + #'re-search-forward-lax-whitespace + replace-re-search-function)) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. @@ -1558,15 +1623,6 @@ (list current-prefix-arg)) (isearch-query-replace delimited t)) -(defun isearch-whitespace-regexp () - "Return the value of `search-whitespace-regexp' for the current search." - (cond ((not (consp search-whitespace-regexp)) - search-whitespace-regexp) - (isearch-regexp - (cdr search-whitespace-regexp)) - (t - (car search-whitespace-regexp)))) - (defun isearch-occur (regexp &optional nlines) "Run `occur' using the last search string as the regexp. Interactively, REGEXP is constructed using the search string from the @@ -1606,7 +1662,11 @@ ;; Set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `occur-1'. (search-upper-case nil) - (search-spaces-regexp (isearch-whitespace-regexp))) + (search-spaces-regexp + (if (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace) + search-whitespace-regexp))) (occur regexp nlines))) (declare-function hi-lock-read-face-name "hi-lock" ()) @@ -2203,7 +2263,7 @@ ;; Assume character codes 0200 - 0377 stand for characters in some ;; single-byte character set, and convert them to Emacs ;; characters. - (if (and isearch-regexp (= char ?\s)) + (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s)) (if (subregexp-context-p isearch-string (length isearch-string)) (isearch-process-search-string "[ ]" " ") (isearch-process-search-char char)) @@ -2443,16 +2503,19 @@ (funcall isearch-word string lax) (word-search-regexp string lax)) bound noerror count)))) + ((and isearch-regexp isearch-regexp-lax-whitespace + search-whitespace-regexp) + (if isearch-forward + 're-search-forward-lax-whitespace + 're-search-backward-lax-whitespace)) (isearch-regexp (if isearch-forward 're-search-forward 're-search-backward)) + ((and isearch-lax-whitespace search-whitespace-regexp) + (if isearch-forward + 'search-forward-lax-whitespace + 'search-backward-lax-whitespace)) (t - (if isearch-forward 'isearch-search-forward 'isearch-search-backward)))) - -(defun isearch-search-forward (string &optional bound noerror count) - (re-search-forward (regexp-quote string) bound noerror count)) - -(defun isearch-search-backward (string &optional bound noerror count) - (re-search-backward (regexp-quote string) bound noerror count)) + (if isearch-forward 'search-forward 'search-backward)))) (defun isearch-search-string (string bound noerror) "Search for the first occurrence of STRING or its translation. @@ -2513,7 +2576,6 @@ search-invisible)) (inhibit-quit nil) (case-fold-search isearch-case-fold-search) - (search-spaces-regexp (isearch-whitespace-regexp)) (retry t)) (setq isearch-error nil) (while retry @@ -2805,7 +2867,8 @@ (defvar isearch-lazy-highlight-window-end nil) (defvar isearch-lazy-highlight-case-fold-search nil) (defvar isearch-lazy-highlight-regexp nil) -(defvar isearch-lazy-highlight-space-regexp nil) +(defvar isearch-lazy-highlight-lax-whitespace nil) +(defvar isearch-lazy-highlight-regexp-lax-whitespace nil) (defvar isearch-lazy-highlight-word nil) (defvar isearch-lazy-highlight-forward nil) (defvar isearch-lazy-highlight-error nil) @@ -2847,6 +2910,10 @@ isearch-regexp)) (not (eq isearch-lazy-highlight-word isearch-word)) + (not (eq isearch-lazy-highlight-lax-whitespace + isearch-lax-whitespace)) + (not (eq isearch-lazy-highlight-regexp-lax-whitespace + isearch-regexp-lax-whitespace)) (not (= (window-start) isearch-lazy-highlight-window-start)) (not (= (window-end) ; Window may have been split/joined. @@ -2873,7 +2940,8 @@ isearch-lazy-highlight-last-string isearch-string isearch-lazy-highlight-case-fold-search isearch-case-fold-search isearch-lazy-highlight-regexp isearch-regexp - isearch-lazy-highlight-space-regexp (isearch-whitespace-regexp) + isearch-lazy-highlight-lax-whitespace isearch-lax-whitespace + isearch-lazy-highlight-regexp-lax-whitespace isearch-regexp-lax-whitespace isearch-lazy-highlight-word isearch-word isearch-lazy-highlight-forward isearch-forward) (unless (equal isearch-string "") @@ -2887,7 +2955,6 @@ (condition-case nil (let ((case-fold-search isearch-lazy-highlight-case-fold-search) (isearch-regexp isearch-lazy-highlight-regexp) - (search-spaces-regexp isearch-lazy-highlight-space-regexp) (isearch-word isearch-lazy-highlight-word) (search-invisible nil) ; don't match invisible text (retry t) ------------------------------------------------------------ revno: 109853 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-02 00:10:10 -0700 message: * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean. * doc.c (read_bytecode_char, get_doc_string, reread_doc_file) (Fdocumentation, Fdocumentation_property, Fsnarf_documentation) (Fsubstitute_command_keys): * editfns.c (region_limit, find_field, Fconstrain_to_field) (save_excursion_save, save_excursion_restore) (disassemble_lisp_time, decode_time_components, emacs_nmemftime) (format_time_string, general_insert_function) (make_buffer_string, make_buffer_string_both) (Fsubst_char_in_region, Ftranslate_region_internal, Fformat): * insdel.c (check_markers, gap_left, adjust_markers_for_insert) (copy_text, insert_1, insert_1_both, insert_from_string) (insert_from_string_before_markers, insert_from_string_1) (insert_from_buffer, insert_from_buffer_1, replace_range) (replace_range_2, del_range_1, del_range_byte, del_range_both) (del_range_2, modify_region): * intervals.c (intervals_equal, balance_possible_root_interval) (adjust_intervals_for_insertion, merge_properties_sticky) (graft_intervals_into_buffer, lookup_char_property) (adjust_for_invis_intang, set_point_both) (get_property_and_range, compare_string_intervals) (set_intervals_multibyte_1, set_intervals_multibyte): * keyboard.c (decode_timer): Use bool for boolean. * intervals.h, lisp.h, systime.h: Reflect above API changes. * editfns.c (struct info): Use 1-bit unsigned bitfields for booleans. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 03:50:29 +0000 +++ src/ChangeLog 2012-09-02 07:10:10 +0000 @@ -1,3 +1,32 @@ +2012-09-02 Paul Eggert + + * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean. + * doc.c (read_bytecode_char, get_doc_string, reread_doc_file) + (Fdocumentation, Fdocumentation_property, Fsnarf_documentation) + (Fsubstitute_command_keys): + * editfns.c (region_limit, find_field, Fconstrain_to_field) + (save_excursion_save, save_excursion_restore) + (disassemble_lisp_time, decode_time_components, emacs_nmemftime) + (format_time_string, general_insert_function) + (make_buffer_string, make_buffer_string_both) + (Fsubst_char_in_region, Ftranslate_region_internal, Fformat): + * insdel.c (check_markers, gap_left, adjust_markers_for_insert) + (copy_text, insert_1, insert_1_both, insert_from_string) + (insert_from_string_before_markers, insert_from_string_1) + (insert_from_buffer, insert_from_buffer_1, replace_range) + (replace_range_2, del_range_1, del_range_byte, del_range_both) + (del_range_2, modify_region): + * intervals.c (intervals_equal, balance_possible_root_interval) + (adjust_intervals_for_insertion, merge_properties_sticky) + (graft_intervals_into_buffer, lookup_char_property) + (adjust_for_invis_intang, set_point_both) + (get_property_and_range, compare_string_intervals) + (set_intervals_multibyte_1, set_intervals_multibyte): + * keyboard.c (decode_timer): + Use bool for boolean. + * intervals.h, lisp.h, systime.h: Reflect above API changes. + * editfns.c (struct info): Use 1-bit unsigned bitfields for booleans. + 2012-09-02 Chong Yidong * keymap.c (push_key_description): Print M-TAB as C-M-i === modified file 'src/doc.c' --- src/doc.c 2012-08-16 21:58:44 +0000 +++ src/doc.c 2012-09-02 07:10:10 +0000 @@ -48,7 +48,7 @@ If UNREADFLAG is 1, we unread a byte. */ int -read_bytecode_char (int unreadflag) +read_bytecode_char (bool unreadflag) { if (unreadflag) { @@ -70,20 +70,18 @@ (e.g. because the file has been modified and the location is stale), return nil. - If UNIBYTE is nonzero, always make a unibyte string. + If UNIBYTE, always make a unibyte string. - If DEFINITION is nonzero, assume this is for reading + If DEFINITION, assume this is for reading a dynamic function definition; convert the bytestring and the constants vector with appropriate byte handling, and return a cons cell. */ Lisp_Object -get_doc_string (Lisp_Object filepos, int unibyte, int definition) +get_doc_string (Lisp_Object filepos, bool unibyte, bool definition) { - char *from, *to; - register int fd; - register char *name; - register char *p, *p1; + char *from, *to, *name, *p, *p1; + int fd; ptrdiff_t minsize; int offset; EMACS_INT position; @@ -302,7 +300,7 @@ return get_doc_string (filepos, 0, 1); } -static int +static bool reread_doc_file (Lisp_Object file) { #if 0 @@ -335,7 +333,7 @@ Lisp_Object fun; Lisp_Object funcar; Lisp_Object doc; - int try_reload = 1; + bool try_reload = 1; documentation: @@ -467,7 +465,7 @@ aren't strings. */) (Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw) { - int try_reload = 1; + bool try_reload = 1; Lisp_Object tem; documentation_property: @@ -562,12 +560,11 @@ { int fd; char buf[1024 + 1]; - register int filled; - register EMACS_INT pos; - register char *p; + int filled; + EMACS_INT pos; Lisp_Object sym; - char *name; - int skip_file = 0; + char *p, *name; + bool skip_file = 0; CHECK_STRING (filename); @@ -722,9 +719,9 @@ (Lisp_Object string) { char *buf; - int changed = 0; - register unsigned char *strp; - register char *bufp; + bool changed = 0; + unsigned char *strp; + char *bufp; ptrdiff_t idx; ptrdiff_t bsize; Lisp_Object tem; @@ -733,7 +730,7 @@ ptrdiff_t length, length_byte; Lisp_Object name; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int multibyte; + bool multibyte; ptrdiff_t nchars; if (NILP (string)) @@ -787,7 +784,7 @@ else if (strp[0] == '\\' && strp[1] == '[') { ptrdiff_t start_idx; - int follow_remap = 1; + bool follow_remap = 1; changed = 1; strp += 2; /* skip \[ */ === modified file 'src/editfns.c' --- src/editfns.c 2012-08-28 06:20:08 +0000 +++ src/editfns.c 2012-09-02 07:10:10 +0000 @@ -65,7 +65,7 @@ #endif static Lisp_Object format_time_string (char const *, ptrdiff_t, EMACS_TIME, - int, struct tm *); + bool, struct tm *); static int tm_diff (struct tm *, struct tm *); static void update_buffer_properties (ptrdiff_t, ptrdiff_t); @@ -246,11 +246,11 @@ /* Return the start or end position of the region. - BEGINNINGP non-zero means return the start. + BEGINNINGP means return the start. If there is no region active, signal an error. */ static Lisp_Object -region_limit (int beginningp) +region_limit (bool beginningp) { Lisp_Object m; @@ -264,7 +264,7 @@ error ("The mark is not set now, so there is no region"); /* Clip to the current narrowing (bug#11770). */ - return make_number ((PT < XFASTINT (m)) == (beginningp != 0) + return make_number ((PT < XFASTINT (m)) == beginningp ? PT : clip_to_bounds (BEGV, XFASTINT (m), ZV)); } @@ -435,12 +435,12 @@ BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned results; they do not effect boundary behavior. - If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first + If MERGE_AT_BOUNDARY is non-nil, then if POS is at the very first position of a field, then the beginning of the previous field is returned instead of the beginning of POS's field (since the end of a field is actually also the beginning of the next input field, this behavior is sometimes useful). Additionally in the MERGE_AT_BOUNDARY - true case, if two fields are separated by a field with the special + non-nil case, if two fields are separated by a field with the special value `boundary', and POS lies within it, then the two separated fields are considered to be adjacent, and POS between them, when finding the beginning and ending of the "merged" field. @@ -455,10 +455,10 @@ { /* Fields right before and after the point. */ Lisp_Object before_field, after_field; - /* 1 if POS counts as the start of a field. */ - int at_field_start = 0; - /* 1 if POS counts as the end of a field. */ - int at_field_end = 0; + /* True if POS counts as the start of a field. */ + bool at_field_start = 0; + /* True if POS counts as the end of a field. */ + bool at_field_end = 0; if (NILP (pos)) XSETFASTINT (pos, PT); @@ -502,19 +502,19 @@ xxxx.yyyy - In this situation, if merge_at_boundary is true, we consider the + In this situation, if merge_at_boundary is non-nil, consider the `x' and `y' fields as forming one big merged field, and so the end of the field is the end of `y'. However, if `x' and `y' are separated by a special `boundary' field - (a field with a `field' char-property of 'boundary), then we ignore + (a field with a `field' char-property of 'boundary), then ignore this special field when merging adjacent fields. Here's the same situation, but with a `boundary' field between the `x' and `y' fields: xxx.BBBByyyy Here, if point is at the end of `x', the beginning of `y', or - anywhere in-between (within the `boundary' field), we merge all + anywhere in-between (within the `boundary' field), merge all three fields and consider the beginning as being the beginning of the `x' field, and the end as being the end of the `y' field. */ @@ -658,7 +658,7 @@ { /* If non-zero, then the original point, before re-positioning. */ ptrdiff_t orig_point = 0; - int fwd; + bool fwd; Lisp_Object prev_old, prev_new; if (NILP (new_pos)) @@ -816,8 +816,8 @@ Lisp_Object save_excursion_save (void) { - int visible = (XBUFFER (XWINDOW (selected_window)->buffer) - == current_buffer); + bool visible = (XBUFFER (XWINDOW (selected_window)->buffer) + == current_buffer); return Fcons (Fpoint_marker (), Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), @@ -831,7 +831,7 @@ { Lisp_Object tem, tem1, omark, nmark; struct gcpro gcpro1, gcpro2, gcpro3; - int visible_p; + bool visible_p; tem = Fmarker_buffer (XCAR (info)); /* If buffer being returned to is now deleted, avoid error */ @@ -1467,8 +1467,8 @@ /* Decode a Lisp list SPECIFIED_TIME that represents a time. Set *PHIGH, *PLOW, *PUSEC, *PPSEC to its parts; do not check their values. - Return nonzero if successful. */ -static int + Return true if successful. */ +static bool disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh, Lisp_Object *plow, Lisp_Object *pusec, Lisp_Object *ppsec) @@ -1511,8 +1511,8 @@ If *DRESULT is not null, store into *DRESULT the number of seconds since the start of the POSIX Epoch. - Return nonzero if successful. */ -int + Return true if successful. */ +bool decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec, Lisp_Object psec, EMACS_TIME *result, double *dresult) @@ -1632,7 +1632,7 @@ /* Write information into buffer S of size MAXSIZE, according to the FORMAT of length FORMAT_LEN, using time information taken from *TP. - Default to Universal Time if UT is nonzero, local time otherwise. + Default to Universal Time if UT, local time otherwise. Use NS as the number of nanoseconds in the %N directive. Return the number of bytes written, not including the terminating '\0'. If S is NULL, nothing will be written anywhere; so to @@ -1643,7 +1643,7 @@ bytes in FORMAT and it does not support nanoseconds. */ static size_t emacs_nmemftime (char *s, size_t maxsize, const char *format, - size_t format_len, const struct tm *tp, int ut, int ns) + size_t format_len, const struct tm *tp, bool ut, int ns) { size_t total = 0; @@ -1748,7 +1748,7 @@ static Lisp_Object format_time_string (char const *format, ptrdiff_t formatlen, - EMACS_TIME t, int ut, struct tm *tmp) + EMACS_TIME t, bool ut, struct tm *tmp) { char buffer[4000]; char *buf = buffer; @@ -2228,11 +2228,11 @@ (const char *, ptrdiff_t), void (*insert_from_string_func) (Lisp_Object, ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int), - int inherit, ptrdiff_t nargs, Lisp_Object *args) + ptrdiff_t, ptrdiff_t, bool), + bool inherit, ptrdiff_t nargs, Lisp_Object *args) { ptrdiff_t argnum; - register Lisp_Object val; + Lisp_Object val; for (argnum = 0; argnum < nargs; argnum++) { @@ -2455,7 +2455,7 @@ /* Return a Lisp_String containing the text of the current buffer from START to END. If text properties are in use and the current buffer has properties in the range specified, the resulting string will also - have them, if PROPS is nonzero. + have them, if PROPS is true. We don't want to use plain old make_string here, because it calls make_uninit_string, which can cause the buffer arena to be @@ -2466,7 +2466,7 @@ buffer substrings. */ Lisp_Object -make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) +make_buffer_string (ptrdiff_t start, ptrdiff_t end, bool props) { ptrdiff_t start_byte = CHAR_TO_BYTE (start); ptrdiff_t end_byte = CHAR_TO_BYTE (end); @@ -2479,7 +2479,7 @@ If text properties are in use and the current buffer has properties in the range specified, the resulting string will also - have them, if PROPS is nonzero. + have them, if PROPS is true. We don't want to use plain old make_string here, because it calls make_uninit_string, which can cause the buffer arena to be @@ -2491,7 +2491,7 @@ Lisp_Object make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte, - ptrdiff_t end, ptrdiff_t end_byte, int props) + ptrdiff_t end, ptrdiff_t end_byte, bool props) { Lisp_Object result, tem, tem1; @@ -2842,7 +2842,8 @@ #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) int maybe_byte_combining = COMBINING_NO; ptrdiff_t last_changed = 0; - int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool multibyte_p + = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int fromc, toc; restart: @@ -3078,8 +3079,8 @@ int cnt; /* Number of changes made. */ ptrdiff_t size; /* Size of translate table. */ ptrdiff_t pos, pos_byte, end_pos; - int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); - int string_multibyte IF_LINT (= 0); + bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool string_multibyte IF_LINT (= 0); validate_region (&start, &end); if (CHAR_TABLE_P (table)) @@ -3650,9 +3651,9 @@ byte combining problem, i.e., a byte may be combined with a multibyte character of the previous string. This flag tells if we must consider such a situation or not. */ - int maybe_combine_byte; + bool maybe_combine_byte; Lisp_Object val; - int arg_intervals = 0; + bool arg_intervals = 0; USE_SAFE_ALLOCA; /* discarded[I] is 1 if byte I of the format @@ -3668,8 +3669,8 @@ struct info { ptrdiff_t start, end; - int converted_to_string; - int intervals; + unsigned converted_to_string : 1; + unsigned intervals : 1; } *info = 0; /* It should not be necessary to GCPRO ARGS, because @@ -3746,13 +3747,13 @@ digits to print after the '.' for floats, or the max. number of chars to print from a string. */ - int minus_flag = 0; - int plus_flag = 0; - int space_flag = 0; - int sharp_flag = 0; - int zero_flag = 0; + bool minus_flag = 0; + bool plus_flag = 0; + bool space_flag = 0; + bool sharp_flag = 0; + bool zero_flag = 0; ptrdiff_t field_width; - int precision_given; + bool precision_given; uintmax_t precision = UINTMAX_MAX; char *num_end; char conversion; @@ -4132,7 +4133,7 @@ char *src = sprintf_buf; char src0 = src[0]; int exponent_bytes = 0; - int signedp = src0 == '-' || src0 == '+' || src0 == ' '; + bool signedp = src0 == '-' || src0 == '+' || src0 == ' '; int significand_bytes; if (zero_flag && ((src[signedp] >= '0' && src[signedp] <= '9') === modified file 'src/insdel.c' --- src/insdel.c 2012-08-28 06:20:08 +0000 +++ src/insdel.c 2012-09-02 07:10:10 +0000 @@ -31,19 +31,15 @@ #include "blockinput.h" #include "region-cache.h" -static void insert_from_string_1 (Lisp_Object string, - ptrdiff_t pos, ptrdiff_t pos_byte, - ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int before_markers); -static void insert_from_buffer_1 (struct buffer *buf, - ptrdiff_t from, ptrdiff_t nchars, - int inherit); -static void gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap); -static void gap_right (ptrdiff_t charpos, ptrdiff_t bytepos); +static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, + ptrdiff_t, bool, bool); +static void insert_from_buffer_1 (struct buffer *, ptrdiff_t, ptrdiff_t, bool); +static void gap_left (ptrdiff_t, ptrdiff_t, bool); +static void gap_right (ptrdiff_t, ptrdiff_t); /* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT) describing changes which happened while combine_after_change_calls - was nonzero. We use this to decide how to call them + was non-nil. We use this to decide how to call them once the deferral ends. In each element. @@ -67,8 +63,8 @@ static void check_markers (void) { - register struct Lisp_Marker *tail; - int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); + struct Lisp_Marker *tail; + bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) { @@ -113,13 +109,13 @@ /* Move the gap to a position less than the current GPT. BYTEPOS describes the new position as a byte position, and CHARPOS is the corresponding char position. - If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ + If NEWGAP, then don't update beg_unchanged and end_unchanged. */ static void -gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap) +gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, bool newgap) { - register unsigned char *to, *from; - register ptrdiff_t i; + unsigned char *to, *from; + ptrdiff_t i; ptrdiff_t new_s1; if (!newgap) @@ -287,10 +283,10 @@ static void adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int before_markers) + ptrdiff_t to, ptrdiff_t to_byte, bool before_markers) { struct Lisp_Marker *m; - int adjusted = 0; + bool adjusted = 0; ptrdiff_t nchars = to - from; ptrdiff_t nbytes = to_byte - from_byte; @@ -515,7 +511,7 @@ ptrdiff_t copy_text (const unsigned char *from_addr, unsigned char *to_addr, - ptrdiff_t nbytes, int from_multibyte, int to_multibyte) + ptrdiff_t nbytes, bool from_multibyte, bool to_multibyte) { if (from_multibyte == to_multibyte) { @@ -664,7 +660,7 @@ void insert_1 (const char *string, ptrdiff_t nbytes, - int inherit, int prepare, int before_markers) + bool inherit, bool prepare, bool before_markers) { insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes), nbytes, inherit, prepare, before_markers); @@ -790,7 +786,7 @@ void insert_1_both (const char *string, ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int prepare, int before_markers) + bool inherit, bool prepare, bool before_markers) { if (nchars == 0) return; @@ -867,7 +863,7 @@ void insert_from_string (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, - ptrdiff_t length, ptrdiff_t length_byte, int inherit) + ptrdiff_t length, ptrdiff_t length_byte, bool inherit) { ptrdiff_t opoint = PT; @@ -887,7 +883,7 @@ insert_from_string_before_markers (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t length, ptrdiff_t length_byte, - int inherit) + bool inherit) { ptrdiff_t opoint = PT; @@ -905,7 +901,7 @@ static void insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int before_markers) + bool inherit, bool before_markers) { struct gcpro gcpro1; ptrdiff_t outgoing_nbytes = nbytes; @@ -1039,7 +1035,7 @@ void insert_from_buffer (struct buffer *buf, - ptrdiff_t charpos, ptrdiff_t nchars, int inherit) + ptrdiff_t charpos, ptrdiff_t nchars, bool inherit) { ptrdiff_t opoint = PT; @@ -1050,7 +1046,7 @@ static void insert_from_buffer_1 (struct buffer *buf, - ptrdiff_t from, ptrdiff_t nchars, int inherit) + ptrdiff_t from, ptrdiff_t nchars, bool inherit) { ptrdiff_t chunk, chunk_expanded; ptrdiff_t from_byte = buf_charpos_to_bytepos (buf, from); @@ -1265,7 +1261,7 @@ } /* Replace the text from character positions FROM to TO with NEW, - If PREPARE is nonzero, call prepare_to_modify_buffer. + If PREPARE, call prepare_to_modify_buffer. If INHERIT, the newly inserted text should inherit text properties from the surrounding non-deleted text. */ @@ -1278,7 +1274,7 @@ void replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, - int prepare, int inherit, int markers) + bool prepare, bool inherit, bool markers) { ptrdiff_t inschars = SCHARS (new); ptrdiff_t insbytes = SBYTES (new); @@ -1443,7 +1439,7 @@ Note that this does not yet handle markers quite right. - If MARKERS is nonzero, relocate markers. + If MARKERS, relocate markers. Unlike most functions at this level, never call prepare_to_modify_buffer and never call signal_after_change. */ @@ -1452,7 +1448,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t to, ptrdiff_t to_byte, const char *ins, ptrdiff_t inschars, ptrdiff_t insbytes, - int markers) + bool markers) { ptrdiff_t nbytes_del, nchars_del; @@ -1563,7 +1559,7 @@ RET_STRING says to return the deleted text. */ Lisp_Object -del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string) +del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, bool ret_string) { ptrdiff_t from_byte, to_byte; Lisp_Object deletion; @@ -1599,7 +1595,7 @@ /* Like del_range_1 but args are byte positions, not char positions. */ void -del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare) +del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) { ptrdiff_t from, to; @@ -1643,7 +1639,7 @@ void del_range_both (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int prepare) + ptrdiff_t to, ptrdiff_t to_byte, bool prepare) { /* Make args be valid */ if (from_byte < BEGV_BYTE) @@ -1685,13 +1681,13 @@ /* Delete a range of text, specified both as character positions and byte positions. FROM and TO are character positions, while FROM_BYTE and TO_BYTE are byte positions. - If RET_STRING is true, the deleted area is returned as a string. */ + If RET_STRING, the deleted area is returned as a string. */ Lisp_Object del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int ret_string) + ptrdiff_t to, ptrdiff_t to_byte, bool ret_string) { - register ptrdiff_t nbytes_del, nchars_del; + ptrdiff_t nbytes_del, nchars_del; Lisp_Object deletion; check_markers (); @@ -1770,12 +1766,12 @@ and warns the next redisplay that it should pay attention to that area. - If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF. + If PRESERVE_CHARS_MODIFF, do not update CHARS_MODIFF. Otherwise set CHARS_MODIFF to the new value of MODIFF. */ void modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end, - int preserve_chars_modiff) + bool preserve_chars_modiff) { struct buffer *old_buffer = current_buffer; === modified file 'src/intervals.c' --- src/intervals.c 2012-08-18 06:06:39 +0000 +++ src/intervals.c 2012-09-02 07:10:10 +0000 @@ -178,14 +178,13 @@ } } -/* Return 1 if the two intervals have the same properties, - 0 otherwise. */ +/* Return true if the two intervals have the same properties. */ -int +bool intervals_equal (INTERVAL i0, INTERVAL i1) { - register Lisp_Object i0_cdr, i0_sym; - register Lisp_Object i1_cdr, i1_val; + Lisp_Object i0_cdr, i0_sym; + Lisp_Object i1_cdr, i1_val; if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) return 1; @@ -469,10 +468,10 @@ Lisp Object. */ static inline INTERVAL -balance_possible_root_interval (register INTERVAL interval) +balance_possible_root_interval (INTERVAL interval) { Lisp_Object parent; - int have_parent = 0; + bool have_parent = 0; if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval)) return interval; @@ -845,9 +844,9 @@ adjust_intervals_for_insertion (INTERVAL tree, ptrdiff_t position, ptrdiff_t length) { - register INTERVAL i; - register INTERVAL temp; - int eobp = 0; + INTERVAL i; + INTERVAL temp; + bool eobp = 0; Lisp_Object parent; ptrdiff_t offset; @@ -1068,11 +1067,10 @@ static Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright) { - register Lisp_Object props, front, rear; + Lisp_Object props, front, rear; Lisp_Object lfront, lrear, rfront, rrear; - register Lisp_Object tail1, tail2, sym, lval, rval, cat; - int use_left, use_right; - int lpresent; + Lisp_Object tail1, tail2, sym, lval, rval, cat; + bool use_left, use_right, lpresent; props = Qnil; front = Qnil; @@ -1610,7 +1608,7 @@ void graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, ptrdiff_t length, struct buffer *buffer, - int inherit) + bool inherit) { INTERVAL tree = buffer_intervals (buffer); INTERVAL under, over, this; @@ -1753,9 +1751,9 @@ } Lisp_Object -lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop) +lookup_char_property (Lisp_Object plist, Lisp_Object prop, bool textprop) { - register Lisp_Object tail, fallback = Qnil; + Lisp_Object tail, fallback = Qnil; for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail))) { @@ -1826,8 +1824,8 @@ /* If there's an invisible character at position POS + TEST_OFFS in the current buffer, and the invisible property has a `stickiness' such that inserting a character at position POS would inherit the property it, - return POS + ADJ, otherwise return POS. If TEST_INTANG is non-zero, - then intangibility is required as well as invisibility. + return POS + ADJ, otherwise return POS. If TEST_INTANG, intangibility + is required as well as invisibility. TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. @@ -1836,7 +1834,7 @@ static ptrdiff_t adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj, - int test_intang) + bool test_intang) { Lisp_Object invis_propval, invis_overlay; Lisp_Object test_pos; @@ -1883,8 +1881,8 @@ initial position is the same as the destination, in the rare instances where this is important, e.g. in line-move-finish (simple.el). */ - int backwards = (charpos < old_position ? 1 : 0); - int have_overlays; + bool backwards = charpos < old_position; + bool have_overlays; ptrdiff_t original_position; bset_point_before_scroll (current_buffer, Qnil); @@ -2154,12 +2152,12 @@ /* If text at position POS has property PROP, set *VAL to the property value, *START and *END to the beginning and end of a region that - has the same property, and return 1. Otherwise return 0. + has the same property, and return true. Otherwise return false. OBJECT is the string or buffer to look for the property in; nil means the current buffer. */ -int +bool get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object) { @@ -2306,10 +2304,10 @@ set_string_intervals (string, interval_copy); } -/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. +/* Return true if strings S1 and S2 have identical properties. Assume they have identical characters. */ -int +bool compare_string_intervals (Lisp_Object s1, Lisp_Object s2) { INTERVAL i1, i2; @@ -2348,7 +2346,7 @@ START_BYTE ... END_BYTE in bytes. */ static void -set_intervals_multibyte_1 (INTERVAL i, int multi_flag, +set_intervals_multibyte_1 (INTERVAL i, bool multi_flag, ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, ptrdiff_t end_byte) { @@ -2456,11 +2454,11 @@ } /* Update the intervals of the current buffer - to fit the contents as multibyte (if MULTI_FLAG is 1) - or to fit them as non-multibyte (if MULTI_FLAG is 0). */ + to fit the contents as multibyte (if MULTI_FLAG) + or to fit them as non-multibyte (if not MULTI_FLAG). */ void -set_intervals_multibyte (int multi_flag) +set_intervals_multibyte (bool multi_flag) { INTERVAL i = buffer_intervals (current_buffer); === modified file 'src/intervals.h' --- src/intervals.h 2012-08-17 21:12:11 +0000 +++ src/intervals.h 2012-09-02 07:10:10 +0000 @@ -227,7 +227,7 @@ extern INTERVAL create_root_interval (Lisp_Object); extern void copy_properties (INTERVAL, INTERVAL); -extern int intervals_equal (INTERVAL, INTERVAL); +extern bool intervals_equal (INTERVAL, INTERVAL); extern void traverse_intervals (INTERVAL, ptrdiff_t, void (*) (INTERVAL, Lisp_Object), Lisp_Object); @@ -242,22 +242,22 @@ extern INTERVAL merge_interval_left (INTERVAL); extern void offset_intervals (struct buffer *, ptrdiff_t, ptrdiff_t); extern void graft_intervals_into_buffer (INTERVAL, ptrdiff_t, ptrdiff_t, - struct buffer *, int); + struct buffer *, bool); extern void verify_interval_modification (struct buffer *, ptrdiff_t, ptrdiff_t); extern INTERVAL balance_intervals (INTERVAL); extern void copy_intervals_to_string (Lisp_Object, struct buffer *, ptrdiff_t, ptrdiff_t); extern INTERVAL copy_intervals (INTERVAL, ptrdiff_t, ptrdiff_t); -extern int compare_string_intervals (Lisp_Object, Lisp_Object); +extern bool compare_string_intervals (Lisp_Object, Lisp_Object); extern Lisp_Object textget (Lisp_Object, Lisp_Object); -extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); +extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, bool); extern void move_if_not_intangible (ptrdiff_t); -extern int get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *, - ptrdiff_t *, ptrdiff_t *, Lisp_Object); +extern bool get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *, + ptrdiff_t *, ptrdiff_t *, Lisp_Object); extern Lisp_Object get_local_map (ptrdiff_t, struct buffer *, Lisp_Object); extern INTERVAL update_interval (INTERVAL, ptrdiff_t); -extern void set_intervals_multibyte (int); +extern void set_intervals_multibyte (bool); extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, Lisp_Object *, int); extern INTERVAL interval_of (ptrdiff_t, Lisp_Object); === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-01 06:38:52 +0000 +++ src/keyboard.c 2012-09-02 07:10:10 +0000 @@ -4339,9 +4339,8 @@ ...). Each element has the form (FUN . ARGS). */ Lisp_Object pending_funcalls; -/* If TIMER is a valid timer, return nonzero and place its value into - *RESULT. Otherwise return zero. */ -static int +/* Return true if TIMER is a valid timer, placing its value into *RESULT. */ +static bool decode_timer (Lisp_Object timer, EMACS_TIME *result) { Lisp_Object *vector; @@ -8445,7 +8444,7 @@ /* Append entries from tool_bar_item_properties to the end of tool_bar_items_vector. */ - vcopy (tool_bar_items_vector, ntool_bar_items, + vcopy (tool_bar_items_vector, ntool_bar_items, XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS); ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; } === modified file 'src/lisp.h' --- src/lisp.h 2012-09-01 01:04:26 +0000 +++ src/lisp.h 2012-09-02 07:10:10 +0000 @@ -2720,43 +2720,43 @@ extern _Noreturn void buffer_overflow (void); extern void make_gap (ptrdiff_t); extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, - ptrdiff_t, int, int); + ptrdiff_t, bool, bool); extern int count_combining_before (const unsigned char *, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern int count_combining_after (const unsigned char *, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void insert (const char *, ptrdiff_t); extern void insert_and_inherit (const char *, ptrdiff_t); -extern void insert_1 (const char *, ptrdiff_t, int, int, int); +extern void insert_1 (const char *, ptrdiff_t, bool, bool, bool); extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, - int, int, int); + bool, bool, bool); extern void insert_from_gap (ptrdiff_t, ptrdiff_t); extern void insert_from_string (Lisp_Object, ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int); -extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, int); + ptrdiff_t, ptrdiff_t, bool); +extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, bool); extern void insert_char (int); extern void insert_string (const char *); extern void insert_before_markers (const char *, ptrdiff_t); extern void insert_before_markers_and_inherit (const char *, ptrdiff_t); extern void insert_from_string_before_markers (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t, int); + ptrdiff_t, bool); extern void del_range (ptrdiff_t, ptrdiff_t); -extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, int, int); -extern void del_range_byte (ptrdiff_t, ptrdiff_t, int); -extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, int); +extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, bool, bool); +extern void del_range_byte (ptrdiff_t, ptrdiff_t, bool); +extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int); -extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, int); + ptrdiff_t, ptrdiff_t, bool); +extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, bool); extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); -extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, int, int, int); +extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, bool); extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, - const char *, ptrdiff_t, ptrdiff_t, int); + const char *, ptrdiff_t, ptrdiff_t, bool); extern void syms_of_insdel (void); /* Defined in dispnew.c */ @@ -3094,9 +3094,9 @@ extern Lisp_Object save_excursion_restore (Lisp_Object); extern Lisp_Object save_restriction_restore (Lisp_Object); extern _Noreturn void time_overflow (void); -extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int); +extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t, int); + ptrdiff_t, bool); extern void init_editfns (void); const char *get_system_name (void); extern void syms_of_editfns (void); @@ -3332,9 +3332,9 @@ /* Defined in doc.c */ extern Lisp_Object Qfunction_documentation; extern Lisp_Object read_doc_string (Lisp_Object); -extern Lisp_Object get_doc_string (Lisp_Object, int, int); +extern Lisp_Object get_doc_string (Lisp_Object, bool, bool); extern void syms_of_doc (void); -extern int read_bytecode_char (int); +extern int read_bytecode_char (bool); /* Defined in bytecode.c */ extern Lisp_Object Qbytecode; === modified file 'src/systime.h' --- src/systime.h 2012-08-28 16:01:59 +0000 +++ src/systime.h 2012-09-02 07:10:10 +0000 @@ -154,8 +154,8 @@ #ifdef GCPRO1 /* defined in editfns.c */ extern Lisp_Object make_lisp_time (EMACS_TIME); -extern int decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, EMACS_TIME *, double *); +extern bool decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, EMACS_TIME *, double *); extern EMACS_TIME lisp_time_argument (Lisp_Object); #endif ------------------------------------------------------------ revno: 109852 fixes bug: http://debbugs.gnu.org/12075 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-02 12:47:28 +0800 message: Recommand against save-window-excursion in Lisp manual. * windows.texi (Window Configurations): Recommend against using save-window-excursion. * control.texi (Catch and Throw): * positions.texi (Excursions): Don't mention it. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-09-01 01:04:26 +0000 +++ doc/lispref/ChangeLog 2012-09-02 04:47:28 +0000 @@ -1,3 +1,11 @@ +2012-09-02 Chong Yidong + + * windows.texi (Window Configurations): Recommend against using + save-window-excursion (Bug#12075). + + * control.texi (Catch and Throw): + * positions.texi (Excursions): Don't mention it. + 2012-09-01 Paul Eggert Better seed support for (random). === modified file 'doc/lispref/control.texi' --- doc/lispref/control.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/control.texi 2012-09-02 04:47:28 +0000 @@ -556,16 +556,14 @@ @code{catch} in between). Executing @code{throw} exits all Lisp constructs up to the matching -@code{catch}, including function calls. When binding constructs such as -@code{let} or function calls are exited in this way, the bindings are -unbound, just as they are when these constructs exit normally +@code{catch}, including function calls. When binding constructs such +as @code{let} or function calls are exited in this way, the bindings +are unbound, just as they are when these constructs exit normally (@pxref{Local Variables}). Likewise, @code{throw} restores the buffer and position saved by @code{save-excursion} (@pxref{Excursions}), and -the narrowing status saved by @code{save-restriction} and the window -selection saved by @code{save-window-excursion} (@pxref{Window -Configurations}). It also runs any cleanups established with the -@code{unwind-protect} special form when it exits that form -(@pxref{Cleanups}). +the narrowing status saved by @code{save-restriction}. It also runs +any cleanups established with the @code{unwind-protect} special form +when it exits that form (@pxref{Cleanups}). The @code{throw} need not appear lexically within the @code{catch} that it jumps to. It can equally well be called from another function === modified file 'doc/lispref/positions.texi' --- doc/lispref/positions.texi 2012-06-17 05:13:40 +0000 +++ doc/lispref/positions.texi 2012-09-02 04:47:28 +0000 @@ -850,9 +850,6 @@ @cindex window excursions Likewise, @code{save-excursion} does not restore window-buffer correspondences altered by functions such as @code{switch-to-buffer}. -One way to restore these correspondences, and the selected window, is to -use @code{save-window-excursion} inside @code{save-excursion} -(@pxref{Window Configurations}). @strong{Warning:} Ordinary insertion of text adjacent to the saved point value relocates the saved value, just as it relocates all === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2012-08-21 09:50:58 +0000 +++ doc/lispref/windows.texi 2012-09-02 04:47:28 +0000 @@ -3153,42 +3153,21 @@ @end defun @defmac save-window-excursion forms@dots{} -This special form records the window configuration, executes @var{forms} -in sequence, then restores the earlier window configuration. The window -configuration includes, for each window, the value of point and the -portion of the buffer that is visible. It also includes the choice of -selected window. However, it does not include the value of point in -the current buffer; use @code{save-excursion} also, if you wish to -preserve that. - -Don't use this construct when @code{save-selected-window} is sufficient. - -Exit from @code{save-window-excursion} always triggers execution of -@code{window-size-change-functions}. (It doesn't know how to tell -whether the restored configuration actually differs from the one in -effect at the end of the @var{forms}.) - -The return value is the value of the final form in @var{forms}. -For example: - -@example -@group -(split-window) - @result{} # -@end group -@group -(setq w (selected-window)) - @result{} # -@end group -@group -(save-window-excursion - (delete-other-windows w) - (switch-to-buffer "foo") - 'do-something) - @result{} do-something - ;; @r{The screen is now split again.} -@end group -@end example +This macro records the window configuration of the selected frame, +executes @var{forms} in sequence, then restores the earlier window +configuration. The return value is the value of the final form in +@var{forms}. + +Most Lisp code should not use this macro; @code{save-selected-window} +is typically sufficient. In particular, this macro cannot reliably +prevent the code in @var{forms} from opening new windows, because new +windows might be opened in other frames (@pxref{Choosing Window}), and +@code{save-window-excursion} only saves and restores the window +configuration on the current frame. + +Do not use this macro in @code{window-size-change-functions}; exiting +the macro triggers execution of @code{window-size-change-functions}, +leading to an endless loop. @end defmac @defun window-configuration-p object @@ -3424,11 +3403,11 @@ causes these functions to be called. Changing the frame size also counts, because it changes the sizes of the existing windows. -It is not a good idea to use @code{save-window-excursion} (@pxref{Window -Configurations}) in these functions, because that always counts as a -size change, and it would cause these functions to be called over and -over. In most cases, @code{save-selected-window} (@pxref{Selecting -Windows}) is what you need here. +You may use @code{save-selected-window} in these functions +(@pxref{Selecting Windows}). However, do not use +@code{save-window-excursion} (@pxref{Window Configurations}); exiting +that macro counts as a size change, which would cause these functions +to be called over and over. @end defvar @defvar window-configuration-change-hook