Now on revision 109873. ------------------------------------------------------------ revno: 109873 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 23:34:19 -0700 message: Be more systematic about _setjmp vs setjmp. * alloc.c (test_setjmp, mark_stack): * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]: (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]: (png_load, my_error_exit, jpeg_load): * process.c (send_process_trap, send_process): Uniformly prefer _setjmp and _longjmp to setjmp and longjmp. The underscored versions are up to 30x faster on some hosts. Formerly, the code used setjmp+longjmp sometimes and _setjmp+_longjmp at other times, with no particular reason to prefer setjmp+longjmp. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-03 19:36:09 +0000 +++ src/ChangeLog 2012-09-04 06:34:19 +0000 @@ -1,3 +1,17 @@ +2012-09-04 Paul Eggert + + Be more systematic about _setjmp vs setjmp. + * alloc.c (test_setjmp, mark_stack): + * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]: + (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]: + (png_load, my_error_exit, jpeg_load): + * process.c (send_process_trap, send_process): + Uniformly prefer _setjmp and _longjmp to setjmp and longjmp. + The underscored versions are up to 30x faster on some hosts. + Formerly, the code used setjmp+longjmp sometimes and + _setjmp+_longjmp at other times, with no particular reason to + prefer setjmp+longjmp. + 2012-09-03 Paul Eggert Fix minor problem found by static checking. === modified file 'src/alloc.c' --- src/alloc.c 2012-09-02 16:56:31 +0000 +++ src/alloc.c 2012-09-04 06:34:19 +0000 @@ -4764,7 +4764,7 @@ x = strlen (buf); x = 2 * x - 1; - setjmp (jbuf); + _setjmp (jbuf); if (longjmps_done == 1) { /* Came here after the longjmp at the end of the function. @@ -4789,7 +4789,7 @@ ++longjmps_done; x = 2; if (longjmps_done == 1) - longjmp (jbuf, 1); + _longjmp (jbuf, 1); } #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ @@ -4931,7 +4931,7 @@ } #endif /* GC_SETJMP_WORKS */ - setjmp (j.j); + _setjmp (j.j); end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; #endif /* not GC_SAVE_REGISTERS_ON_STACK */ #endif /* not HAVE___BUILTIN_UNWIND_INIT */ === modified file 'src/image.c' --- src/image.c 2012-09-02 16:56:31 +0000 +++ src/image.c 2012-09-04 06:34:19 +0000 @@ -5517,13 +5517,13 @@ #if (PNG_LIBPNG_VER < 10500) -#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1)) +#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1)) #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) #else /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ #define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1)) #define PNG_JMPBUF(ptr) \ - (*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf))) + (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf))) #endif /* Error and warning handlers installed when the PNG library @@ -5696,7 +5696,7 @@ /* Set error jump-back. We come back here when the PNG library detects an error. */ - if (setjmp (PNG_JMPBUF (png_ptr))) + if (_setjmp (PNG_JMPBUF (png_ptr))) { error: if (png_ptr) @@ -6114,7 +6114,7 @@ my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; - longjmp (mgr->setjmp_buffer, 1); + _longjmp (mgr->setjmp_buffer, 1); } @@ -6365,7 +6365,7 @@ cinfo.err = fn_jpeg_std_error (&mgr.pub); mgr.pub.error_exit = my_error_exit; - if ((rc = setjmp (mgr.setjmp_buffer)) != 0) + if ((rc = _setjmp (mgr.setjmp_buffer)) != 0) { if (rc == 1) { @@ -6411,12 +6411,12 @@ if (!check_image_size (f, width, height)) { image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); } /* Create X image and pixmap. */ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); /* Allocate colors. When color quantization is used, cinfo.actual_number_of_colors has been set with the number of === modified file 'src/process.c' --- src/process.c 2012-09-02 17:10:35 +0000 +++ src/process.c 2012-09-04 06:34:19 +0000 @@ -5431,7 +5431,7 @@ { SIGNAL_THREAD_CHECK (SIGPIPE); sigunblock (sigmask (SIGPIPE)); - longjmp (send_process_frame, 1); + _longjmp (send_process_frame, 1); } /* In send_process, when a write fails temporarily, @@ -5634,7 +5634,7 @@ /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, CFLAGS="-g -O": The value of the parameter `proc' is clobbered when returning with longjmp despite being declared volatile. */ - if (!setjmp (send_process_frame)) + if (!_setjmp (send_process_frame)) { p = XPROCESS (proc); /* Repair any setjmp clobbering. */ process_sent_to = proc; ------------------------------------------------------------ revno: 109872 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 23:25:44 -0700 message: * configure.ac (_setjmp, _longjmp): Check by compiling instead of by guessing. The guesses were wrong for recent versions of Solaris, such as Solaris 11. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-03 19:34:49 +0000 +++ ChangeLog 2012-09-04 06:25:44 +0000 @@ -1,3 +1,9 @@ +2012-09-04 Paul Eggert + + * configure.ac (_setjmp, _longjmp): Check by compiling + instead of by guessing. The guesses were wrong for + recent versions of Solaris, such as Solaris 11. + 2012-09-03 Paul Eggert * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init. === modified file 'configure.ac' --- configure.ac 2012-09-03 19:34:49 +0000 +++ configure.ac 2012-09-04 06:25:44 +0000 @@ -3791,13 +3791,27 @@ esac fi dnl GCC? +AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1);]])], + [emacs_cv_func__setjmp=yes], + [emacs_cv_func__setjmp=no])]) +if test $emacs_cv_func__setjmp = no; then + AC_DEFINE([_setjmp], [setjmp], + [Define to setjmp if _setjmp and _longjmp do not work. See _longjmp.]) + AC_DEFINE([_longjmp], [longjmp], + [Define to longjmp if _setjmp and _longjmp do not work. + Because longjmp may alter signal masks, callers of _longjmp + should not assume that it leaves signal masks alone.]) +fi case $opsys in sol2* | unixware ) - dnl setjmp and longjmp can safely replace _setjmp and _longjmp, - dnl but they will run more slowly. - AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) - AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs, dnl and this is all we need. ------------------------------------------------------------ revno: 109871 committer: Dmitry Gutov branch nick: trunk timestamp: Tue 2012-09-04 08:44:43 +0400 message: * progmodes/ruby-mode.el: Clean up keybindings (ChangeLog entry). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-03 08:54:25 +0000 +++ lisp/ChangeLog 2012-09-04 04:44:43 +0000 @@ -1,3 +1,14 @@ +2012-09-04 Dmitry Gutov + + * progmodes/ruby-mode.el: Clean up keybindings. + (ruby-mode-map): Don't bind ruby-electric-brace, + ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun, + backward-kill-word, reindent-then-newline-and-indent. + (ruby-mark-defun): Remove. + (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars. + (ruby-mode): Set local beginning-of-defun-function and + end-of-defun-function values. + 2012-09-03 Martin Rudalics * window.el (temp-buffer-window-setup-hook) ------------------------------------------------------------ revno: 109870 committer: Dmitry Gutov branch nick: trunk timestamp: Tue 2012-09-04 08:42:47 +0400 message: * ruby-mode.el: Clean up keybindings. (ruby-mode-map): Don't bind ruby-electric-brace, ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun, backward-kill-word, reindent-then-newline-and-indent. (ruby-mark-defun): Remove. (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars. (ruby-mode): Set local beginning-of-defun-function and end-of-defun-function values. diff: === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2012-08-14 12:38:11 +0000 +++ lisp/progmodes/ruby-mode.el 2012-09-04 04:42:47 +0000 @@ -138,18 +138,11 @@ (defvar ruby-mode-map (let ((map (make-sparse-keymap))) - (define-key map "{" 'ruby-electric-brace) - (define-key map "}" 'ruby-electric-brace) - (define-key map (kbd "M-C-a") 'ruby-beginning-of-defun) - (define-key map (kbd "M-C-e") 'ruby-end-of-defun) (define-key map (kbd "M-C-b") 'ruby-backward-sexp) (define-key map (kbd "M-C-f") 'ruby-forward-sexp) (define-key map (kbd "M-C-p") 'ruby-beginning-of-block) (define-key map (kbd "M-C-n") 'ruby-end-of-block) - (define-key map (kbd "M-C-h") 'ruby-mark-defun) (define-key map (kbd "M-C-q") 'ruby-indent-exp) - (define-key map (kbd "C-M-h") 'backward-kill-word) - (define-key map (kbd "C-j") 'reindent-then-newline-and-indent) (define-key map (kbd "C-c {") 'ruby-toggle-block) map) "Keymap used in Ruby mode.") @@ -840,12 +833,6 @@ (+ indent ruby-indent-level) indent)))) -(defun ruby-electric-brace (arg) - "Insert a brace and re-indent the current line." - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (ruby-indent-line t)) - ;; TODO: Why isn't one ruby-*-of-defun written in terms of the other? (defun ruby-beginning-of-defun (&optional arg) "Move backward to the beginning of the current top-level defun. @@ -1024,15 +1011,6 @@ ((error))) i))) -(defun ruby-mark-defun () - "Put mark at end of this Ruby function, point at beginning." - (interactive) - (push-mark (point)) - (ruby-end-of-defun) - (push-mark (point) nil t) - (ruby-beginning-of-defun) - (re-search-backward "^\n" (- (point) 1) t)) - (defun ruby-indent-exp (&optional ignored) "Indent each line in the balanced expression following the point." (interactive "*P") @@ -1586,6 +1564,10 @@ 'ruby-imenu-create-index) (set (make-local-variable 'add-log-current-defun-function) 'ruby-add-log-current-method) + (set (make-local-variable 'beginning-of-defun-function) + 'ruby-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + 'ruby-end-of-defun) (add-hook (cond ((boundp 'before-save-hook) 'before-save-hook) ------------------------------------------------------------ revno: 109869 author: Lars Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2012-09-03 22:12:02 +0000 message: [Gnus] Silence XEmacs compilation warnings diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-09-01 01:04:26 +0000 +++ lisp/gnus/ChangeLog 2012-09-03 22:12:02 +0000 @@ -1,3 +1,12 @@ +2012-09-03 Lars Ingebrigtsen + + * dgnushack.el: XEmacs 21.5 compilation fix. + + * gnus-notifications.el (gnus-notifications-notify): Use it. + + * gnus-fun.el (gnus-funcall-no-warning): New function to silence + warnings on XEmacs. + 2012-09-01 Paul Eggert Better seeds for (random). === modified file 'lisp/gnus/gnus-fun.el' --- lisp/gnus/gnus-fun.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/gnus-fun.el 2012-09-03 22:12:02 +0000 @@ -278,6 +278,10 @@ values)) (mapconcat 'identity values " "))) +(defun gnus-funcall-no-warning (function &rest args) + (when (fboundp function) + (apply function args))) + (provide 'gnus-fun) ;;; gnus-fun.el ends here === modified file 'lisp/gnus/gnus-notifications.el' --- lisp/gnus/gnus-notifications.el 2012-08-31 00:46:01 +0000 +++ lisp/gnus/gnus-notifications.el 2012-09-03 22:12:02 +0000 @@ -29,13 +29,16 @@ ;;; Code: -(require 'notifications nil t) +(ignore-errors + (require 'notifications)) (require 'gnus-sum) (require 'gnus-group) (require 'gnus-int) (require 'gnus-art) (require 'gnus-util) -(require 'google-contacts nil t) ; Optional +(ignore-errors + (require 'google-contacts)) ; Optional +(require 'gnus-fun) (defgroup gnus-notifications nil "Send notifications on new message in Gnus." @@ -81,12 +84,14 @@ "Send a notification about a new mail. Return a notification id if any, or t on success." (if (fboundp 'notifications-notify) - (notifications-notify + (gnus-funcall-no-warning + 'notifications-notify :title from :body subject :actions '("read" "Read") :on-action 'gnus-notifications-action - :app-icon (image-search-load-path "gnus/gnus.png") + :app-icon (gnus-funcall-no-warning + 'image-search-load-path "gnus/gnus.png") :app-name "Gnus" :category "email.arrived" :timeout gnus-notifications-timeout @@ -100,7 +105,8 @@ (let ((google-photo (when (and gnus-notifications-use-google-contacts (fboundp 'google-contacts-get-photo)) (ignore-errors - (google-contacts-get-photo mail-address))))) + (gnus-funcall-no-warning + 'google-contacts-get-photo mail-address))))) (if google-photo google-photo (when gnus-notifications-use-gravatar ------------------------------------------------------------ revno: 109868 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 12:36:09 -0700 message: Revert changes prompted only by gcc -Wjump-misses-init. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-03 09:22:43 +0000 +++ src/ChangeLog 2012-09-03 19:36:09 +0000 @@ -1,11 +1,7 @@ 2012-09-03 Paul Eggert - Fix minor problems found by static checking. + Fix minor problem found by static checking. * buffer.c (Fdelete_all_overlays): Return nil. - * doc.c (Fsubstitute_command_keys): - * regex.c (WEAK_ALIAS): - * xdisp.c (redisplay_internal): - Move initialization down, to pacify GCC 4.7.1 -Wjump-misses-init. 2012-09-03 Martin Rudalics === modified file 'src/doc.c' --- src/doc.c 2012-09-03 09:22:43 +0000 +++ src/doc.c 2012-09-03 19:36:09 +0000 @@ -848,10 +848,9 @@ struct buffer *oldbuf; ptrdiff_t start_idx; /* This is for computing the SHADOWS arg for describe_map_tree. */ - Lisp_Object active_maps; + Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); Lisp_Object earlier_maps; - active_maps = Fcurrent_active_maps (Qnil, Qnil); changed = 1; strp += 2; /* skip \{ or \< */ start = strp; === modified file 'src/regex.c' --- src/regex.c 2012-09-03 09:22:43 +0000 +++ src/regex.c 2012-09-03 19:36:09 +0000 @@ -5160,13 +5160,11 @@ { /* 1 if this match ends in the same string (string1 or string2) as the best previous match. */ - boolean same_str_p; + boolean same_str_p = (FIRST_STRING_P (match_end) + == FIRST_STRING_P (d)); /* 1 if this match is the best seen so far. */ boolean best_match_p; - same_str_p = (FIRST_STRING_P (match_end) - == FIRST_STRING_P (d)); - /* AIX compiler got confused when this was combined with the previous declaration. */ if (same_str_p) === modified file 'src/xdisp.c' --- src/xdisp.c 2012-09-03 09:22:43 +0000 +++ src/xdisp.c 2012-09-03 19:36:09 +0000 @@ -13511,10 +13511,9 @@ } else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { - Lisp_Object mini_window; + Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); struct frame *mini_frame; - mini_window = FRAME_MINIBUF_WINDOW (sf); displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ ------------------------------------------------------------ revno: 109867 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 12:34:49 -0700 message: * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init. It generates false alarms in doc.c, regex.c, xdisp.c. See . diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-03 09:26:56 +0000 +++ ChangeLog 2012-09-03 19:34:49 +0000 @@ -1,5 +1,9 @@ 2012-09-03 Paul Eggert + * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init. + It generates false alarms in doc.c, regex.c, xdisp.c. See + . + Merge from gnulib, incorporating: 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles 2011-11-30 manywarnings: update the list of "all" warnings === modified file 'configure.ac' --- configure.ac 2012-09-02 11:13:24 +0000 +++ configure.ac 2012-09-03 19:34:49 +0000 @@ -705,6 +705,7 @@ nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' + nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations ------------------------------------------------------------ revno: 109866 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-09-03 06:17:43 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2012-09-01 10:17:31 +0000 +++ autogen/Makefile.in 2012-09-03 10:17:43 +0000 @@ -359,6 +359,8 @@ GNULIB__EXIT = @GNULIB__EXIT@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ +GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ +GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GSETTINGS_CFLAGS = @GSETTINGS_CFLAGS@ GSETTINGS_LIBS = @GSETTINGS_LIBS@ === modified file 'autogen/configure' --- autogen/configure 2012-09-02 10:19:02 +0000 +++ autogen/configure 2012-09-03 10:17:43 +0000 @@ -1181,6 +1181,8 @@ LIBSELINUX_LIBS SETTINGS_LIBS SETTINGS_CFLAGS +GOBJECT_LIBS +GOBJECT_CFLAGS GCONF_LIBS GCONF_CFLAGS GSETTINGS_LIBS @@ -7305,95 +7307,118 @@ gl_manywarn_set= for gl_manywarn_item in \ + -W \ + -Wabi \ + -Waddress \ -Wall \ - -W \ - -Wformat-y2k \ - -Wformat-nonliteral \ - -Wformat-security \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wswitch-default \ - -Wswitch-enum \ - -Wunused \ - -Wunknown-pragmas \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wsystem-headers \ - -Wfloat-equal \ - -Wtraditional \ - -Wtraditional-conversion \ - -Wdeclaration-after-statement \ - -Wundef \ - -Wshadow \ - -Wunsafe-loop-optimizations \ - -Wpointer-arith \ + -Warray-bounds \ + -Wattributes \ -Wbad-function-cast \ - -Wc++-compat \ - -Wcast-qual \ + -Wbuiltin-macro-redefined \ -Wcast-align \ - -Wwrite-strings \ - -Wconversion \ - -Wsign-conversion \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wpacked \ - -Wpadded \ - -Wredundant-decls \ - -Wnested-externs \ - -Wunreachable-code \ - -Winline \ - -Winvalid-pch \ - -Wlong-long \ - -Wvla \ - -Wvolatile-register-var \ - -Wdisabled-optimization \ - -Wstack-protector \ - -Woverlength-strings \ - -Wbuiltin-macro-redefined \ - -Wmudflap \ - -Wpacked-bitfield-compat \ - -Wsync-nand \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # The following are not documented in the manual but are included in - # output from gcc --help=warnings. - for gl_manywarn_item in \ - -Wattributes \ + -Wchar-subscripts \ + -Wclobbered \ + -Wcomment \ + -Wcomments \ -Wcoverage-mismatch \ - -Wunused-macros \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # More warnings from gcc 4.6.2 --help=warnings. - for gl_manywarn_item in \ - -Wabi \ -Wcpp \ -Wdeprecated \ -Wdeprecated-declarations \ + -Wdisabled-optimization \ -Wdiv-by-zero \ -Wdouble-promotion \ + -Wempty-body \ -Wendif-labels \ + -Wenum-compare \ -Wextra \ -Wformat-contains-nul \ -Wformat-extra-args \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wformat-y2k \ -Wformat-zero-length \ -Wformat=2 \ + -Wfree-nonheap-object \ + -Wignored-qualifiers \ + -Wimplicit \ + -Wimplicit-function-declaration \ + -Wimplicit-int \ + -Winit-self \ + -Winline \ + -Wint-to-pointer-cast \ + -Winvalid-memory-model \ + -Winvalid-pch \ + -Wjump-misses-init \ + -Wlogical-op \ + -Wmain \ + -Wmaybe-uninitialized \ + -Wmissing-braces \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-format-attribute \ + -Wmissing-include-dirs \ + -Wmissing-noreturn \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wmudflap \ -Wmultichar \ + -Wnarrowing \ + -Wnested-externs \ + -Wnonnull \ -Wnormalized=nfc \ + -Wold-style-declaration \ + -Wold-style-definition \ -Woverflow \ + -Woverlength-strings \ + -Woverride-init \ + -Wpacked \ + -Wpacked-bitfield-compat \ + -Wparentheses \ + -Wpointer-arith \ + -Wpointer-sign \ -Wpointer-to-int-cast \ -Wpragmas \ + -Wreturn-type \ + -Wsequence-point \ + -Wshadow \ + -Wsizeof-pointer-memaccess \ + -Wstack-protector \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wstrict-prototypes \ -Wsuggest-attribute=const \ + -Wsuggest-attribute=format \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ + -Wswitch \ + -Wswitch-default \ + -Wsync-nand \ + -Wsystem-headers \ -Wtrampolines \ + -Wtrigraphs \ + -Wtype-limits \ + -Wuninitialized \ + -Wunknown-pragmas \ + -Wunreachable-code \ + -Wunsafe-loop-optimizations \ + -Wunused \ + -Wunused-but-set-parameter \ + -Wunused-but-set-variable \ + -Wunused-function \ + -Wunused-label \ + -Wunused-local-typedefs \ + -Wunused-macros \ + -Wunused-parameter \ + -Wunused-result \ + -Wunused-value \ + -Wunused-variable \ + -Wvarargs \ + -Wvariadic-macros \ + -Wvector-operation-performance \ + -Wvla \ + -Wvolatile-register-var \ + -Wwrite-strings \ + \ ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done @@ -10950,6 +10975,60 @@ fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then + + succeeded=no + + if test "$PKG_CONFIG" = "no" ; then + HAVE_GOBJECT=no + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-2.0 >= 2.0" >&5 +$as_echo_n "checking for gobject-2.0 >= 2.0... " >&6; } + + if $PKG_CONFIG --exists "gobject-2.0 >= 2.0" 2>&5 && + GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.0" 2>&5` && + GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.0" 2>&5`; then + edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // + " + GOBJECT_CFLAGS=`$as_echo "$GOBJECT_CFLAGS" | sed -e "$edit_cflags"` + GOBJECT_LIBS=`$as_echo "$GOBJECT_LIBS" | sed -e 's,///*,/,g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&5 +$as_echo "yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&6; } + succeeded=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + GOBJECT_CFLAGS="" + GOBJECT_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GOBJECT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gobject-2.0 >= 2.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + HAVE_GOBJECT=yes + else + HAVE_GOBJECT=no + fi + + 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: 109865 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 02:26:56 -0700 message: Merge from gnulib. This incorporates: 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles 2011-11-30 manywarnings: update the list of "all" warnings diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-02 11:13:24 +0000 +++ ChangeLog 2012-09-03 09:26:56 +0000 @@ -1,3 +1,9 @@ +2012-09-03 Paul Eggert + + Merge from gnulib, incorporating: + 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles + 2011-11-30 manywarnings: update the list of "all" warnings + 2012-09-02 Jan Djärv * configure.ac (HAVE_GOBJECT): Check for gobject-2.0 (Bug#12332). === modified file 'lib/stdbool.in.h' --- lib/stdbool.in.h 2012-05-26 23:14:36 +0000 +++ lib/stdbool.in.h 2012-09-03 09:26:56 +0000 @@ -66,24 +66,19 @@ # undef true #endif -/* For the sake of symbolic names in gdb, we define true and false as - enum constants, not only as macros. - It is tempting to write - typedef enum { false = 0, true = 1 } _Bool; - so that gdb prints values of type 'bool' symbolically. But if we do - this, values of type '_Bool' may promote to 'int' or 'unsigned int' - (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' - (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the - enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) +#ifdef __cplusplus +# define _Bool bool +# define bool bool +#else +# if defined __BEOS__ && !defined __HAIKU__ /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ typedef bool _Bool; -# endif -#else -# if !defined __GNUC__ +# endif +# else +# if !defined __GNUC__ /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See @@ -103,19 +98,35 @@ "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. The only benefit of the enum, debuggability, is not important with these compilers. So use 'signed char' and no enum. */ -# define _Bool signed char -# else +# define _Bool signed char +# else /* With this compiler, trust the _Bool type if the compiler has it. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ + /* For the sake of symbolic names in gdb, define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But then + values of type '_Bool' might promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif # endif # endif +# define bool _Bool #endif -#define bool _Bool /* The other macros must be usable in preprocessor directives. */ -#define false 0 -#define true 1 +#ifdef __cplusplus +# define false false +# define true true +#else +# define false 0 +# define true 1 +#endif + #define __bool_true_false_are_defined 1 #endif /* _GL_STDBOOL_H */ === modified file 'm4/manywarnings.m4' --- m4/manywarnings.m4 2012-05-28 00:46:33 +0000 +++ m4/manywarnings.m4 2012-09-03 09:26:56 +0000 @@ -81,95 +81,118 @@ gl_manywarn_set= for gl_manywarn_item in \ + -W \ + -Wabi \ + -Waddress \ -Wall \ - -W \ - -Wformat-y2k \ - -Wformat-nonliteral \ - -Wformat-security \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wswitch-default \ - -Wswitch-enum \ - -Wunused \ - -Wunknown-pragmas \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wsystem-headers \ - -Wfloat-equal \ - -Wtraditional \ - -Wtraditional-conversion \ - -Wdeclaration-after-statement \ - -Wundef \ - -Wshadow \ - -Wunsafe-loop-optimizations \ - -Wpointer-arith \ + -Warray-bounds \ + -Wattributes \ -Wbad-function-cast \ - -Wc++-compat \ - -Wcast-qual \ + -Wbuiltin-macro-redefined \ -Wcast-align \ - -Wwrite-strings \ - -Wconversion \ - -Wsign-conversion \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wpacked \ - -Wpadded \ - -Wredundant-decls \ - -Wnested-externs \ - -Wunreachable-code \ - -Winline \ - -Winvalid-pch \ - -Wlong-long \ - -Wvla \ - -Wvolatile-register-var \ - -Wdisabled-optimization \ - -Wstack-protector \ - -Woverlength-strings \ - -Wbuiltin-macro-redefined \ - -Wmudflap \ - -Wpacked-bitfield-compat \ - -Wsync-nand \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # The following are not documented in the manual but are included in - # output from gcc --help=warnings. - for gl_manywarn_item in \ - -Wattributes \ + -Wchar-subscripts \ + -Wclobbered \ + -Wcomment \ + -Wcomments \ -Wcoverage-mismatch \ - -Wunused-macros \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # More warnings from gcc 4.6.2 --help=warnings. - for gl_manywarn_item in \ - -Wabi \ -Wcpp \ -Wdeprecated \ -Wdeprecated-declarations \ + -Wdisabled-optimization \ -Wdiv-by-zero \ -Wdouble-promotion \ + -Wempty-body \ -Wendif-labels \ + -Wenum-compare \ -Wextra \ -Wformat-contains-nul \ -Wformat-extra-args \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wformat-y2k \ -Wformat-zero-length \ -Wformat=2 \ + -Wfree-nonheap-object \ + -Wignored-qualifiers \ + -Wimplicit \ + -Wimplicit-function-declaration \ + -Wimplicit-int \ + -Winit-self \ + -Winline \ + -Wint-to-pointer-cast \ + -Winvalid-memory-model \ + -Winvalid-pch \ + -Wjump-misses-init \ + -Wlogical-op \ + -Wmain \ + -Wmaybe-uninitialized \ + -Wmissing-braces \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-format-attribute \ + -Wmissing-include-dirs \ + -Wmissing-noreturn \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wmudflap \ -Wmultichar \ + -Wnarrowing \ + -Wnested-externs \ + -Wnonnull \ -Wnormalized=nfc \ + -Wold-style-declaration \ + -Wold-style-definition \ -Woverflow \ + -Woverlength-strings \ + -Woverride-init \ + -Wpacked \ + -Wpacked-bitfield-compat \ + -Wparentheses \ + -Wpointer-arith \ + -Wpointer-sign \ -Wpointer-to-int-cast \ -Wpragmas \ + -Wreturn-type \ + -Wsequence-point \ + -Wshadow \ + -Wsizeof-pointer-memaccess \ + -Wstack-protector \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wstrict-prototypes \ -Wsuggest-attribute=const \ + -Wsuggest-attribute=format \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ + -Wswitch \ + -Wswitch-default \ + -Wsync-nand \ + -Wsystem-headers \ -Wtrampolines \ + -Wtrigraphs \ + -Wtype-limits \ + -Wuninitialized \ + -Wunknown-pragmas \ + -Wunreachable-code \ + -Wunsafe-loop-optimizations \ + -Wunused \ + -Wunused-but-set-parameter \ + -Wunused-but-set-variable \ + -Wunused-function \ + -Wunused-label \ + -Wunused-local-typedefs \ + -Wunused-macros \ + -Wunused-parameter \ + -Wunused-result \ + -Wunused-value \ + -Wunused-variable \ + -Wvarargs \ + -Wvariadic-macros \ + -Wvector-operation-performance \ + -Wvla \ + -Wvolatile-register-var \ + -Wwrite-strings \ + \ ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done ------------------------------------------------------------ revno: 109864 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-09-03 02:22:43 -0700 message: Fix minor problems found by static checking. * buffer.c (Fdelete_all_overlays): Return nil. * doc.c (Fsubstitute_command_keys): * regex.c (WEAK_ALIAS): * xdisp.c (redisplay_internal): Move initialization down, to pacify GCC 4.7.1 -Wjump-misses-init. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-03 08:54:25 +0000 +++ src/ChangeLog 2012-09-03 09:22:43 +0000 @@ -1,3 +1,12 @@ +2012-09-03 Paul Eggert + + Fix minor problems found by static checking. + * buffer.c (Fdelete_all_overlays): Return nil. + * doc.c (Fsubstitute_command_keys): + * regex.c (WEAK_ALIAS): + * xdisp.c (redisplay_internal): + Move initialization down, to pacify GCC 4.7.1 -Wjump-misses-init. + 2012-09-03 Martin Rudalics * buffer.c (Fdelete_all_overlays): New function. === modified file 'src/buffer.c' --- src/buffer.c 2012-09-03 08:54:25 +0000 +++ src/buffer.c 2012-09-03 09:22:43 +0000 @@ -4091,6 +4091,7 @@ } delete_all_overlays (buf); + return Qnil; } /* Overlay dissection functions. */ === modified file 'src/doc.c' --- src/doc.c 2012-09-02 16:56:31 +0000 +++ src/doc.c 2012-09-03 09:22:43 +0000 @@ -848,9 +848,10 @@ struct buffer *oldbuf; ptrdiff_t start_idx; /* This is for computing the SHADOWS arg for describe_map_tree. */ - Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); + Lisp_Object active_maps; Lisp_Object earlier_maps; + active_maps = Fcurrent_active_maps (Qnil, Qnil); changed = 1; strp += 2; /* skip \{ or \< */ start = strp; === modified file 'src/regex.c' --- src/regex.c 2012-08-14 17:45:25 +0000 +++ src/regex.c 2012-09-03 09:22:43 +0000 @@ -5160,11 +5160,13 @@ { /* 1 if this match ends in the same string (string1 or string2) as the best previous match. */ - boolean same_str_p = (FIRST_STRING_P (match_end) - == FIRST_STRING_P (d)); + boolean same_str_p; /* 1 if this match is the best seen so far. */ boolean best_match_p; + same_str_p = (FIRST_STRING_P (match_end) + == FIRST_STRING_P (d)); + /* AIX compiler got confused when this was combined with the previous declaration. */ if (same_str_p) === modified file 'src/xdisp.c' --- src/xdisp.c 2012-09-02 17:10:35 +0000 +++ src/xdisp.c 2012-09-03 09:22:43 +0000 @@ -13511,9 +13511,10 @@ } else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { - Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); + Lisp_Object mini_window; struct frame *mini_frame; + mini_window = FRAME_MINIBUF_WINDOW (sf); displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ ------------------------------------------------------------ revno: 109863 committer: martin rudalics branch nick: trunk timestamp: Mon 2012-09-03 10:54:25 +0200 message: New macro with-temp-buffer-window and related fixes. * buffer.c (Fdelete_all_overlays): New function. * window.el (temp-buffer-window-setup-hook) (temp-buffer-window-show-hook): New hooks. (temp-buffer-window-setup, temp-buffer-window-show) (with-temp-buffer-window): New functions. (fit-window-to-buffer): Remove unused optional argument OVERRIDE. (special-display-popup-frame): Make sure the window used shows BUFFER. * help.el (temp-buffer-resize-mode): Fix doc-string. (resize-temp-buffer-window): New optional argument WINDOW. * files.el (recover-file, save-buffers-kill-emacs): * dired.el (dired-mark-pop-up): Use with-temp-buffer-window. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-02 09:31:45 +0000 +++ etc/NEWS 2012-09-03 08:54:25 +0000 @@ -631,6 +631,10 @@ *** The functions get-lru-window, get-mru-window and get-largest-window now accept a third argument to avoid choosing the selected window. +*** New macro with-temp-buffer-window. + +*** New display action function display-buffer-below-selected. + *** New display action alist `inhibit-switch-frame', if non-nil, tells display action functions to avoid changing which frame is selected. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-02 09:57:19 +0000 +++ lisp/ChangeLog 2012-09-03 08:54:25 +0000 @@ -1,3 +1,20 @@ +2012-09-03 Martin Rudalics + + * window.el (temp-buffer-window-setup-hook) + (temp-buffer-window-show-hook): New hooks. + (temp-buffer-window-setup, temp-buffer-window-show) + (with-temp-buffer-window): New functions. + (fit-window-to-buffer): Remove unused optional argument + OVERRIDE. + (special-display-popup-frame): Make sure the window used shows + BUFFER. + + * help.el (temp-buffer-resize-mode): Fix doc-string. + (resize-temp-buffer-window): New optional argument WINDOW. + + * files.el (recover-file, save-buffers-kill-emacs): + * dired.el (dired-mark-pop-up): Use with-temp-buffer-window. + 2012-09-02 Michael Albinus * eshell/em-unix.el (eshell/sudo): When we have an ad-hoc === modified file 'lisp/dired.el' --- lisp/dired.el 2012-09-02 02:47:02 +0000 +++ lisp/dired.el 2012-09-03 08:54:25 +0000 @@ -2973,36 +2973,43 @@ (const shell) (const symlink) (const touch) (const uncompress)))) -(defun dired-mark-pop-up (bufname op-symbol files function &rest args) +(defun dired-mark-pop-up (buffer-or-name op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. -Displays the file names in a buffer named BUFNAME; - nil gives \" *Marked Files*\". -This uses function `dired-pop-to-buffer' to do that. +Displays the file names in a window showing a buffer named +BUFFER-OR-NAME; the default name being \" *Marked Files*\". The +window is not shown if there is just one file, `dired-no-confirm' +is t, or OP-SYMBOL is a member of the list in `dired-no-confirm'. -FUNCTION should not manipulate files, just read input - (an argument or confirmation). -The window is not shown if there is just one file or - OP-SYMBOL is a member of the list in `dired-no-confirm'. FILES is the list of marked files. It can also be (t FILENAME) in the case of one marked file, to distinguish that from using -just the current file." - (or bufname (setq bufname " *Marked Files*")) +just the current file. + +FUNCTION should not manipulate files, just read input \(an +argument or confirmation)." (if (or (eq dired-no-confirm t) (memq op-symbol dired-no-confirm) ;; If FILES defaulted to the current line's file. (= (length files) 1)) (apply function args) - (with-current-buffer (get-buffer-create bufname) - (erase-buffer) - ;; Handle (t FILE) just like (FILE), here. - ;; That value is used (only in some cases), to mean - ;; just one file that was marked, rather than the current line file. - (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files)) - (remove-text-properties (point-min) (point-max) - '(mouse-face nil help-echo nil))) - (save-window-excursion - (dired-pop-to-buffer bufname) - (apply function args)))) + (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))) + (with-current-buffer buffer + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected nil) + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (apply function args) + (when (window-live-p window) + (quit-restore-window window 'kill))))) + ;; Handle (t FILE) just like (FILE), here. That value is + ;; used (only in some cases), to mean just one file that was + ;; marked, rather than the current line file. + (dired-format-columns-of-files + (if (eq (car files) t) (cdr files) files)) + (remove-text-properties (point-min) (point-max) + '(mouse-face nil help-echo nil)))))))) (defun dired-format-columns-of-files (files) (let ((beg (point))) === modified file 'lisp/files.el' --- lisp/files.el 2012-08-29 17:36:49 +0000 +++ lisp/files.el 2012-09-03 08:54:25 +0000 @@ -5350,23 +5350,26 @@ (not (file-exists-p file-name))) (error "Auto-save file %s not current" (abbreviate-file-name file-name))) - ((save-window-excursion - (with-output-to-temp-buffer "*Directory*" - (buffer-disable-undo standard-output) - (save-excursion - (let ((switches dired-listing-switches)) - (if (file-symlink-p file) - (setq switches (concat switches " -L"))) - (set-buffer standard-output) - ;; Use insert-directory-safely, not insert-directory, - ;; because these files might not exist. In particular, - ;; FILE might not exist if the auto-save file was for - ;; a buffer that didn't visit a file, such as "*mail*". - ;; The code in v20.x called `ls' directly, so we need - ;; to emulate what `ls' did in that case. - (insert-directory-safely file switches) - (insert-directory-safely file-name switches)))) - (yes-or-no-p (format "Recover auto save file %s? " file-name))) + ((with-temp-buffer-window + "*Directory*" nil + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (yes-or-no-p (format "Recover auto save file %s? " file-name)) + (when (window-live-p window) + (quit-restore-window window 'kill))))) + (with-current-buffer standard-output + (let ((switches dired-listing-switches)) + (if (file-symlink-p file) + (setq switches (concat switches " -L"))) + ;; Use insert-directory-safely, not insert-directory, + ;; because these files might not exist. In particular, + ;; FILE might not exist if the auto-save file was for + ;; a buffer that didn't visit a file, such as "*mail*". + ;; The code in v20.x called `ls' directly, so we need + ;; to emulate what `ls' did in that case. + (insert-directory-safely file switches) + (insert-directory-safely file-name switches)))) (switch-to-buffer (find-file-noselect file t)) (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system. @@ -6327,8 +6330,15 @@ (setq active t)) (setq processes (cdr processes))) (or (not active) - (progn (list-processes t) - (yes-or-no-p "Active processes exist; kill them and exit anyway? "))))) + (with-temp-buffer-window + (get-buffer-create "*Process List*") nil + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (yes-or-no-p "Active processes exist; kill them and exit anyway? ") + (when (window-live-p window) + (quit-restore-window window 'kill))))) + (list-processes t))))) ;; Query the user for other things, perhaps. (run-hook-with-args-until-failure 'kill-emacs-query-functions) (or (null confirm-kill-emacs) === modified file 'lisp/help.el' --- lisp/help.el 2012-08-26 13:42:18 +0000 +++ lisp/help.el 2012-09-03 08:54:25 +0000 @@ -39,9 +39,10 @@ ;; `help-window-point-marker' is a marker you can move to a valid ;; position of the buffer shown in the help window in order to override ;; the standard positioning mechanism (`point-min') chosen by -;; `with-output-to-temp-buffer'. `with-help-window' has this point -;; nowhere before exiting. Currently used by `view-lossage' to assert -;; that the last keystrokes are always visible. +;; `with-output-to-temp-buffer' and `with-temp-buffer-window'. +;; `with-help-window' has this point nowhere before exiting. Currently +;; used by `view-lossage' to assert that the last keystrokes are always +;; visible. (defvar help-window-point-marker (make-marker) "Marker to override default `window-point' in help windows.") @@ -975,13 +976,13 @@ :version "20.4") (define-minor-mode temp-buffer-resize-mode - "Toggle auto-shrinking temp buffer windows (Temp Buffer Resize mode). + "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode). With a prefix argument ARG, enable Temp Buffer Resize mode if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. When Temp Buffer Resize mode is enabled, the windows in which we -show a temporary buffer are automatically reduced in height to +show a temporary buffer are automatically resized in height to fit the buffer's contents, but never more than `temp-buffer-max-height' nor less than `window-min-height'. @@ -994,19 +995,22 @@ (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append) (remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window))) -(defun resize-temp-buffer-window () - "Resize the selected window to fit its contents. -Will not make it higher than `temp-buffer-max-height' nor smaller -than `window-min-height'. Do nothing if the selected window is -not vertically combined or some of its contents are scrolled out -of view." - (when (and (pos-visible-in-window-p (point-min)) - (window-combined-p)) - (fit-window-to-buffer - nil - (if (functionp temp-buffer-max-height) - (funcall temp-buffer-max-height (window-buffer)) - temp-buffer-max-height)))) +(defun resize-temp-buffer-window (&optional window) + "Resize WINDOW to fit its contents. +WINDOW can be any live window and defaults to the selected one. + +Do not make WINDOW higher than `temp-buffer-max-height' nor +smaller than `window-min-height'. Do nothing if WINDOW is not +vertically combined or some of its contents are scrolled out of +view." + (setq window (window-normalize-window window t)) + (let ((height (if (functionp temp-buffer-max-height) + (with-selected-window window + (funcall temp-buffer-max-height (window-buffer))) + temp-buffer-max-height))) + (when (and (pos-visible-in-window-p (point-min) window) + (window-combined-p window)) + (fit-window-to-buffer window height)))) ;;; Help windows. (defcustom help-window-select 'other === modified file 'lisp/window.el' --- lisp/window.el 2012-09-01 16:47:09 +0000 +++ lisp/window.el 2012-09-03 08:54:25 +0000 @@ -73,6 +73,108 @@ (when (window-live-p save-selected-window-window) (select-window save-selected-window-window 'norecord)))))) +(defvar temp-buffer-window-setup-hook nil + "Normal hook run by `with-temp-buffer-window' before buffer display. +This hook is run by `with-temp-buffer-window' with the buffer to be +displayed current.") + +(defvar temp-buffer-window-show-hook nil + "Normal hook run by `with-temp-buffer-window' after buffer display. +This hook is run by `with-temp-buffer-window' with the buffer +displayed and current and its window selected.") + +(defun temp-buffer-window-setup (buffer-or-name) + "Set up temporary buffer specified by BUFFER-OR-NAME +Return the buffer." + (let ((old-dir default-directory) + (buffer (get-buffer-create buffer-or-name))) + (with-current-buffer buffer + (kill-all-local-variables) + (setq default-directory old-dir) + (delete-all-overlays) + (setq buffer-read-only nil) + (setq buffer-file-name nil) + (setq buffer-undo-list t) + (let ((inhibit-read-only t) + (inhibit-modification-hooks t)) + (erase-buffer) + (run-hooks 'temp-buffer-window-setup-hook)) + ;; Return the buffer. + buffer))) + +(defun temp-buffer-window-show (&optional buffer action) + "Show temporary buffer BUFFER in a window. +Return the window showing BUFFER. Pass ACTION as action argument +to `display-buffer'." + (let (window frame) + (with-current-buffer buffer + (set-buffer-modified-p nil) + (setq buffer-read-only t) + (goto-char (point-min)) + (when (setq window (display-buffer buffer action)) + (setq frame (window-frame window)) + (unless (eq frame (selected-frame)) + (raise-frame frame)) + (setq minibuffer-scroll-window window) + (set-window-hscroll window 0) + (with-selected-window window + (run-hooks 'temp-buffer-window-show-hook) + (when temp-buffer-resize-mode + (resize-temp-buffer-window window))) + ;; Return the window. + window)))) + +(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body) + "Evaluate BODY and display buffer specified by BUFFER-OR-NAME. +BUFFER-OR-NAME must specify either a live buffer or the name of a +buffer. If no buffer with such a name exists, create one. + +Make sure the specified buffer is empty before evaluating BODY. +Do not make that buffer current for BODY. Instead, bind +`standard-output' to that buffer, so that output generated with +`prin1' and similar functions in BODY goes into that buffer. + +After evaluating BODY, mark the specified buffer unmodified and +read-only, and display it in a window via `display-buffer'. Pass +ACTION as action argument to `display-buffer'. Automatically +shrink the window used if `temp-buffer-resize-mode' is enabled. + +Return the value returned by BODY unless QUIT-FUNCTION specifies +a function. In that case, run the function with two arguments - +the window showing the specified buffer and the value returned by +BODY - and return the value returned by that function. + +If the buffer is displayed on a new frame, the window manager may +decide to select that frame. In that case, it's usually a good +strategy if the function specified by QUIT-FUNCTION selects the +window showing the buffer before reading a value from the +minibuffer, for example, when asking a `yes-or-no-p' question. + +This construct is similar to `with-output-to-temp-buffer' but +does neither put the buffer in help mode nor does it call +`temp-buffer-show-function'. It also runs different hooks, +namely `temp-buffer-window-setup-hook' (with the specified buffer +current) and `temp-buffer-window-show-hook' (with the specified +buffer current and the window showing it selected). + +Since this macro calls `display-buffer', the window displaying +the buffer is usually not selected and the specified buffer +usually not made current. QUIT-FUNCTION can override that." + (declare (debug t)) + (let ((buffer (make-symbol "buffer")) + (window (make-symbol "window")) + (value (make-symbol "value"))) + `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name)) + (standard-output ,buffer) + ,window ,value) + (with-current-buffer ,buffer + (setq ,value (progn ,@body)) + (setq ,window (temp-buffer-window-show ,buffer ,action))) + + (if (functionp ,quit-function) + (funcall ,quit-function ,window ,value) + ,value)))) + ;; The following two functions are like `window-next-sibling' and ;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so ;; they don't substitute the selected window for nil), and they return @@ -4696,6 +4798,9 @@ (make-frame (append args special-display-frame-alist)))) (window (frame-selected-window frame))) (display-buffer-record-window 'frame window buffer) + (unless (eq buffer (window-buffer window)) + (set-window-buffer window buffer) + (set-window-prev-buffers window nil)) (set-window-dedicated-p window t) window))))) @@ -5710,7 +5815,7 @@ window)))) ;;; Resizing buffers to fit their contents exactly. -(defun fit-window-to-buffer (&optional window max-height min-height override) +(defun fit-window-to-buffer (&optional window max-height min-height) "Adjust height of WINDOW to display its buffer's contents exactly. WINDOW must be a live window and defaults to the selected one. @@ -5721,10 +5826,6 @@ are specified in lines and include the mode line and header line, if any. -Optional argument OVERRIDE non-nil means override restrictions -imposed by `window-min-height' and `window-min-width' on the size -of WINDOW. - Return the number of lines by which WINDOW was enlarged or shrunk. If an error occurs during resizing, return nil but don't signal an error. @@ -5733,28 +5834,27 @@ _all_ lines of its buffer you might not see the first lines when WINDOW was scrolled." (interactive) - ;; Do all the work in WINDOW and its buffer and restore the selected - ;; window and the current buffer when we're done. (setq window (window-normalize-window window t)) ;; Can't resize a full height or fixed-size window. (unless (or (window-size-fixed-p window) (window-full-height-p window)) - ;; `with-selected-window' should orderly restore the current buffer. (with-selected-window window - ;; We are in WINDOW's buffer now. - (let* (;; Adjust MIN-HEIGHT. + (let* ((height (window-total-size)) (min-height - (if override - (window-min-size window nil window) - (max (or min-height window-min-height) - window-safe-min-height))) - (max-window-height - (window-total-size (frame-root-window window))) - ;; Adjust MAX-HEIGHT. + ;; Adjust MIN-HEIGHT. + (if (numberp min-height) + ;; Can't get smaller than `window-safe-min-height'. + (max min-height window-safe-min-height) + ;; Preserve header and mode line if present. + (window-min-size nil nil t))) (max-height - (if (or override (not max-height)) - max-window-height - (min max-height max-window-height))) + ;; Adjust MAX-HEIGHT. + (if (numberp max-height) + ;; Can't get larger than height of frame. + (min max-height + (window-total-size (frame-root-window window))) + ;, Don't delete other windows. + (+ height (window-max-delta nil nil window)))) ;; Make `desired-height' the height necessary to show ;; all of WINDOW's buffer, constrained by MIN-HEIGHT ;; and MAX-HEIGHT. @@ -5779,7 +5879,6 @@ (window-max-delta window nil window)) (max desired-delta (- (window-min-delta window nil window)))))) - ;; This `condition-case' shouldn't be necessary, but who knows? (condition-case nil (if (zerop delta) ;; Return zero if DELTA became zero in the process. === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-03 08:13:33 +0000 +++ src/ChangeLog 2012-09-03 08:54:25 +0000 @@ -1,3 +1,7 @@ +2012-09-03 Martin Rudalics + + * buffer.c (Fdelete_all_overlays): New function. + 2012-09-03 Chong Yidong * gtkutil.c: Add extern decl for Qxft. === modified file 'src/buffer.c' --- src/buffer.c 2012-08-28 10:59:17 +0000 +++ src/buffer.c 2012-09-03 08:54:25 +0000 @@ -4073,6 +4073,25 @@ return unbind_to (count, Qnil); } + +DEFUN ("delete-all-overlays", Fdelete_all_overlays, Sdelete_all_overlays, 0, 1, 0, + doc: /* Delete all overlays of BUFFER. +BUFFER omitted or nil means delete all overlays of the current +buffer. */) + (Lisp_Object buffer) +{ + register struct buffer *buf; + + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + } + + delete_all_overlays (buf); +} /* Overlay dissection functions. */ @@ -6286,6 +6305,7 @@ defsubr (&Soverlayp); defsubr (&Smake_overlay); defsubr (&Sdelete_overlay); + defsubr (&Sdelete_all_overlays); defsubr (&Smove_overlay); defsubr (&Soverlay_start); defsubr (&Soverlay_end); ------------------------------------------------------------ revno: 109862 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-09-03 16:13:33 +0800 message: * gtkutil.c: Add extern decl for Qxft. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-02 17:10:35 +0000 +++ src/ChangeLog 2012-09-03 08:13:33 +0000 @@ -1,3 +1,7 @@ +2012-09-03 Chong Yidong + + * gtkutil.c: Add extern decl for Qxft. + 2012-09-02 Paul Eggert * emacs.c, eval.c: Use bool for boolean. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-09-02 16:56:31 +0000 +++ src/gtkutil.c 2012-09-03 08:13:33 +0000 @@ -2038,6 +2038,7 @@ static char *x_last_font_name; +extern Lisp_Object Qxft; /* Pop up a GTK font selector and return the name of the font the user selects, as a C string. The returned font name follows GTK's own ------------------------------------------------------------ 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\