Now on revision 110794. 1 tag(s) updated. ------------------------------------------------------------ revno: 110794 fixes bug: http://debbugs.gnu.org/7850 committer: Glenn Morris branch nick: trunk timestamp: Sat 2012-11-03 21:13:13 -0700 message: * lisp/vc/vc-svn.el (vc-svn-state-heuristic): Avoid calling svn. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-04 03:25:18 +0000 +++ lisp/ChangeLog 2012-11-04 04:13:13 +0000 @@ -1,3 +1,7 @@ +2012-11-04 Glenn Morris + + * vc/vc-svn.el (vc-svn-state-heuristic): Avoid calling svn. (Bug#7850) + 2012-11-04 Chong Yidong * bookmark.el (bookmark-bmenu-switch-other-window): Avoid binding === modified file 'lisp/vc/vc-svn.el' --- lisp/vc/vc-svn.el 2012-02-25 04:29:09 +0000 +++ lisp/vc/vc-svn.el 2012-11-04 04:13:13 +0000 @@ -155,9 +155,24 @@ (vc-svn-command t 0 file "status" (if localp "-v" "-u")) (vc-svn-parse-status file)))) +;; NB this does not handle svn properties, which can be changed +;; without changing the file timestamp. +;; Note that unlike vc-cvs-state-heuristic, this is not called from +;; vc-svn-state. AFAICS, it is only called from vc-state-refresh via +;; vc-after-save (bug#7850). Therefore the fact that it ignores +;; properties is irrelevant. If you want to make vc-svn-state call +;; this, it should be extended to handle svn properties. (defun vc-svn-state-heuristic (file) "SVN-specific state heuristic." - (vc-svn-state file 'local)) + ;; If the file has not changed since checkout, consider it `up-to-date'. + ;; Otherwise consider it `edited'. Copied from vc-cvs-state-heuristic. + (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) + (lastmod (nth 5 (file-attributes file)))) + (cond + ((equal checkout-time lastmod) 'up-to-date) + ((string= (vc-working-revision file) "0") 'added) + ((null checkout-time) 'unregistered) + (t 'edited)))) ;; FIXME it would be better not to have the "remote" argument, ;; but to distinguish the two output formats based on content. ------------------------------------------------------------ revno: 110793 fixes bug: http://debbugs.gnu.org/8680 author: Michael Marchionna committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-11-04 11:34:10 +0800 message: * nsterm.m: Add NSClearLineFunctionKey and keypad keys. (keyDown): Remap keypad keys to X11 virtual key codes. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 20:48:03 +0000 +++ src/ChangeLog 2012-11-04 03:34:10 +0000 @@ -1,3 +1,8 @@ +2012-11-04 Michael Marchionna + + * nsterm.m: Add NSClearLineFunctionKey and keypad keys (Bug#8680). + (keyDown): Remap keypad keys to X11 virtual key codes. + 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). === modified file 'src/nsterm.m' --- src/nsterm.m 2012-10-28 16:10:06 +0000 +++ src/nsterm.m 2012-11-04 03:34:10 +0000 @@ -100,6 +100,7 @@ NSBeginFunctionKey, 0x58, NSSelectFunctionKey, 0x60, NSPrintFunctionKey, 0x61, + NSClearLineFunctionKey, 0x0B, NSExecuteFunctionKey, 0x62, NSInsertFunctionKey, 0x63, NSUndoFunctionKey, 0x65, @@ -144,6 +145,23 @@ NSNewlineCharacter, 0x0D, NSEnterCharacter, 0x8D, + 0x41, 0xAE, /* KP_Decimal */ + 0x43, 0xAA, /* KP_Multiply */ + 0x45, 0xAB, /* KP_Add */ + 0x4B, 0xAF, /* KP_Divide */ + 0x4E, 0xAD, /* KP_Subtract */ + 0x51, 0xBD, /* KP_Equal */ + 0x52, 0xB0, /* KP_0 */ + 0x53, 0xB1, /* KP_1 */ + 0x54, 0xB2, /* KP_2 */ + 0x55, 0xB3, /* KP_3 */ + 0x56, 0xB4, /* KP_4 */ + 0x57, 0xB5, /* KP_5 */ + 0x58, 0xB6, /* KP_6 */ + 0x59, 0xB7, /* KP_7 */ + 0x5B, 0xB8, /* KP_8 */ + 0x5C, 0xB9, /* KP_9 */ + 0x1B, 0x1B /* escape */ }; @@ -4754,12 +4772,12 @@ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); int code; unsigned fnKeysym = 0; - int flags; static NSMutableArray *nsEvArray; #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 static BOOL firstTime = YES; #endif int left_is_none; + unsigned int flags = [theEvent modifierFlags]; NSTRACE (keyDown); @@ -4810,7 +4828,10 @@ /* (Carbon way: [theEvent keyCode]) */ /* is it a "function key"? */ - fnKeysym = ns_convert_key (code); + fnKeysym = (code < 0x00ff && (flags&NSNumericPadKeyMask)) + ? ns_convert_key ([theEvent keyCode]) + : ns_convert_key (code); + if (fnKeysym) { /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', @@ -4823,7 +4844,6 @@ /* are there modifiers? */ emacs_event->modifiers = 0; - flags = [theEvent modifierFlags]; if (flags & NSHelpKeyMask) emacs_event->modifiers |= hyper_modifier; ------------------------------------------------------------ revno: 110792 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-11-04 11:25:18 +0800 message: * bookmark.el (bookmark-bmenu-switch-other-window): Avoid binding same-window-* variables. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-04 03:24:00 +0000 +++ lisp/ChangeLog 2012-11-04 03:25:18 +0000 @@ -1,3 +1,8 @@ +2012-11-04 Chong Yidong + + * bookmark.el (bookmark-bmenu-switch-other-window): Avoid binding + same-window-* variables. + 2012-11-04 Juri Linkov * isearch.el (isearch-help-for-help, isearch-describe-bindings) === modified file 'lisp/bookmark.el' --- lisp/bookmark.el 2012-10-26 17:20:54 +0000 +++ lisp/bookmark.el 2012-11-04 03:25:18 +0000 @@ -1873,10 +1873,8 @@ The current window remains selected." (interactive) (let ((bookmark (bookmark-bmenu-bookmark)) - (pop-up-windows t) - same-window-buffer-names - same-window-regexps) - (bookmark--jump-via bookmark 'display-buffer))) + (fun (lambda (b) (display-buffer b t)))) + (bookmark--jump-via bookmark fun))) (defun bookmark-bmenu-other-window-with-mouse (event) "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible." ------------------------------------------------------------ revno: 110791 fixes bug: http://debbugs.gnu.org/10040 author: Juri Linkov committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-11-04 11:24:00 +0800 message: Don't bind same-window-* in isearch.el commands. * isearch.el (isearch-help-for-help, isearch-describe-bindings) (isearch-describe-key, isearch-describe-mode): Use a display action instead of binding same-window-* variables. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-03 19:14:22 +0000 +++ lisp/ChangeLog 2012-11-04 03:24:00 +0000 @@ -1,3 +1,9 @@ +2012-11-04 Juri Linkov + + * isearch.el (isearch-help-for-help, isearch-describe-bindings) + (isearch-describe-key, isearch-describe-mode): Use a display + action instead of binding same-window-* variables (Bug#10040). + 2012-11-03 Glenn Morris * emacs-lisp/cl-macs.el (cl-parse-loop-clause): === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-10-30 06:23:31 +0000 +++ lisp/isearch.el 2012-11-04 03:24:00 +0000 @@ -374,10 +374,12 @@ they exit Isearch mode before displaying global help." isearch-help-map) +(defvar isearch--display-help-action '(nil (inhibit-same-window . t))) + (defun isearch-help-for-help () "Display Isearch help menu." (interactive) - (let (same-window-buffer-names same-window-regexps) + (let ((display-buffer-overriding-action isearch--display-help-action)) (isearch-help-for-help-internal)) (isearch-update)) @@ -385,7 +387,7 @@ "Show a list of all keys defined in Isearch mode, and their definitions. This is like `describe-bindings', but displays only Isearch keys." (interactive) - (let (same-window-buffer-names same-window-regexps) + (let ((display-buffer-overriding-action isearch--display-help-action)) (with-help-window "*Help*" (with-current-buffer standard-output (princ "Isearch Mode Bindings:\n") @@ -394,14 +396,14 @@ (defun isearch-describe-key () "Display documentation of the function invoked by isearch key." (interactive) - (let (same-window-buffer-names same-window-regexps) + (let ((display-buffer-overriding-action isearch--display-help-action)) (call-interactively 'describe-key)) (isearch-update)) (defun isearch-describe-mode () "Display documentation of Isearch mode." (interactive) - (let (same-window-buffer-names same-window-regexps) + (let ((display-buffer-overriding-action isearch--display-help-action)) (describe-function 'isearch-forward)) (isearch-update)) ------------------------------------------------------------ revno: 110790 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-11-03 22:48:03 +0200 message: Fix order of entries in ChangeLog files. diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-03 20:43:29 +0000 +++ ChangeLog 2012-11-03 20:48:03 +0000 @@ -5,8 +5,6 @@ ($(BLD)/close-stream.$(O)): ($(BLD)/fpending.$(O)): New dependencies. - * config.bat: Copy lib/execinfo.in.h to lib/execinfo.in-h if needed. - 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). @@ -15,6 +13,10 @@ New files, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. +2012-11-03 Eli Zaretskii + + * config.bat: Copy lib/execinfo.in.h to lib/execinfo.in-h if needed. + 2012-11-02 Glenn Morris * Makefile.in (EMACS_ICON): New variable. === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 19:14:22 +0000 +++ src/ChangeLog 2012-11-03 20:48:03 +0000 @@ -1,21 +1,3 @@ -2012-11-03 Eli Zaretskii - - * lisp.mk: Adjust comments to the fact that term/internal is now - loaded from loadup.el. - - * msdos.c (msdos_abort): Rename from emacs_abort, and make static. - (msdos_fatal_signal): New function. - (XMenuActivate): Adjust the call to kbd_buffer_events_waiting to - its argument list. - - * conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Define to "inline" - for GCC versions before 4. - (emacs_raise): Define to call msdos_fatal_signal. - - * xdisp.c (init_from_display_pos): Fix initialization of the bidi - iterator when starting in the middle of a display or overlay - string. (Bug#12745) - 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). @@ -62,6 +44,24 @@ these symbols as enums or as constants, since we now assume gcc -g3 when debugging. +2012-11-03 Eli Zaretskii + + * lisp.mk: Adjust comments to the fact that term/internal is now + loaded from loadup.el. + + * msdos.c (msdos_abort): Rename from emacs_abort, and make static. + (msdos_fatal_signal): New function. + (XMenuActivate): Adjust the call to kbd_buffer_events_waiting to + its argument list. + + * conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Define to "inline" + for GCC versions before 4. + (emacs_raise): Define to call msdos_fatal_signal. + + * xdisp.c (init_from_display_pos): Fix initialization of the bidi + iterator when starting in the middle of a display or overlay + string. (Bug#12745) + 2012-11-03 Chong Yidong * process.c (wait_reading_process_output): Clean up the last ------------------------------------------------------------ revno: 110789 fixes bug: http://debbugs.gnu.org/9574 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-11-03 22:43:29 +0200 message: Fix Windows build as fallout from revision 110786. nt/config.nt (PENDING_OUTPUT_N_BYTES): Define. lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/fpending.$(O) and $(BLD)/close-stream.$(O). ($(BLD)/close-stream.$(O)): ($(BLD)/fpending.$(O)): New dependencies. diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-03 19:14:22 +0000 +++ ChangeLog 2012-11-03 20:43:29 +0000 @@ -1,5 +1,10 @@ 2012-11-03 Eli Zaretskii + * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/fpending.$(O) and + $(BLD)/close-stream.$(O). + ($(BLD)/close-stream.$(O)): + ($(BLD)/fpending.$(O)): New dependencies. + * config.bat: Copy lib/execinfo.in.h to lib/execinfo.in-h if needed. 2012-11-03 Paul Eggert === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2012-08-25 10:04:17 +0000 +++ lib/makefile.w32-in 2012-11-03 20:43:29 +0000 @@ -26,9 +26,11 @@ GNULIBOBJS = $(BLD)/c-ctype.$(O) \ $(BLD)/c-strcasecmp.$(O) \ $(BLD)/c-strncasecmp.$(O) \ + $(BLD)/close-stream.$(O) \ $(BLD)/dtoastr.$(O) \ $(BLD)/dtotimespec.$(O) \ $(BLD)/execinfo.$(O) \ + $(BLD)/fpending.$(O) \ $(BLD)/getopt.$(O) \ $(BLD)/getopt1.$(O) \ $(BLD)/gettime.$(O) \ @@ -114,6 +116,13 @@ $(CONFIG_H) \ $(C_CTYPE_H) +$(BLD)/close-stream.$(O) : \ + $(GNU_LIB)/close-stream.c \ + $(GNU_LIB)/close-stream.h \ + $(GNU_LIB)/fpending.h \ + $(NT_INC)/stdbool.h \ + $(CONFIG_H) + $(BLD)/c-strncasecmp.$(O) : \ $(GNU_LIB)/c-strncasecmp.c \ $(GNU_LIB)/c-strcase.h \ @@ -135,6 +144,11 @@ $(GNU_LIB)/execinfo.h \ $(CONFIG_H) +$(BLD)/fpending.$(O) : \ + $(GNU_LIB)/fpending.c \ + $(GNU_LIB)/fpending.h \ + $(CONFIG_H) + $(BLD)/getopt.$(O) : \ $(GNU_LIB)/getopt.c \ $(GNU_LIB)/getopt.h \ === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-11-01 14:21:45 +0000 +++ nt/ChangeLog 2012-11-03 20:43:29 +0000 @@ -1,3 +1,7 @@ +2012-11-03 Eli Zaretskii + + * config.nt (PENDING_OUTPUT_N_BYTES): Define. + 2012-11-01 Eli Zaretskii * inc/unistd.h (setpgid, getpgrp): Provide prototypes. (Bug#12776) === modified file 'nt/config.nt' --- nt/config.nt 2012-11-02 00:48:12 +0000 +++ nt/config.nt 2012-11-03 20:43:29 +0000 @@ -1219,6 +1219,9 @@ /* Number of chars of output in the buffer of a stdio stream. */ #undef PENDING_OUTPUT_COUNT +/* the number of pending output bytes on stream 'fp' */ +#define PENDING_OUTPUT_N_BYTES (fp->_ptr - fp->_base) + /* Define to empty to suppress deprecation warnings when building with --enable-gcc-warnings and with libpng versions before 1.5, which lack png_longjmp. */ ------------------------------------------------------------ revno: 110788 committer: Glenn Morris branch nick: trunk timestamp: Sat 2012-11-03 12:19:05 -0700 message: * admin/admin.el (set-copyright): Add msdos/sed2v2.inp. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-11-03 18:54:17 +0000 +++ admin/ChangeLog 2012-11-03 19:19:05 +0000 @@ -1,3 +1,7 @@ +2012-11-03 Glenn Morris + + * admin.el (set-copyright): Add msdos/sed2v2.inp. + 2012-11-01 Paul Eggert Fix data-loss with --batch (Bug#9574). === modified file 'admin/admin.el' --- admin/admin.el 2012-10-09 07:00:23 +0000 +++ admin/admin.el 2012-11-03 19:19:05 +0000 @@ -158,6 +158,10 @@ (set-version-in-file root "configure.ac" copyright (rx (and bol "copyright" (0+ (not (in ?\"))) ?\" (submatch (1+ (not (in ?\")))) ?\"))) + (set-version-in-file root "msdos/sed2v2.inp" copyright + (rx (and bol "/^#undef " (1+ not-newline) + "define COPYRIGHT" (1+ space) + ?\" (submatch (1+ (not (in ?\")))) ?\"))) (set-version-in-file root "nt/config.nt" copyright (rx (and bol "#" (0+ blank) "define" (1+ blank) "COPYRIGHT" (1+ blank) ------------------------------------------------------------ revno: 110787 [merge] committer: Glenn Morris branch nick: trunk timestamp: Sat 2012-11-03 12:14:22 -0700 message: Merge from emacs-24; up to r110778 diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-03 18:54:17 +0000 +++ ChangeLog 2012-11-03 19:14:22 +0000 @@ -1,3 +1,7 @@ +2012-11-03 Eli Zaretskii + + * config.bat: Copy lib/execinfo.in.h to lib/execinfo.in-h if needed. + 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). === modified file 'config.bat' --- config.bat 2012-07-28 23:05:32 +0000 +++ config.bat 2012-11-03 13:48:33 +0000 @@ -264,6 +264,7 @@ Rem Rename files like djtar on plain DOS filesystem would. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h If Exist alloca.in.h update alloca.in.h alloca.in-h +If Exist execinfo.in.h update execinfo.in.h execinfo.in-h If Exist getopt.in.h update getopt.in.h getopt.in-h If Exist stdalign.in.h update stdalign.in.h stdalign.in-h If Exist stdbool.in.h update stdbool.in.h stdbool.in-h === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-10-31 21:00:57 +0000 +++ doc/lispref/ChangeLog 2012-11-03 11:02:43 +0000 @@ -1,3 +1,27 @@ +2012-11-03 Chong Yidong + + * objects.texi (General Escape Syntax): Clarify the explanation of + escape sequences. + (Non-ASCII in Strings): Clarify when a string is unibyte vs + multibyte. Hex escapes do not automatically make a string + multibyte. + +2012-11-03 Martin Rudalics + + * windows.texi (Switching Buffers): Document option + switch-to-buffer-preserve-window-point. + (Display Action Functions): Document window-height and + window-width alist entries. + (Display Action Functions): Document + display-buffer-below-selected and + display-buffer-in-previous-window. + (Quitting Windows): Document quit-restore-window. Rewrite + section. + (Window Configurations): In window-state-get mention that + argument window must be valid. + (Window Parameters): Document quit-restore window parameter + (Bug#12158). + 2012-10-31 Glenn Morris * control.texi (Catch and Throw): Add xref to cl.texi. === modified file 'doc/lispref/objects.texi' --- doc/lispref/objects.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/objects.texi 2012-11-03 16:54:11 +0000 @@ -351,51 +351,48 @@ control characters, Emacs provides several types of escape syntax that you can use to specify non-@acronym{ASCII} text characters. -@cindex unicode character escape - You can specify characters by their Unicode values. -@code{?\u@var{nnnn}} represents a character that maps to the Unicode -code point @samp{U+@var{nnnn}} (by convention, Unicode code points are -given in hexadecimal). There is a slightly different syntax for -specifying characters with code points higher than -@code{U+@var{ffff}}: @code{\U00@var{nnnnnn}} represents the character -whose code point is @samp{U+@var{nnnnnn}}. The Unicode Standard only -defines code points up to @samp{U+@var{10ffff}}, so if you specify a -code point higher than that, Emacs signals an error. - - This peculiar and inconvenient syntax was adopted for compatibility -with other programming languages. Unlike some other languages, Emacs -Lisp supports this syntax only in character literals and strings. - @cindex @samp{\} in character constant @cindex backslash in character constants -@cindex octal character code - The most general read syntax for a character represents the -character code in either octal or hex. To use octal, write a question -mark followed by a backslash and the octal character code (up to three -octal digits); thus, @samp{?\101} for the character @kbd{A}, -@samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the -character @kbd{C-b}. Although this syntax can represent any -@acronym{ASCII} character, it is preferred only when the precise octal -value is more important than the @acronym{ASCII} representation. - -@example -@group -?\012 @result{} 10 ?\n @result{} 10 ?\C-j @result{} 10 -?\101 @result{} 65 ?A @result{} 65 -@end group -@end example - - To use hex, write a question mark followed by a backslash, @samp{x}, -and the hexadecimal character code. You can use any number of hex -digits, so you can represent any character code in this way. -Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the -character @kbd{C-a}, and @code{?\xe0} for the Latin-1 character +@cindex unicode character escape + Firstly, you can specify characters by their Unicode values. +@code{?\u@var{nnnn}} represents a character with Unicode code point +@samp{U+@var{nnnn}}, where @var{nnnn} is (by convention) a hexadecimal +number with exactly four digits. The backslash indicates that the +subsequent characters form an escape sequence, and the @samp{u} +specifies a Unicode escape sequence. + + There is a slightly different syntax for specifying Unicode +characters with code points higher than @code{U+@var{ffff}}: +@code{?\U00@var{nnnnnn}} represents the character with code point +@samp{U+@var{nnnnnn}}, where @var{nnnnnn} is a six-digit hexadecimal +number. The Unicode Standard only defines code points up to +@samp{U+@var{10ffff}}, so if you specify a code point higher than +that, Emacs signals an error. + + Secondly, you can specify characters by their hexadecimal character +codes. A hexadecimal escape sequence consists of a backslash, +@samp{x}, and the hexadecimal character code. Thus, @samp{?\x41} is +the character @kbd{A}, @samp{?\x1} is the character @kbd{C-a}, and +@code{?\xe0} is the character @iftex @samp{@`a}. @end iftex @ifnottex @samp{a} with grave accent. @end ifnottex +You can use any number of hex digits, so you can represent any +character code in this way. + +@cindex octal character code + Thirdly, you can specify characters by their character code in +octal. An octal escape sequence consists of a backslash followed by +up to three octal digits; thus, @samp{?\101} for the character +@kbd{A}, @samp{?\001} for the character @kbd{C-a}, and @code{?\002} +for the character @kbd{C-b}. Only characters up to octal code 777 can +be specified this way. + + These escape sequences may also be used in strings. @xref{Non-ASCII +in Strings}. @node Ctl-Char Syntax @subsubsection Control-Character Syntax @@ -1026,40 +1023,53 @@ @node Non-ASCII in Strings @subsubsection Non-@acronym{ASCII} Characters in Strings - You can include a non-@acronym{ASCII} international character in a -string constant by writing it literally. There are two text -representations for non-@acronym{ASCII} characters in Emacs strings -(and in buffers): unibyte and multibyte (@pxref{Text -Representations}). If the string constant is read from a multibyte -source, such as a multibyte buffer or string, or a file that would be -visited as multibyte, then Emacs reads the non-@acronym{ASCII} -character as a multibyte character and automatically makes the string -a multibyte string. If the string constant is read from a unibyte -source, then Emacs reads the non-@acronym{ASCII} character as unibyte, -and makes the string unibyte. - - Instead of writing a non-@acronym{ASCII} character literally into a -multibyte string, you can write it as its character code using a hex -escape, @samp{\x@var{nnnnnnn}}, with as many digits as necessary. -(Multibyte non-@acronym{ASCII} character codes are all greater than -256.) You can also specify a character in a multibyte string using -the @samp{\u} or @samp{\U} Unicode escape syntax (@pxref{General -Escape Syntax}). In either case, any character which is not a valid -hex digit terminates the construct. If the next character in the -string could be interpreted as a hex digit, write @w{@samp{\ }} -(backslash and space) to terminate the hex escape---for example, + There are two text representations for non-@acronym{ASCII} +characters in Emacs strings: multibyte and unibyte (@pxref{Text +Representations}). Roughly speaking, unibyte strings store raw bytes, +while multibyte strings store human-readable text. Each character in +a unibyte string is a byte, i.e.@: its value is between 0 and 255. By +contrast, each character in a multibyte string may have a value +between 0 to 4194303 (@pxref{Character Type}). In both cases, +characters above 127 are non-@acronym{ASCII}. + + You can include a non-@acronym{ASCII} character in a string constant +by writing it literally. If the string constant is read from a +multibyte source, such as a multibyte buffer or string, or a file that +would be visited as multibyte, then Emacs reads each +non-@acronym{ASCII} character as a multibyte character and +automatically makes the string a multibyte string. If the string +constant is read from a unibyte source, then Emacs reads the +non-@acronym{ASCII} character as unibyte, and makes the string +unibyte. + + Instead of writing a character literally into a multibyte string, +you can write it as its character code using an escape sequence. +@xref{General Escape Syntax}, for details about escape sequences. + + If you use any Unicode-style escape sequence @samp{\uNNNN} or +@samp{\U00NNNNNN} in a string constant (even for an @acronym{ASCII} +character), Emacs automatically assumes that it is multibyte. + + You can also use hexadecimal escape sequences (@samp{\x@var{n}}) and +octal escape sequences (@samp{\@var{n}}) in string constants. +@strong{But beware:} If a string constant contains hexadecimal or +octal escape sequences, and these escape sequences all specify unibyte +characters (i.e.@: less than 256), and there are no other literal +non-@acronym{ASCII} characters or Unicode-style escape sequences in +the string, then Emacs automatically assumes that it is a unibyte +string. That is to say, it assumes that all non-@acronym{ASCII} +characters occurring in the string are 8-bit raw bytes. + + In hexadecimal and octal escape sequences, the escaped character +code may contain a variable number of digits, so the first subsequent +character which is not a valid hexadecimal or octal digit terminates +the escape sequence. If the next character in a string could be +interpreted as a hexadecimal or octal digit, write @w{@samp{\ }} +(backslash and space) to terminate the escape sequence. For example, @w{@samp{\xe0\ }} represents one character, @samp{a} with grave accent. @w{@samp{\ }} in a string constant is just like backslash-newline; it does not contribute any character to the string, -but it does terminate the preceding hex escape. Using any hex escape -in a string (even for an @acronym{ASCII} character) automatically -forces the string to be multibyte. - - You can represent a unibyte non-@acronym{ASCII} character with its -character code, which must be in the range from 128 (0200 octal) to -255 (0377 octal). If you write all such character codes in octal and -the string contains no other characters forcing it to be multibyte, -this produces a unibyte string. +but it does terminate any preceding hex escape. @node Nonprinting Characters @subsubsection Nonprinting Characters in Strings === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2012-10-28 12:56:15 +0000 +++ doc/lispref/windows.texi 2012-11-03 10:47:03 +0000 @@ -1550,6 +1550,26 @@ instead. @end deffn +By default, @code{switch-to-buffer} sets @code{window-point} of the +window used to the buffer's position of @code{point}. This behavior can +be tuned using the following option. + +@defopt switch-to-buffer-preserve-window-point +If this variable is @code{nil}, @code{switch-to-buffer} displays the +buffer specified by @var{buffer-or-name} at the position of that +buffer's @code{point}. If this variable is @code{already-displayed}, it +tries to display the buffer at its previous position in the selected +window, provided the buffer is currently displayed in some other window +on any visible or iconified frame. If this variable is @code{t}, +@code{switch-to-buffer} unconditionally tries to display the buffer at +its previous position in the selected window. + +This variable is ignored if the buffer is already displayed in the +selected window or never appeared in it before, or if +@code{switch-to-buffer} calls @code{pop-to-buffer} to display the +buffer. +@end defopt + The next two functions are similar to @code{switch-to-buffer}, except for the described features. @@ -1775,9 +1795,51 @@ @code{split-window-preferred-function} (@pxref{Choosing Window Options}). -It can fail if no window splitting can be performed for some reason -(e.g. if there is just one frame and it has an @code{unsplittable} -frame parameter; @pxref{Buffer Parameters}). +The size of the new window can be adjusted by supplying +@code{window-height} and @code{window-width} entries in @var{alist}. To +adjust the window's height, use an entry whose @sc{car} is +@code{window-height} and whose @sc{cdr} is one of: + +@itemize @bullet +@item +@code{nil} means to leave the height of the new window alone. + +@item +A number specifies the desired height of the new window. An integer +number specifies the number of lines of the window. A floating point +number gives the fraction of the window's height with respect to the +height of the frame's root window. + +@item +If the @sc{cdr} specifies a function, that function is called with one +argument - the new window. The function is supposed to adjust the +height of the window; its return value is ignored. Suitable functions +are @code{shrink-window-if-larger-than-buffer} and +@code{fit-window-to-buffer}, see @ref{Resizing Windows}. +@end itemize + +To adjust the window's width, use an entry whose @sc{car} is +@code{window-width} and whose @sc{cdr} is one of: + +@itemize @bullet +@item +@code{nil} means to leave the width of the new window alone. + +@item +A number specifies the desired width of the new window. An integer +number specifies the number of columns of the window. A floating point +number gives the fraction of the window's width with respect to the +width of the frame's root window. + +@item +If the @sc{cdr} specifies a function, that function is called with one +argument - the new window. The function is supposed to adjust the width +of the window; its return value is ignored. +@end itemize + +This function can fail if no window splitting can be performed for some +reason (e.g. if there is just one frame and it has an +@code{unsplittable} frame parameter; @pxref{Buffer Parameters}). @end defun @defun display-buffer-use-some-window buffer alist @@ -1786,6 +1848,26 @@ windows are dedicated to another buffer (@pxref{Dedicated Windows}). @end defun +@defun display-buffer-below-selected buffer alist +This function tries to display @var{buffer} in a window below the +selected window. This means to either split the selected window or +reuse the window below the selected one. +@end defun + +@defun display-buffer-in-previous-window buffer alist +This function tries to display @var{buffer} in a window previously +showing it. If @var{alist} has a non-@code{nil} +@code{inhibit-same-window} entry, the selected window is not eligible +for reuse. If @var{alist} contains a @code{reusable-frames} entry, its +value determines which frames to search for a suitable window as with +@code{display-buffer-reuse-window}. + +If @var{alist} has a @code{previous-window} entry, the window +specified by that entry will override any other window found by the +methods above, even if that window never showed @var{buffer} before. +@end defun + + @node Choosing Window Options @section Additional Options for Displaying Buffers @@ -2086,45 +2168,77 @@ Finally, you might want to either bury (@pxref{The Buffer List}) or kill (@pxref{Killing Buffers}) the window's buffer. - The following function uses information on how the window for -displaying the buffer was obtained in the first place, thus attempting to -automate the above decisions for you. + The following command uses information on how the window for +displaying the buffer was obtained in the first place, thus attempting +to automate the above decisions for you. @deffn Command quit-window &optional kill window This command quits @var{window} and buries its buffer. The argument @var{window} must be a live window and defaults to the selected one. With prefix argument @var{kill} non-@code{nil}, it kills the buffer -instead of burying it. - -Quitting @var{window} means to proceed as follows: If @var{window} was -created specially for displaying its current buffer, delete @var{window} -provided its frame contains at least one other live window. If -@var{window} is the only window on its frame and there are other frames -on the frame's terminal, the value of @var{kill} determines how to -proceed with the window. If @var{kill} is @code{nil}, the fate of the -frame is determined by calling @code{frame-auto-hide-function} (see -below) with that frame as sole argument. If @var{kill} is -non-@code{nil}, the frame is deleted unconditionally. - -If @var{window} was reused for displaying its buffer, this command tries -to display the buffer previously shown in it. It also tries to restore -the window start (@pxref{Window Start and End}) and point (@pxref{Window -Point}) positions of the previously shown buffer. If, in addition, the -current buffer was temporarily resized, this command will also try to -restore the original height of @var{window}. - -The three cases described so far require that the buffer shown in -@var{window} is still the buffer displayed by the last buffer display -function for this window. If another buffer has been shown in the -meantime, or the buffer previously shown no longer exists, this command -calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some -other buffer instead. +instead of burying it. It calls the function @code{quit-restore-window} +described next to deal with the window and its buffer. @end deffn -The function @code{quit-window} bases its decisions on information -stored in @var{window}'s @code{quit-restore} window parameter -(@pxref{Window Parameters}), and resets that parameter to @code{nil} -after it's done. +@defun quit-restore-window &optional window bury-or-kill +This function tries to restore the state of @var{window} that existed +before its buffer was displayed in it. The optional argument +@var{window} must be a live window and defaults to the selected one. + +If @var{window} was created specially for displaying its buffer, this +function deletes @var{window} provided its frame contains at least one +other live window. If @var{window} is the only window on its frame and +there are other frames on the frame's terminal, the value of the +optional argument @var{bury-or-kill} determines how to proceed with the +window. If @var{bury-or-kill} equals @code{kill}, the frame is deleted +unconditionally. Otherwise, the fate of the frame is determined by +calling @code{frame-auto-hide-function} (see below) with that frame as +sole argument. + +Otherwise, this function tries to redisplay the buffer previously shown +in @var{window}. It also tries to restore the window start +(@pxref{Window Start and End}) and point (@pxref{Window Point}) +positions of the previously shown buffer. If, in addition, +@var{window}'s buffer was temporarily resized, this function will also +try to restore the original height of @var{window}. + +The cases described so far require that the buffer shown in @var{window} +is still the buffer displayed by the last buffer display function for +this window. If another buffer has been shown in the meantime, or the +buffer previously shown no longer exists, this function calls +@code{switch-to-prev-buffer} (@pxref{Window History}) to show some other +buffer instead. + +The optional argument @var{bury-or-kill} specifes how to deal with +@var{window}'s buffer. The following values are handled: + +@table @code +@item nil +This means to not deal with the buffer in any particular way. As a +consequence, if @var{window} is not deleted, invoking +@code{switch-to-prev-buffer} will usually show the buffer again. + +@item append +This means that if @var{window} is not deleted, its buffer is moved to +the end of @var{window}'s list of previous buffers, so it's less likely +that a future invocation of @code{switch-to-prev-buffer} will switch to +it. Also, it moves the buffer to the end of the frame's buffer list. + +@item bury +This means that if @var{window} is not deleted, its buffer is removed +from @var{window}'s list of previous buffers. Also, it moves the buffer +to the end of the frame's buffer list. This value provides the most +reliable remedy to not have @code{switch-to-prev-buffer} switch to this +buffer again without killing the buffer. + +@item kill +This means to kill @var{window}'s buffer. +@end table + +@code{quit-restore-window} bases its decisions on information stored in +@var{window}'s @code{quit-restore} window parameter (@pxref{Window +Parameters}), and resets that parameter to @code{nil} after it's done. +@end defun The following option specifies how to deal with a frame containing just one window that should be either quit, or whose buffer should be buried. @@ -2135,10 +2249,9 @@ The function specified here is called by @code{bury-buffer} (@pxref{The Buffer List}) when the selected window is dedicated and shows the buffer -that should be buried. It is also called by @code{quit-window} (see -above) when the frame of the window that should be quit has been -specially created for displaying that window's buffer and the buffer -should be buried. +to bury. It is also called by @code{quit-restore-window} (see above) +when the frame of the window to quit has been specially created for +displaying that window's buffer and the buffer is not killed. The default is to call @code{iconify-frame} (@pxref{Visibility of Frames}). Alternatively, you may specify either @code{delete-frame} @@ -2146,9 +2259,9 @@ @code{ignore} to leave the frame unchanged, or any other function that can take a frame as its sole argument. -Note that the function specified by this option is called if and only if -there is at least one other frame on the terminal of the frame it's -supposed to handle, and that frame contains only one live window. +Note that the function specified by this option is called only if the +specified frame contains just one live window and there is at least one +other frame on the same terminal. @end defopt @@ -3123,8 +3236,8 @@ @defun window-state-get &optional window writable This function returns the state of @var{window} as a Lisp object. The -argument @var{window} can be any window and defaults to the root window -of the selected frame. +argument @var{window} must be a valid window and defaults to the root +window of the selected frame. If the optional argument @var{writable} is non-@code{nil}, this means to not use markers for sampling positions like @code{window-point} or @@ -3267,10 +3380,28 @@ Configurations}). @item @code{quit-restore} -This parameter specifies what to do with a window when the buffer it -shows is not needed any more. It is installed by the buffer display -functions (@pxref{Choosing Window}), and consulted by the function -@code{quit-window} (@pxref{Quitting Windows}). +This parameter is installed by the buffer display functions +(@pxref{Choosing Window}) and consulted by @code{quit-restore-window} +(@pxref{Quitting Windows}). It contains four elements: + +The first element is one of the symbols @code{window} - meaning that the +window has been specially created by @code{display-buffer}, @code{frame} +- a separate frame has been created, @code{same} - the window has +displayed the same buffer before, or @code{other} - the window showed +another buffer before. + +The second element is either one of the symbols @code{window} or +@code{frame}, or a list whose elements are the buffer shown in the +window before, that buffer's window start and window point positions, +and the window's height at that time. + +The third element is the window selected at the time the parameter was +created. The function @code{quit-restore-window} tries to reselect that +window when it deletes the window passed to it as argument. + +The fourth element is the buffer whose display caused the creation of +this parameter. @code{quit-restore-window} deletes the specified window +only if it still shows that buffer. @end table There are additional parameters @code{window-atom} and @code{window-side}; === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-11-02 23:37:02 +0000 +++ doc/misc/ChangeLog 2012-11-03 19:14:22 +0000 @@ -1,3 +1,14 @@ +2012-11-03 Glenn Morris + + * cl.texi: Further general copyedits. + (List Functions): Remove copy-tree, standard elisp for some time. + (Efficiency Concerns): Comment out examples that no longer apply. + (Compiler Optimizations): Rename from "Optimizing Compiler"; reword. + (Creating Symbols, Random Numbers): De-emphasize internal + variables cl--gensym-counter and cl--random-state. (Bug#12788) + (Naming Conventions, Type Predicates, Macros) + (Predicates on Numbers): No longer mention cl-floatp-safe. + 2012-11-02 Katsumi Yamaoka * gnus.texi (Mail Source Specifiers): === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2012-11-01 07:16:32 +0000 +++ doc/misc/cl.texi 2012-11-03 18:55:29 +0000 @@ -229,7 +229,7 @@ @example cl-callf cl-callf2 cl-defsubst -cl-floatp-safe cl-letf cl-letf* +cl-letf cl-letf* @end example @c This is not uninteresting I suppose, but is of zero practical relevance @@ -239,13 +239,13 @@ @example cl-evenp cl-oddp cl-minusp -cl-plusp cl-floatp-safe cl-endp +cl-plusp cl-endp cl-subst cl-copy-list cl-list* cl-ldiff cl-rest cl-decf [1] cl-incf [1] cl-acons cl-adjoin [2] cl-pairlis cl-pushnew [1,2] cl-declaim cl-proclaim cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth -cl-subst cl-mapcar [3] +cl-mapcar [3] @end example @noindent @@ -300,7 +300,8 @@ This is analogous to the @code{defsubst} form; @code{cl-defsubst} uses a different method (compiler macros) which works in all versions of Emacs, and also generates somewhat more -@c Really? +@c For some examples, +@c see http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00009.html efficient inline expansions. In particular, @code{cl-defsubst} arranges for the processing of keyword arguments, default values, etc., to be done at compile-time whenever possible. @@ -702,11 +703,13 @@ The type symbols @code{character} and @code{string-char} match integers in the range from 0 to 255. +@c No longer relevant, so covered by first item above (float -> floatp). +@ignore @item The type symbol @code{float} uses the @code{cl-floatp-safe} predicate defined by this package rather than @code{floatp}, so it will work -@c FIXME are any such platforms still relevant? correctly even in Emacs versions without floating-point support. +@end ignore @item The type list @code{(integer @var{low} @var{high})} represents all @@ -833,7 +836,7 @@ * Conditionals:: @code{cl-case}, @code{cl-typecase}. * Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. * Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. -* Loop Facility:: The Common Lisp @code{cl-loop} macro. +* Loop Facility:: The Common Lisp @code{loop} macro. * Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. @end menu @@ -1521,7 +1524,7 @@ similar to @code{catch} and @code{throw}, with lexical scoping. This package actually implements @code{cl-block} in terms of @code{catch}; however, the lexical scoping allows the -optimizing byte-compiler to omit the costly @code{catch} step if the +byte-compiler to omit the costly @code{catch} step if the body of the block does not actually @code{cl-return-from} the block. @defmac cl-block name forms@dots{} @@ -1558,7 +1561,7 @@ Because they are implemented in terms of Emacs Lisp's @code{catch} and @code{throw}, blocks have the same overhead as actual @code{catch} constructs (roughly two function calls). However, -the optimizing byte compiler will optimize away the @code{catch} +the byte compiler will optimize away the @code{catch} if the block does not in fact contain any @code{cl-return} or @code{cl-return-from} calls that jump to it. This means that @code{cl-do} loops and @code{cl-defun} @@ -1723,18 +1726,18 @@ @section Loop Facility @noindent -A common complaint with Lisp's traditional looping constructs is -that they are either too simple and limited, such as Common Lisp's -@code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and -obscure, like Common Lisp's @code{do} loop. +A common complaint with Lisp's traditional looping constructs was +that they were either too simple and limited, such as @code{dotimes} +or @code{while}, or too unreadable and obscure, like Common Lisp's +@code{do} loop. -To remedy this, recent versions of Common Lisp have added a new -construct called the ``Loop Facility'' or ``@code{loop} macro'', -with an easy-to-use but very powerful and expressive syntax. +To remedy this, Common Lisp added a construct called the ``Loop +Facility'' or ``@code{loop} macro'', with an easy-to-use but very +powerful and expressive syntax. @menu -* Loop Basics:: @code{cl-loop} macro, basic clause structure. -* Loop Examples:: Working examples of @code{cl-loop} macro. +* Loop Basics:: The @code{cl-loop} macro, basic clause structure. +* Loop Examples:: Working examples of the @code{cl-loop} macro. * For Clauses:: Clauses introduced by @code{for} or @code{as}. * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. @@ -1767,9 +1770,9 @@ loop: @example -(cl-loop @var{name-clause} - @var{var-clauses}@dots{} - @var{action-clauses}@dots{}) +(loop @var{name-clause} + @var{var-clauses}@dots{} + @var{action-clauses}@dots{}) @end example The @var{name-clause} optionally gives a name to the implicit @@ -1795,10 +1798,10 @@ break out of the loop.) @end defmac -The following sections give some examples of the Loop Macro in +The following sections give some examples of the loop macro in action, and describe the particular loop clauses in great detail. Consult the second edition of Steele for additional discussion -and examples of the @code{loop} macro. +and examples. @node Loop Examples @subsection Loop Examples @@ -2162,8 +2165,9 @@ based on the value of @code{x} left over from the previous time through the loop. -Another feature of the @code{cl-loop} macro is @dfn{destructuring}, -similar in concept to the destructuring provided by @code{defmacro}. +Another feature of the @code{cl-loop} macro is @emph{destructuring}, +similar in concept to the destructuring provided by @code{defmacro} +(@pxref{Argument Lists}). The @var{var} part of any @code{for} clause can be given as a list of variables instead of a single variable. The values produced during loop execution must be lists; the values in the lists are @@ -2375,7 +2379,7 @@ (setq funny-numbers '(6 13 -1)) @result{} (6 13 -1) (cl-loop for x below 10 - if (oddp x) + if (cl-oddp x) collect x into odds and if (memq x funny-numbers) return (cdr it) end else @@ -2441,15 +2445,14 @@ @item return @var{form} This clause causes the loop to return immediately. The following -Lisp form is evaluated to give the return value of the @code{loop} +Lisp form is evaluated to give the return value of the loop form. The @code{finally} clauses, if any, are not executed. Of course, @code{return} is generally used inside an @code{if} or @code{unless}, as its use in a top-level loop clause would mean the loop would never get to ``loop'' more than once. The clause @samp{return @var{form}} is equivalent to -@c FIXME cl-do, cl-return? -@samp{do (return @var{form})} (or @code{return-from} if the loop +@samp{do (cl-return @var{form})} (or @code{cl-return-from} if the loop was named). The @code{return} clause is implemented a bit more efficiently, though. @end table @@ -2463,7 +2466,7 @@ This package's @code{cl-loop} macro is compatible with that of Common Lisp, except that a few features are not implemented: @code{loop-finish} -and data-type specifiers. Naturally, the @code{for} clauses which +and data-type specifiers. Naturally, the @code{for} clauses that iterate over keymaps, overlays, intervals, frames, windows, and buffers are Emacs-specific extensions. @@ -2516,17 +2519,17 @@ following macro: @defmac cl-destructuring-bind arglist expr forms@dots{} -This macro expands to code which executes @var{forms}, with +This macro expands to code that executes @var{forms}, with the variables in @var{arglist} bound to the list of values returned by @var{expr}. The @var{arglist} can include all -the features allowed for @code{defmacro} argument lists, +the features allowed for @code{cl-defmacro} argument lists, including destructuring. (The @code{&environment} keyword is not allowed.) The macro expansion will signal an error if @var{expr} returns a list of the wrong number of arguments or with incorrect keyword arguments. @end defmac -This package also includes the Common Lisp @code{cl-define-compiler-macro} +This package also includes the Common Lisp @code{define-compiler-macro} facility, which allows you to define compile-time expansions and optimizations for your functions. @@ -2551,7 +2554,7 @@ (cl-define-compiler-macro cl-member (&whole form a list &rest keys) (if (and (null keys) (eq (car-safe a) 'quote) - (not (floatp-safe (cadr a)))) + (not (floatp (cadr a)))) (list 'memq a list) form)) @end example @@ -2589,16 +2592,19 @@ about the types of data that will be stored in particular variables, and about the ways those variables and functions will be used. This package defines versions of all the Common Lisp declaration forms: -@code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, -and @code{cl-the}. +@code{declare}, @code{locally}, @code{proclaim}, @code{declaim}, +and @code{the}. -Most of the Common Lisp declarations are not currently useful in -Emacs Lisp, as the byte-code system provides little opportunity -to benefit from type information, and @code{special} declarations -are redundant in a fully dynamically-scoped Lisp. A few -declarations are meaningful when the optimizing byte -compiler is being used, however. Under the earlier non-optimizing -compiler, these declarations will effectively be ignored. +Most of the Common Lisp declarations are not currently useful in Emacs +Lisp. For example, the byte-code system provides little +opportunity to benefit from type information. +@ignore +and @code{special} declarations are redundant in a fully +dynamically-scoped Lisp. +@end ignore +A few declarations are meaningful when byte compiler optimizations +are enabled, as they are by the default. Otherwise these +declarations will effectively be ignored. @defun cl-proclaim decl-spec This function records a ``global'' declaration specified by @@ -2609,7 +2615,7 @@ @defmac cl-declaim decl-specs@dots{} This macro is like @code{cl-proclaim}, except that it takes any number of @var{decl-spec} arguments, and the arguments are unevaluated and -unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when +unquoted. The @code{cl-declaim} macro also puts @code{(cl-eval-when (compile load eval) @dots{})} around the declarations so that they will be registered at compile-time as well as at run-time. (This is vital, since normally the declarations are meant to influence the way the @@ -2632,9 +2638,9 @@ @defmac cl-the type form Type information provided by @code{cl-the} is ignored in this package; -in other words, @code{(cl-the @var{type} @var{form})} is equivalent -to @var{form}. Future versions of the optimizing byte-compiler may -make use of this information. +in other words, @code{(cl-the @var{type} @var{form})} is equivalent to +@var{form}. Future byte-compiler optimizations may make use of this +information. For example, @code{mapcar} can map over both lists and arrays. It is hard for the compiler to expand @code{mapcar} into an in-line loop @@ -2655,35 +2661,31 @@ @table @code @item special +@c FIXME ? Since all variables in Emacs Lisp are ``special'' (in the Common Lisp sense), @code{special} declarations are only advisory. They -simply tell the optimizing byte compiler that the specified +simply tell the byte compiler that the specified variables are intentionally being referred to without being bound in the body of the function. The compiler normally emits warnings for such references, since they could be typographical errors for references to local variables. The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is -equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the -optimizing compiler, or to nothing at all in older compilers (which -do not warn for non-local references). +equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}. In top-level contexts, it is generally better to write @code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, -since @code{defvar} makes your intentions clearer. But the older -byte compilers can not handle @code{defvar}s appearing inside of -functions, while @code{(cl-declare (special @var{var}))} takes care -to work correctly with all compilers. +since @code{defvar} makes your intentions clearer. @item inline The @code{inline} @var{decl-spec} lists one or more functions whose bodies should be expanded ``in-line'' into calling functions whenever the compiler is able to arrange for it. For example, -the Common Lisp function @code{cadr} is declared @code{inline} -by this package so that the form @code{(cadr @var{x})} will -expand directly into @code{(car (cdr @var{x}))} when it is called -in user functions, for a savings of one (relatively expensive) -function call. +the function @code{cl-acons} is declared @code{inline} +by this package so that the form @code{(cl-acons @var{key} @var{value} +@var{alist})} will +expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})} +when it is called in user functions, so as to save function calls. The following declarations are all equivalent. Note that the @code{defsubst} form is a convenient way to define a function @@ -2702,7 +2704,7 @@ but it is impolite to use it to request inlining of an external function. -In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} +In Common Lisp, it is possible to use @code{(declare (inline @dots{}))} before a particular call to a function to cause just that call to be inlined; the current byte compilers provide no way to implement this, so @code{(cl-declare (inline @dots{}))} is currently ignored by @@ -2715,8 +2717,7 @@ @item optimize This declaration controls how much optimization is performed by -the compiler. Naturally, it is ignored by the earlier non-optimizing -compilers. +the compiler. The word @code{optimize} is followed by any number of lists like @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several @@ -2725,8 +2726,7 @@ 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. The default level for both qualities is 1. -In this package, with the optimizing compiler, the -@code{speed} quality is tied to the @code{byte-optimize} +In this package, the @code{speed} quality is tied to the @code{byte-optimize} flag, which is set to @code{nil} for @code{(speed 0)} and to @code{t} for higher settings; and the @code{safety} quality is tied to the @code{byte-compile-delete-errors} flag, which is @@ -2745,22 +2745,22 @@ The @code{optimize} declaration is normally used in a top-level @code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows -it to be used with @code{cl-declare} to set the level of optimization +it to be used with @code{declare} to set the level of optimization locally for a given form, but this will not work correctly with the -current version of the optimizing compiler. (The @code{cl-declare} +current byte-compiler. (The @code{cl-declare} will set the new optimization level, but that level will not automatically be unset after the enclosing form is done.) @item warn This declaration controls what sorts of warnings are generated -by the byte compiler. Again, only the optimizing compiler -generates warnings. The word @code{warn} is followed by any +by the byte compiler. The word @code{warn} is followed by any number of ``warning qualities'', similar in form to optimization qualities. The currently supported warning types are @code{redefine}, @code{callargs}, @code{unresolved}, and @code{free-vars}; in the current system, a value of 0 will disable these warnings and any higher value will enable them. -See the documentation for the optimizing byte compiler for details. +See the documentation of the variable @code{byte-compile-warnings} +for more details. @end table @node Symbols @@ -2867,25 +2867,24 @@ This function creates a new, uninterned symbol (using @code{make-symbol}) with a unique name. (The name of an uninterned symbol is relevant only if the symbol is printed.) By default, the name is generated +@c FIXME no longer true? from an increasing sequence of numbers, @samp{G1000}, @samp{G1001}, @samp{G1002}, etc. If the optional argument @var{x} is a string, that string is used as a prefix instead of @samp{G}. Uninterned symbols are used in macro expansions for temporary variables, to ensure that their names will not conflict with ``real'' variables in the user's code. -@end defun -@defvar cl--gensym-counter -This variable holds the counter used to generate @code{cl-gensym} names. -It is incremented after each use by @code{cl-gensym}. In Common Lisp -this is initialized with 0, but this package initializes it with a -random (time-dependent) value to avoid trouble when two files that +(Internally, the variable @code{cl--gensym-counter} holds the counter +used to generate names. It is incremented after each use. In Common +Lisp this is initialized with 0, but this package initializes it with +a random time-dependent value to avoid trouble when two files that each used @code{cl-gensym} in their compilation are loaded together. -(Uninterned symbols become interned when the compiler writes them -out to a file and the Emacs loader loads them, so their names have to -be treated a bit more carefully than in Common Lisp where uninterned +Uninterned symbols become interned when the compiler writes them out +to a file and the Emacs loader loads them, so their names have to be +treated a bit more carefully than in Common Lisp where uninterned symbols remain uninterned after loading.) -@end defvar +@end defun @defun cl-gentemp &optional x This function is like @code{cl-gensym}, except that it produces a new @@ -2905,13 +2904,13 @@ @noindent This section defines a few simple Common Lisp operations on numbers -which were left out of Emacs Lisp. +that were left out of Emacs Lisp. @menu -* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, @code{cl-floatp-safe}, etc. -* Numerical Functions:: @code{abs}, @code{cl-floor}, etc. +* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, etc. +* Numerical Functions:: @code{cl-floor}, @code{cl-ceiling}, etc. * Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. -* Implementation Parameters:: @code{cl-most-positive-float}. +* Implementation Parameters:: @code{cl-most-positive-float}, etc. @end menu @node Predicates on Numbers @@ -2941,11 +2940,13 @@ error if the argument is not an integer. @end defun +@ignore @defun cl-floatp-safe object This predicate tests whether @var{object} is a floating-point number. On systems that support floating-point, this is equivalent to @code{floatp}. On other systems, this always returns @code{nil}. @end defun +@end ignore @node Numerical Functions @section Numerical Functions @@ -3036,6 +3037,7 @@ This package also provides an implementation of the Common Lisp random number generator. It uses its own additive-congruential algorithm, which is much more likely to give statistically clean +@c FIXME? Still true? random numbers than the simple generators supplied by many operating systems. @@ -3043,22 +3045,16 @@ This function returns a random nonnegative number less than @var{number}, and of the same type (either integer or floating-point). The @var{state} argument should be a @code{random-state} object -which holds the state of the random number generator. The +that holds the state of the random number generator. The function modifies this state object as a side effect. If -@var{state} is omitted, it defaults to the variable +@var{state} is omitted, it defaults to the internal variable @code{cl--random-state}, which contains a pre-initialized -@code{random-state} object. +default @code{random-state} object. (Since any number of programs in +the Emacs process may be accessing @code{cl--random-state} in +interleaved fashion, the sequence generated from this will be +irreproducible for all intents and purposes.) @end defun -@defvar cl--random-state -This variable contains the system ``default'' @code{random-state} -object, used for calls to @code{cl-random} that do not specify an -alternative state object. Since any number of programs in the -Emacs process may be accessing @code{cl--random-state} in interleaved -fashion, the sequence generated from this variable will be -irreproducible for all intents and purposes. -@end defvar - @defun cl-make-random-state &optional state This function creates or copies a @code{random-state} object. If @var{state} is omitted or @code{nil}, it returns a new copy of @@ -3094,10 +3090,10 @@ @section Implementation Parameters @noindent -This package defines several useful constants having to with numbers. +This package defines several useful constants having to do with +floating-point numbers. -The following parameters have to do with floating-point numbers. -This package determines their values by exercising the computer's +It determines their values by exercising the computer's floating-point arithmetic in various ways. Because this operation might be slow, the code for initializing them is kept in a separate function that must be called before the parameters can be used. @@ -3105,12 +3101,13 @@ @defun cl-float-limits This function makes sure that the Common Lisp floating-point parameters like @code{cl-most-positive-float} have been initialized. Until it is -called, these parameters will be @code{nil}. If this version of Emacs -does not support floats, the parameters will remain @code{nil}. If the -parameters have already been initialized, the function returns +called, these parameters will be @code{nil}. +@c If this version of Emacs does not support floats, the parameters will +@c remain @code{nil}. +If the parameters have already been initialized, the function returns immediately. -The algorithm makes assumptions that will be valid for most modern +The algorithm makes assumptions that will be valid for almost all machines, but will fail if the machine's arithmetic is extremely unusual, e.g., decimal. @end defun @@ -3130,7 +3127,7 @@ @end defvar @defvar cl-most-negative-float -This constant equals the most-negative value a Lisp float can hold. +This constant equals the most negative value a Lisp float can hold. (It is assumed to be equal to @code{(- cl-most-positive-float)}.) @end defvar @@ -3199,7 +3196,7 @@ The @code{:key} argument should be passed either @code{nil}, or a function of one argument. This key function is used as a filter through which the elements of the sequence are seen; for example, -@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: +@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}. It searches for an element of the list whose @sc{car} equals @code{x}, rather than for an element which equals @code{x} itself. If @code{:key} is omitted or @code{nil}, the filter is effectively @@ -3217,7 +3214,7 @@ @code{:test-not} to give a function which returns @emph{false} to indicate a match. The default test function is @code{eql}. -Many functions which take @var{item} and @code{:test} or @code{:test-not} +Many functions that take @var{item} and @code{:test} or @code{:test-not} arguments also come in @code{-if} and @code{-if-not} varieties, where a @var{predicate} function is passed instead of @var{item}, and sequence elements match if the predicate returns true on them @@ -3231,7 +3228,7 @@ to remove all zeros from sequence @code{seq}. Some operations can work on a subsequence of the argument sequence; -these function take @code{:start} and @code{:end} arguments which +these function take @code{:start} and @code{:end} arguments, which default to zero and the length of the sequence, respectively. Only elements between @var{start} (inclusive) and @var{end} (exclusive) are affected by the operation. The @var{end} argument @@ -3339,7 +3336,7 @@ @defun cl-some predicate seq &rest more-seqs This function calls @var{predicate} on each element of @var{seq} in turn; if @var{predicate} returns a non-@code{nil} value, -@code{some} returns that value, otherwise it returns @code{nil}. +@code{cl-some} returns that value, otherwise it returns @code{nil}. Given several sequence arguments, it steps through the sequences in parallel until the shortest one runs out, just as in @code{cl-mapcar}. You can rely on the left-to-right order in which @@ -3388,7 +3385,7 @@ @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 @end example -If @code{:key} is specified, it is a function of one argument which +If @code{:key} is specified, it is a function of one argument, which is called on each of the sequence elements in turn. If @code{:initial-value} is specified, it is effectively added to the @@ -3457,7 +3454,7 @@ If @var{seq1} and @var{seq2} are @code{eq}, then the replacement will work correctly even if the regions indicated by the start and end arguments overlap. However, if @var{seq1} and @var{seq2} -are lists which share storage but are not @code{eq}, and the +are lists that share storage but are not @code{eq}, and the start and end arguments specify overlapping regions, the effect is undefined. @end defun @@ -3480,7 +3477,7 @@ @end defun @defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} -This deletes all elements of @var{seq} which match @var{item}. +This deletes all elements of @var{seq} that match @var{item}. It is a destructive operation. Since Emacs Lisp does not support stretchable strings or vectors, this is the same as @code{cl-remove} for those sequence types. On lists, @code{cl-remove} will copy the @@ -3580,7 +3577,7 @@ and @code{:key}), the function returns @code{nil}. If there is a mismatch, the function returns the index (relative to @var{seq1}) of the first mismatching element. This will be the leftmost pair of -elements which do not match, or the position at which the shorter of +elements that do not match, or the position at which the shorter of the two otherwise-matching sequences runs out. If @code{:from-end} is true, then the elements are compared from right @@ -3595,7 +3592,7 @@ @defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} This function searches @var{seq2} for a subsequence that matches @var{seq1} (or part of it specified by @code{:start1} and -@code{:end1}.) Only matches which fall entirely within the region +@code{:end1}). Only matches that fall entirely within the region defined by @code{:start2} and @code{:end2} will be considered. The return value is the index of the leftmost element of the leftmost match, relative to the start of @var{seq2}, or @code{nil} @@ -3606,7 +3603,7 @@ @node Sorting Sequences @section Sorting Sequences -@defun clsort seq predicate @t{&key :key} +@defun cl-sort seq predicate @t{&key :key} This function sorts @var{seq} into increasing order as determined by using @var{predicate} to compare pairs of elements. @var{predicate} should return true (non-@code{nil}) if and only if its first argument @@ -3617,7 +3614,7 @@ This function differs from Emacs's built-in @code{sort} in that it can operate on any type of sequence, not just lists. Also, it -accepts a @code{:key} argument which is used to preprocess data +accepts a @code{:key} argument, which is used to preprocess data fed to the @var{predicate} function. For example, @example @@ -3628,7 +3625,7 @@ sorts @var{data}, a sequence of strings, into increasing alphabetical order without regard to case. A @code{:key} function of @code{car} would be useful for sorting association lists. It should only be a -simple accessor though, it's used heavily in the current +simple accessor though, since it's used heavily in the current implementation. The @code{cl-sort} function is destructive; it sorts lists by actually @@ -3684,7 +3681,7 @@ @defun cl-caddr x This function is equivalent to @code{(car (cdr (cdr @var{x})))}. -Likewise, this package defines all 28 @code{c@var{xxx}r} functions +Likewise, this package defines all 24 @code{c@var{xxx}r} functions where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. All of these functions are @code{setf}-able, and calls to them are expanded inline by the byte-compiler for maximum efficiency. @@ -3712,7 +3709,8 @@ @code{(length @var{x})}, except that if @var{x} is a circular list (where the @sc{cdr}-chain forms a loop rather than terminating with @code{nil}), this function returns @code{nil}. (The regular -@code{length} function would get stuck if given a circular list.) +@code{length} function would get stuck if given a circular list. +See also the @code{safe-length} function.) @end defun @defun cl-list* arg &rest others @@ -3740,18 +3738,6 @@ dotted lists like @code{(1 2 . 3)} correctly. @end defun -@defun copy-tree x &optional vecp -This function returns a copy of the tree of cons cells @var{x}. -@c FIXME? cl-copy-list is not an alias of copy-sequence. -Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), -which copies only along the @sc{cdr} direction, this function -copies (recursively) along both the @sc{car} and the @sc{cdr} -directions. If @var{x} is not a cons cell, the function simply -returns @var{x} unchanged. If the optional @var{vecp} argument -is true, this function copies vectors (recursively) as well as -cons cells. -@end defun - @defun cl-tree-equal x y @t{&key :test :test-not :key} This function compares two trees of cons cells. If @var{x} and @var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are @@ -3814,7 +3800,7 @@ @section Lists as Sets @noindent -These functions perform operations on lists which represent sets +These functions perform operations on lists that represent sets of elements. @defun cl-member item list @t{&key :test :test-not :key} @@ -3827,13 +3813,14 @@ The standard Emacs lisp function @code{member} uses @code{equal} for comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} -:test 'equal)}. +:test 'equal)}. With no keyword arguments, @code{cl-member} is +equivalent to @code{memq}. @end defun @findex cl-member-if @findex cl-member-if-not The @code{cl-member-if} and @code{cl-member-if-not} functions -analogously search for elements which satisfy a given predicate. +analogously search for elements that satisfy a given predicate. @defun cl-tailp sublist list This function returns @code{t} if @var{sublist} is a sublist of @@ -3852,11 +3839,11 @@ @end defun @defun cl-union list1 list2 @t{&key :test :test-not :key} -This function combines two lists which represent sets of items, +This function combines two lists that represent sets of items, returning a list that represents the union of those two sets. -The result list will contain all items which appear in @var{list1} +The resulting list contains all items that appear in @var{list1} or @var{list2}, and no others. If an item appears in both -@var{list1} and @var{list2} it will be copied only once. If +@var{list1} and @var{list2} it is copied only once. If an item is duplicated in @var{list1} or @var{list2}, it is undefined whether or not that duplication will survive in the result list. The order of elements in the result list is also @@ -3871,7 +3858,7 @@ @defun cl-intersection list1 list2 @t{&key :test :test-not :key} This function computes the intersection of the sets represented by @var{list1} and @var{list2}. It returns the list of items -which appear in both @var{list1} and @var{list2}. +that appear in both @var{list1} and @var{list2}. @end defun @defun cl-nintersection list1 list2 @t{&key :test :test-not :key} @@ -3921,7 +3908,7 @@ element whose @sc{car} matches (in the sense of @code{:test}, @code{:test-not}, and @code{:key}, or by comparison with @code{eql}) a given @var{item}. It returns the matching element, if any, -otherwise @code{nil}. It ignores elements of @var{a-list} which +otherwise @code{nil}. It ignores elements of @var{a-list} that are not cons cells. (This corresponds to the behavior of @code{assq} and @code{assoc} in Emacs Lisp; Common Lisp's @code{assoc} ignores @code{nil}s but considers any other non-cons @@ -3982,11 +3969,11 @@ @end example @noindent -defines a struct type called @code{person} which contains three +defines a struct type called @code{person} that contains three slots. Given a @code{person} object @var{p}, you can access those slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})}, and @code{(person-sex @var{p})}. You can also change these slots by -using @code{setf} on any of these place forms: +using @code{setf} on any of these place forms, for example: @example (cl-incf (person-age birthday-boy)) @@ -4003,10 +3990,10 @@ object of the same type whose slots are @code{eq} to those of @var{p}. Given any Lisp object @var{x}, @code{(person-p @var{x})} returns -true if @var{x} looks like a @code{person}, false otherwise. (Again, +true if @var{x} looks like a @code{person}, and false otherwise. (Again, in Common Lisp this predicate would be exact; in Emacs Lisp the best it can do is verify that @var{x} is a vector of the correct -length which starts with the correct tag symbol.) +length that starts with the correct tag symbol.) Accessors like @code{person-name} normally check their arguments (effectively using @code{person-p}) and signal an error if the @@ -4043,7 +4030,7 @@ symbol followed by any number of @dfn{struct options}; each @var{slot} is either a slot symbol or a list of the form @samp{(@var{slot-name} @var{default-value} @var{slot-options}@dots{})}. The @var{default-value} -is a Lisp form which is evaluated any time an instance of the +is a Lisp form that is evaluated any time an instance of the structure type is created without specifying that slot's value. Common Lisp defines several slot options, but the only one @@ -4101,11 +4088,11 @@ initialized from the corresponding argument. Slots whose names do not appear in the argument list are initialized based on the @var{default-value} in their slot descriptor. Also, @code{&optional} -and @code{&key} arguments which don't specify defaults take their +and @code{&key} arguments that don't specify defaults take their defaults from the slot descriptor. It is valid to include arguments -which don't correspond to slot names; these are useful if they are +that don't correspond to slot names; these are useful if they are referred to in the defaults for optional, keyword, or @code{&aux} -arguments which @emph{do} correspond to slots. +arguments that @emph{do} correspond to slots. You can specify any number of full-format @code{:constructor} options on a structure. The default constructor is still generated @@ -4146,7 +4133,7 @@ all copier functions are simply synonyms for @code{copy-sequence}.) @item :predicate -The argument is an alternate name for the predicate which recognizes +The argument is an alternate name for the predicate that recognizes objects of this type. The default is @code{@var{name}-p}. @code{nil} means not to generate a predicate function. (If the @code{:type} option is used without the @code{:named} option, no predicate is @@ -4206,7 +4193,7 @@ @item :print-function In full Common Lisp, this option allows you to specify a function -which is called to print an instance of the structure type. The +that is called to print an instance of the structure type. The Emacs Lisp system offers no hooks into the Lisp printer which would allow for such a feature, so this package simply ignores @code{:print-function}. @@ -4383,7 +4370,7 @@ This function takes a single Lisp form as an argument and inserts a nicely formatted copy of it in the current buffer (which must be in Lisp mode so that indentation works properly). It also expands -all Lisp macros which appear in the form. The easiest way to use +all Lisp macros that appear in the form. The easiest way to use this function is to go to the @file{*scratch*} buffer and type, say, @example @@ -4392,7 +4379,7 @@ @noindent and type @kbd{C-x C-e} immediately after the closing parenthesis; -the expansion +an expansion similar to: @example (cl-block nil @@ -4413,7 +4400,11 @@ If the optional argument @var{full} is true, then @emph{all} macros are expanded, including @code{cl-block}, @code{cl-eval-when}, and compiler macros. Expansion is done as if @var{form} were -a top-level form in a file being compiled. For example, +a top-level form in a file being compiled. + +@c FIXME none of these examples are still applicable. +@ignore +For example, @example (cl-prettyexpand '(cl-pushnew 'x list)) @@ -4423,16 +4414,12 @@ (cl-prettyexpand '(caddr (cl-member 'a list)) t) @print{} (car (cdr (cdr (memq 'a list)))) @end example +@end ignore Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all have built-in compiler macros to optimize them in common cases. @end defun -@ifinfo -@example - -@end example -@end ifinfo @appendixsec Error Checking @noindent @@ -4442,7 +4429,7 @@ incompatibility. The Common Lisp standard (as embodied in Steele's book) uses the -phrase ``it is an error if'' to indicate a situation which is not +phrase ``it is an error if'' to indicate a situation that is not supposed to arise in complying programs; implementations are strongly encouraged but not required to signal an error in these situations. This package sometimes omits such error checking in the interest of @@ -4464,45 +4451,43 @@ defined in this package such as @code{cl-find} and @code{cl-member} do check their keyword arguments for validity. -@ifinfo -@example - -@end example -@end ifinfo -@appendixsec Optimizing Compiler +@appendixsec Compiler Optimizations @noindent -Use of the optimizing Emacs compiler is highly recommended; many of the Common +Changing the value of @code{byte-optimize} from the default @code{t} +is highly discouraged; many of the Common Lisp macros emit -code which can be improved by optimization. In particular, +code that can be improved by optimization. In particular, @code{cl-block}s (whether explicit or implicit in constructs like @code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the -optimizing compiler removes @code{cl-block}s which are not actually +byte-compiler removes @code{cl-block}s that are not actually referenced by @code{cl-return} or @code{cl-return-from} inside the block. @node Common Lisp Compatibility @appendix Common Lisp Compatibility @noindent -Following is a list of all known incompatibilities between this +The following is a list of all known incompatibilities between this package and Common Lisp as documented in Steele (2nd edition). The word @code{cl-defun} is required instead of @code{defun} in order to use extended Common Lisp argument lists in a function. Likewise, @code{cl-defmacro} and @code{cl-function} are versions of those forms which understand full-featured argument lists. The @code{&whole} -keyword does not work in @code{defmacro} argument lists (except +keyword does not work in @code{cl-defmacro} argument lists (except inside recursive argument lists). The @code{equal} predicate does not distinguish between IEEE floating-point plus and minus zero. The @code{cl-equalp} predicate has several differences with Common Lisp; @pxref{Predicates}. -@c FIXME no longer provided by cl. +@c FIXME consider moving to lispref +@ignore The @code{setf} mechanism is entirely compatible, except that setf-methods return a list of five values rather than five values directly. Also, the new ``@code{setf} function'' concept (typified by @code{(defun (setf foo) @dots{})}) is not implemented. +@end ignore The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} with no @var{obarray} argument. In Common Lisp, this form would @@ -4635,7 +4620,7 @@ treats them as part of the symbol name. Thus, while @code{mapcar} and @code{lisp:mapcar} may refer to the same symbol in Common Lisp, they are totally distinct in Emacs Lisp. Common Lisp -programs which refer to a symbol by the full name sometimes +programs that refer to a symbol by the full name sometimes and the short name other times will not port cleanly to Emacs. Emacs Lisp does have a concept of ``obarrays'', which are @@ -4922,8 +4907,9 @@ @code{defsetf}, and @code{define-setf-method}, that allow the user to extend generalized variables in various ways. In Emacs, these are obsolete, replaced by various features of -@file{gv.el} in Emacs 24.3. -@c FIXME details. +@file{gv.el} in Emacs 24.3. Many of the implementation +details in the following are out-of-date. +@c FIXME this whole section needs updating. @defmac define-modify-macro name arglist function [doc-string] This macro defines a ``read-modify-write'' macro similar to @@ -4992,7 +4978,7 @@ @code{setf} is supposed to behave. As a special (non-Common-Lisp) extension, a third argument of @code{t} -to @code{defsetf} says that the @code{update-fn}'s return value is +to @code{defsetf} says that the return value of @code{update-fn} is not suitable, so that the above @code{setf} should be expanded to something more like @@ -5015,7 +5001,7 @@ @defmac defsetf access-fn arglist (store-var) forms@dots{} This is the second, more complex, form of @code{defsetf}. It is rather like @code{defmacro} except for the additional @var{store-var} -argument. The @var{forms} should return a Lisp form which stores +argument. The @var{forms} should return a Lisp form that stores the value of @var{store-var} into the generalized variable formed by a call to @var{access-fn} with arguments described by @var{arglist}. The @var{forms} may begin with a string which documents the @code{setf} @@ -5031,7 +5017,7 @@ The Lisp form that is returned can access the arguments from @var{arglist} and @var{store-var} in an unrestricted fashion; -macros like @code{setf} and @code{cl-incf} which invoke this +macros like @code{cl-incf} that invoke this setf-method will insert temporary variables as needed to make sure the apparent order of evaluation is preserved. @@ -5048,6 +5034,7 @@ a @code{setf} to @var{access-fn} with arguments described by @var{arglist} is expanded, the @var{forms} are evaluated and must return a list of five items: +@c FIXME Is this still true? @enumerate @item @@ -5063,12 +5050,12 @@ from a call to @code{gensym}). @item -A Lisp form which stores the contents of the store variable into +A Lisp form that stores the contents of the store variable into the generalized variable, assuming the temporaries have been bound as described above. @item -A Lisp form which accesses the contents of the generalized variable, +A Lisp form that accesses the contents of the generalized variable, assuming the temporaries have been bound. @end enumerate @@ -5084,7 +5071,8 @@ @code{defsetf}, the second return value is simply the list of arguments in the place form, and the first return value is a list of a corresponding number of temporary variables generated -by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which +@c FIXME I don't think this is true anymore. +by @code{cl-gensym}. Macros like @code{cl-incf} that use this setf-method will optimize away most temporaries that turn out to be unnecessary, so there is little reason for the setf-method itself to optimize. @@ -5095,12 +5083,14 @@ invoking the definition previously recorded by @code{defsetf} or @code{define-setf-method}. The result is a list of five values as described above. You can use this function to build -your own @code{cl-incf}-like modify macros. (Actually, it is -@c FIXME? -better to use the internal functions @code{cl-setf-do-modify} -and @code{cl-setf-do-store}, which are a bit easier to use and -which also do a number of optimizations; consult the source -code for the @code{cl-incf} function for a simple example.) +your own @code{cl-incf}-like modify macros. +@c These no longer exist. +@ignore +(Actually, it is better to use the internal functions +@code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit +easier to use and which also do a number of optimizations; consult the +source code for the @code{cl-incf} function for a simple example.) +@end ignore The argument @var{env} specifies the ``environment'' to be passed on to @code{macroexpand} if @code{get-setf-method} should @@ -5108,12 +5098,14 @@ an @code{&environment} argument to the macro or setf-method that called @code{get-setf-method}. +@c FIXME No longer true. See also the source code for the setf-method for @c Also @code{apply}, but that is commented out. @code{substring}, which works by calling @code{get-setf-method} on a simpler case, then massaging the result. @end defun +@c FIXME does not belong here any more, maybe in lispref? Modern Common Lisp defines a second, independent way to specify the @code{setf} behavior of a function, namely ``@code{setf} functions'' whose names are lists @code{(setf @var{name})} === modified file 'etc/NEWS' --- etc/NEWS 2012-11-02 16:14:06 +0000 +++ etc/NEWS 2012-11-03 19:14:22 +0000 @@ -313,6 +313,7 @@ ** CL ++++ *** CL's main entry is now (require 'cl-lib). `cl-lib' is like the old `cl' except that it uses the namespace cleanly, i.e. all its definitions have the "cl-" prefix (and internal definitions use @@ -323,8 +324,8 @@ that had to use `foo*' to avoid conflicts with pre-existing Elisp entities, which have not been renamed to `cl-foo*' but just `cl-foo'. -The old `cl' is now deprecated and is just a bunch of aliases that -provide the old non-prefixed names. +The old `cl' is now deprecated and is mainly just a bunch of aliases that +provide the old non-prefixed names. Some exceptions are listed below. +++ *** `cl-flet' is not like `flet' (which is deprecated). @@ -829,7 +830,7 @@ recursive invocations. ** Window changes - ++++ *** The functions get-lru-window, get-mru-window and get-largest-window now accept a third argument to avoid choosing the selected window. @@ -842,9 +843,12 @@ *** New function `fit-frame-to-buffer' and new options `fit-frame-to-buffer' and `fit-frame-to-buffer-bottom-margin'. - ++++ +*** New option switch-to-buffer-preserve-window-point to restore a +window's point when switching buffers. ++++ *** New display action functions `display-buffer-below-selected', -`display-buffer-at-bottom' and `display-buffer-in-previous-window'. +and `display-buffer-in-previous-window'. *** New display action alist entry `inhibit-switch-frame', if non-nil, tells display action functions to avoid changing which frame is @@ -852,10 +856,10 @@ *** New display action alist entry `pop-up-frame-parameters', if non-nil, specifies frame parameters to give any newly-created frame. - ++++ *** New display action alist entry `previous-window', if non-nil, specifies window to reuse in `display-buffer-in-previous-window'. - ++++ *** New display action alist entries `window-height' and `window-width' to specify size of new window created by `display-buffer'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-03 18:36:09 +0000 +++ lisp/ChangeLog 2012-11-03 19:14:22 +0000 @@ -1,5 +1,28 @@ 2012-11-03 Glenn Morris + * emacs-lisp/cl-macs.el (cl-parse-loop-clause): + Rename handler properties back from cl-- to cl-. (Bug#12788) + + * emacs-lisp/cl-macs.el (cl-do-all-symbols): Add doc string. + +2012-11-03 Eli Zaretskii + + * term/pc-win.el: Don't load term/internal from here. + + * loadup.el: Load term/internal from here. + +2012-11-03 Fabián Ezequiel Gallina + + * progmodes/python.el (inferior-python-mode): Fix hang in + jit-lock (Bug#12645). + +2012-11-03 Martin Rudalics + + * window.el (switch-to-visible-buffer) + (switch-to-buffer-preserve-window-point): Fix doc-strings. + +2012-11-03 Glenn Morris + * emacs-lisp/cl-lib.el (cl--random-time): Rename from cl-random-time. (Bug#12773) (cl--gensym-counter, cl--random-state): Update callers. === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2012-10-25 00:58:40 +0000 +++ lisp/emacs-lisp/cl-macs.el 2012-11-03 18:32:09 +0000 @@ -1259,8 +1259,9 @@ loop-for-steps))) (t + ;; This is an advertised interface: (info "(cl)Other Clauses"). (let ((handler (and (symbolp word) - (get word 'cl--loop-for-handler)))) + (get word 'cl-loop-for-handler)))) (if handler (funcall handler var) (error "Expected a `for' preposition, found %s" word))))) @@ -1407,7 +1408,8 @@ ,cl--loop-finish-flag nil) cl--loop-body)) (t - (let ((handler (and (symbolp word) (get word 'cl--loop-handler)))) + ;; This is an advertised interface: (info "(cl)Other Clauses"). + (let ((handler (and (symbolp word) (get word 'cl-loop-handler)))) (or handler (error "Expected a cl-loop keyword, found %s" word)) (funcall handler)))) (if (eq (car cl--loop-args) 'and) @@ -1579,6 +1581,9 @@ ;;;###autoload (defmacro cl-do-all-symbols (spec &rest body) + "Like `cl-do-symbols', but use the default obarray. + +\(fn (VAR [RESULT]) BODY...)" (declare (indent 1) (debug ((symbolp &optional form) cl-declarations body))) `(cl-do-symbols (,(car spec) nil ,(cadr spec)) ,@body)) === modified file 'lisp/loadup.el' --- lisp/loadup.el 2012-10-20 10:01:19 +0000 +++ lisp/loadup.el 2012-11-03 13:56:02 +0000 @@ -257,6 +257,7 @@ (load "dos-vars") ;; Don't load term/common-win: it isn't appropriate for the `pc' ;; ``window system'', which generally behaves like a terminal. + (load "term/internal") (load "term/pc-win") (load "ls-lisp") (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-12 00:07:25 +0000 +++ lisp/progmodes/python.el 2012-11-03 12:20:02 +0000 @@ -1733,17 +1733,24 @@ (set (make-local-variable 'font-lock-defaults) '(python-font-lock-keywords nil nil nil nil)) (set (make-local-variable 'syntax-propertize-function) - (syntax-propertize-rules - (comint-prompt-regexp - (0 (ignore - (put-text-property - comint-last-input-start end 'syntax-table - python-shell-output-syntax-table) - (font-lock-unfontify-region comint-last-input-start end)))) - ((python-rx string-delimiter) - (0 (ignore - (and (not (eq (get-text-property start 'field) 'output)) - (python-syntax-stringify)))))))) + (eval + ;; XXX: Unfortunately eval is needed here to make use of the + ;; dynamic value of `comint-prompt-regexp'. + `(syntax-propertize-rules + (,comint-prompt-regexp + (0 (ignore + (put-text-property + comint-last-input-start end 'syntax-table + python-shell-output-syntax-table) + ;; XXX: This might look weird, but it is the easiest + ;; way to ensure font lock gets cleaned up before the + ;; current prompt, which is needed for unclosed + ;; strings to not mess up with current input. + (font-lock-unfontify-region comint-last-input-start end)))) + (,(python-rx string-delimiter) + (0 (ignore + (and (not (eq (get-text-property start 'field) 'output)) + (python-syntax-stringify))))))))) (compilation-shell-minor-mode 1)) (defun python-shell-make-comint (cmd proc-name &optional pop internal) === modified file 'lisp/term/pc-win.el' --- lisp/term/pc-win.el 2012-03-06 19:48:46 +0000 +++ lisp/term/pc-win.el 2012-11-03 13:56:02 +0000 @@ -40,8 +40,6 @@ (error "%s: Loading pc-win.el but not compiled for MS-DOS" (invocation-name))) -(load "term/internal" nil t) - (declare-function msdos-remember-default-colors "msdos.c") (declare-function w16-set-clipboard-data "w16select.c") (declare-function w16-get-clipboard-data "w16select.c") === modified file 'lisp/window.el' --- lisp/window.el 2012-10-31 10:02:51 +0000 +++ lisp/window.el 2012-11-03 10:47:03 +0000 @@ -3091,10 +3091,11 @@ "If non-nil, allow switching to an already visible buffer. If this variable is non-nil, `switch-to-prev-buffer' and `switch-to-next-buffer' may switch to an already visible buffer -provided the buffer was shown in the argument window before. If -this variable is nil, `switch-to-prev-buffer' and -`switch-to-next-buffer' always try to avoid switching to a buffer -that is already visible in another window on the same frame." +provided the buffer was shown before in the window specified as +argument to those functions. If this variable is nil, +`switch-to-prev-buffer' and `switch-to-next-buffer' always try to +avoid switching to a buffer that is already visible in another +window on the same frame." :type 'boolean :version "24.1" :group 'windows) @@ -5855,8 +5856,8 @@ unconditionally tries to display the buffer at its previous position in the selected window. -This variable is ignored if the the buffer is already displayed -in the selected window or never appeared in it before, or if +This variable is ignored if the buffer is already displayed in +the selected window or never appeared in it before, or if `switch-to-buffer' calls `pop-to-buffer' to display the buffer." :type '(choice (const :tag "Never" nil) === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2012-10-08 09:32:40 +0000 +++ msdos/ChangeLog 2012-11-03 13:48:33 +0000 @@ -1,3 +1,13 @@ +2012-11-03 Eli Zaretskii + + * sedlibmk.inp: Sync with changes in lib/Makefile.in. + (HAVE_DECL_ENVIRON, GNULIB_ENVIRON): Edit to require declaration + through lib/unistd.h. + + * sed1v2.inp: Sync with changes in src/Makefile.in. + + * sed2v2.inp: Sync with changes in src/config.in. + 2012-10-08 Eli Zaretskii * sed1v2.inp (W32_LIBS, W32_OBJ): Edit to empty. === modified file 'msdos/sed1v2.inp' --- msdos/sed1v2.inp 2012-10-08 09:32:40 +0000 +++ msdos/sed1v2.inp 2012-11-03 13:48:33 +0000 @@ -55,11 +55,11 @@ /^LIB_STANDARD *=/s/@LIB_STANDARD@// /^LIB_MATH *=/s/@LIB_MATH@/-lm/ /^LIB_PTHREAD *=/s/@LIB_PTHREAD@// -/^LIBTIFF *=/s/@LIBTIFF@// -/^LIBJPEG *=/s/@LIBJPEG@// -/^LIBPNG *=/s/@LIBPNG@// -/^LIBGIF *=/s/@LIBGIF@// -/^LIBXPM *=/s/@LIBXPM@// +s/ *@LIBTIFF@// +s/ *@LIBJPEG@// +s/ *@LIBPNG@// +s/ *@LIBGIF@// +s/ *@LIBXPM@// /^XFT_LIBS *=/s/@XFT_LIBS@// /^FONTCONFIG_CFLAGS *=/s/@FONTCONFIG_CFLAGS@// /^FONTCONFIG_LIBS *=/s/@FONTCONFIG_LIBS@// @@ -95,10 +95,8 @@ /^LIBXML2_CFLAGS *=/s/@LIBXML2_CFLAGS@// /^WIDGET_OBJ *=/s/@WIDGET_OBJ@// /^CYGWIN_OBJ *=/s/@CYGWIN_OBJ@// +/^WINDOW_SYSTEM_OBJ *=/s/@WINDOW_SYSTEM_OBJ@// /^MSDOS_OBJ *=/s/= */= dosfns.o msdos.o w16select.o/ -/^ns_appdir *=/s/@ns_appdir@// -/^ns_appbindir *=/s/@ns_appbindir@// -/^ns_appsrc *=/s/@ns_appsrc@// /^NS_OBJ *=/s/@NS_OBJ@// /^NS_OBJC_OBJ *=/s/@NS_OBJC_OBJ@// /^GNU_OBJC_CFLAGS*=/s/@GNU_OBJC_CFLAGS@// @@ -107,6 +105,7 @@ /^LIB_PTHREAD_SIGMASK *=/s/@[^@\n]*@// /^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g /^LIB_TIMER_TIME *=/s/@[^@\n]*@//g +/^LIB_EXECINFO *=/s/@[^@\n]*@//g /^LIBGNUTLS_LIBS *=/s/@[^@\n]*@// /^LIBGNUTLS_CFLAGS *=/s/@[^@\n]*@// /^GETLOADAVG_LIBS *=/s/@[^@\n]*@// @@ -143,7 +142,7 @@ /^ *test "X\$(PAXCTL)" = X/d /^ *test "\$(CANNOT_DUMP)" = "yes"/d /^ if test "\$(CANNOT_DUMP)" =/,/^ else /d -/^ -\{0,1\} *ln -/s/bootstrap-emacs\$(EXEEXT).*$/bootstrap-emacs$(EXEEXT)/ +/^ -\{0,1\} *ln /s/bootstrap-emacs\$(EXEEXT).*$/bootstrap-emacs$(EXEEXT)/ /^ fi/d /^ *LC_ALL=C \$(RUN_TEMACS)/i\ stubedit temacs.exe minstack=1024k @@ -170,7 +169,7 @@ /^ #/d /^ cd.*make-docfile/s!$!; cd ../src! /^ @: /d -/^ -\{0,1\} *ln -/s/ln -f/cp -pf/ +/^ -\{0,1\} *ln /s/ln /cp / /^[ ]touch /s/touch/djecho $@ >/ s/@YMF_PASS_LDFLAGS@/flags/ s/@lisp_frag@// === modified file 'msdos/sed2v2.inp' --- msdos/sed2v2.inp 2012-11-02 00:48:12 +0000 +++ msdos/sed2v2.inp 2012-11-03 19:14:22 +0000 @@ -30,26 +30,25 @@ #ifndef MSDOS\ #define MSDOS\ #endif +/^#undef COPYRIGHT *$/s/^.*$/#define COPYRIGHT "Copyright (C) 2012 Free Software Foundation, Inc."/ +/^#undef DIRECTORY_SEP *$/s!^.*$!#define DIRECTORY_SEP '/'! /^#undef DOS_NT *$/s/^.*$/#define DOS_NT/ /^#undef FLOAT_CHECK_DOMAIN *$/s/^.*$/#define FLOAT_CHECK_DOMAIN/ /^#undef HAVE_ALLOCA *$/s/^.*$/#define HAVE_ALLOCA 1/ -/^#undef HAVE_INVERSE_HYPERBOLIC *$/s/^.*$/#define HAVE_INVERSE_HYPERBOLIC/ /^#undef HAVE_SETITIMER *$/s/^.*$/#define HAVE_SETITIMER 1/ /^#undef HAVE_STRUCT_UTIMBUF *$/s/^.*$/#define HAVE_STRUCT_UTIMBUF 1/ /^#undef LOCALTIME_CACHE *$/s/^.*$/#define LOCALTIME_CACHE 1/ /^#undef HAVE_TZSET *$/s/^.*$/#define HAVE_TZSET 1/ -/^#undef HAVE_LOGB *$/s/^.*$/#define HAVE_LOGB 1/ -/^#undef HAVE_FREXP *$/s/^.*$/#define HAVE_FREXP 1/ -/^#undef HAVE_FMOD *$/s/^.*$/#define HAVE_FMOD 1/ /^#undef HAVE_RINT *$/s/^.*$/#define HAVE_RINT 1/ /^#undef HAVE_C99_STRTOLD *$/s/^.*$/#define HAVE_C99_STRTOLD 1/ -/^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ /^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/ /^#undef HAVE_MEMSET *$/s/^.*$/#define HAVE_MEMSET 1/ /^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/ /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/ +/^#undef HAVE_SETPGID *$/s/^.*$/#define HAVE_SETPGID 1/ /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/ +/^#undef HAVE_SIGSETJMP *$/s/^.*$/#define HAVE_SIGSETJMP 1/ /^#undef HAVE_GETRUSAGE *$/s/^.*$/#define HAVE_GETRUSAGE 1/ /^#undef GETTIMEOFDAY_TIMEZONE *$/s/^.*$/#define GETTIMEOFDAY_TIMEZONE struct timezone/ /^#undef HAVE_TM_GMTOFF *$/s/^.*$/#define HAVE_TM_GMTOFF 1/ @@ -70,6 +69,7 @@ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ /^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION ""/ +/^#undef PENDING_OUTPUT_COUNT/s/^.*$/#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)/ /^#undef VERSION/s/^.*$/#define VERSION "24.3.50"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ @@ -95,8 +95,6 @@ /^#undef NULL_DEVICE *$/s/^.*$/#define NULL_DEVICE "nul"/ /^#undef SEPCHAR *$/s/^.*$/#define SEPCHAR '\;'/ /^#undef USER_FULL_NAME *$/s/^.*$/#define USER_FULL_NAME (getenv ("NAME"))/ -/^#undef _setjmp/s/^.*$/#define _setjmp setjmp/ -/^#undef _longjmp/s/^.*$/#define _longjmp longjmp/ /^#undef inline/s/^.*$/#define inline __inline__/ /^#undef my_strftime/s/^.*$/#define my_strftime nstrftime/ /^#undef restrict/s/^.*$/#define restrict __restrict/ === modified file 'msdos/sedlibmk.inp' --- msdos/sedlibmk.inp 2012-10-04 07:15:42 +0000 +++ msdos/sedlibmk.inp 2012-11-03 13:48:33 +0000 @@ -141,6 +141,7 @@ /^DEPFLAGS *=/s/@[^@\n]*@/-MMD -MF ${DEPDIR}\/$*.d/ /^ECHO_N *=/s/@[^@\n]*@/-n/ /^EXEEXT *=/s/@[^@\n]*@/.exe/ +/^EXECINFO_H *=/s/@[^@\n]*@/execinfo.h/ /^GETOPT_H *=/s/@[^@\n]*@/getopt.h/ # # Gnulib stuff @@ -165,7 +166,7 @@ /^GNULIB_DUP *=/s/@GNULIB_DUP@/0/ /^GNULIB_DUP2 *=/s/@GNULIB_DUP2@/0/ /^GNULIB_DUP3 *=/s/@GNULIB_DUP3@/1/ -/^GNULIB_ENVIRON *=/s/@GNULIB_ENVIRON@/0/ +/^GNULIB_ENVIRON *=/s/@GNULIB_ENVIRON@/1/ /^GNULIB_EUIDACCESS *=/s/@GNULIB_EUIDACCESS@/0/ /^GNULIB_FACCESSAT *=/s/@GNULIB_FACCESSAT@/0/ /^GNULIB_FCHDIR *=/s/@GNULIB_FCHDIR@/0/ @@ -319,7 +320,7 @@ /^HAVE_ATOLL *=/s/@HAVE_ATOLL@/0/ /^HAVE_CANONICALIZE_FILE_NAME *=/s/@HAVE_CANONICALIZE_FILE_NAME@/0/ /^HAVE_CHOWN *=/s/@HAVE_CHOWN@/1/ -/^HAVE_DECL_ENVIRON *=/s/@HAVE_DECL_ENVIRON@/1/ +/^HAVE_DECL_ENVIRON *=/s/@HAVE_DECL_ENVIRON@/0/ /^HAVE_DECL_FCHDIR *=/s/@HAVE_DECL_FCHDIR@/0/ /^HAVE_DECL_FDATASYNC *=/s/@HAVE_DECL_FDATASYNC@/0/ /^HAVE_DECL_FPURGE *=/s/@HAVE_DECL_FPURGE@// @@ -540,6 +541,7 @@ /^REPLACE_PREAD *=/s/@REPLACE_PREAD@/0/ /^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/ /^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/ +/^REPLACE_PTSNAME *=/s/@REPLACE_PTSNAME@/0/ /^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/ /^REPLACE_PTSNAME *=/s/@REPLACE_PTSNAME@/0/ /^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/ @@ -646,6 +648,8 @@ # Fix the recipes for header files s/^@GL_GENERATE_ALLOCA_H_TRUE@// s/^@GL_GENERATE_ALLOCA_H_FALSE@/\#/ +s/^@GL_GENERATE_EXECINFO_H_TRUE@// +s/^@GL_GENERATE_EXECINFO_H_FALSE@/\#/ s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/ s/^@GL_GENERATE_STDBOOL_H_FALSE@// s/^@GL_GENERATE_STDALIGN_H_TRUE@// === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 18:54:17 +0000 +++ src/ChangeLog 2012-11-03 19:14:22 +0000 @@ -1,3 +1,21 @@ +2012-11-03 Eli Zaretskii + + * lisp.mk: Adjust comments to the fact that term/internal is now + loaded from loadup.el. + + * msdos.c (msdos_abort): Rename from emacs_abort, and make static. + (msdos_fatal_signal): New function. + (XMenuActivate): Adjust the call to kbd_buffer_events_waiting to + its argument list. + + * conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Define to "inline" + for GCC versions before 4. + (emacs_raise): Define to call msdos_fatal_signal. + + * xdisp.c (init_from_display_pos): Fix initialization of the bidi + iterator when starting in the middle of a display or overlay + string. (Bug#12745) + 2012-11-03 Paul Eggert Fix data-loss with --batch (Bug#9574). === modified file 'src/conf_post.h' --- src/conf_post.h 2012-10-31 17:27:29 +0000 +++ src/conf_post.h 2012-11-03 13:48:33 +0000 @@ -110,8 +110,17 @@ #else # define lstat stat #endif +/* The "portable" definition of _GL_INLINE on config.h does not work + with DJGPP GCC 3.4.4: it causes unresolved externals in sysdep.c, + although lib/execinfo.h is included and the inline functions there + are visible. */ +#if __GNUC__ < 4 +# define _GL_EXECINFO_INLINE inline +#endif /* End of gnulib-related stuff. */ +#define emacs_raise(sig) msdos_fatal_signal (sig) + #ifndef HAVE_SETPGID # ifdef USG # define setpgid(pid, pgid) setpgrp () === modified file 'src/lisp.mk' --- src/lisp.mk 2012-10-21 01:19:46 +0000 +++ src/lisp.mk 2012-11-03 13:56:02 +0000 @@ -34,9 +34,9 @@ ## that does not have an explicit .el extension, but beware of any ## no-byte-compile ones. -## Confusingly, term/internal is not in loadup, but is unconditionally -## loaded by pc-win, which is. Ditto for international/cp51932 and -## international/eucjp-ms, loaded from language/japanese. +## Confusingly, international/cp51932 and international/eucjp-ms are +## unconditionally loaded from language/japanese, instead of being +## loaded directly from loadup.el; FIXME. ## Note that this list should not include lisp files which might not ## be present, like site-load.el and site-init.el; this makefile === modified file 'src/msdos.c' --- src/msdos.c 2012-09-23 08:44:20 +0000 +++ src/msdos.c 2012-11-03 13:48:33 +0000 @@ -3305,7 +3305,7 @@ Emacs will process them after we return and surprise the user. */ discard_mouse_events (); mouse_clear_clicks (); - if (!kbd_buffer_events_waiting (1)) + if (!kbd_buffer_events_waiting ()) clear_input_pending (); /* Allow mouse events generation by dos_rawgetc. */ mouse_preempted--; @@ -4214,8 +4214,8 @@ } #endif -void -emacs_abort (void) +static void +msdos_abort (void) { dos_ttcooked (); ScreenSetCursor (10, 0); @@ -4233,6 +4233,15 @@ } void +msdos_fatal_signal (int sig) +{ + if (sig == SIGABRT) + msdos_abort (); + else + raise (sig); +} + +void syms_of_msdos (void) { recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); === modified file 'src/xdisp.c' --- src/xdisp.c 2012-11-02 10:34:26 +0000 +++ src/xdisp.c 2012-11-03 19:14:22 +0000 @@ -928,6 +928,7 @@ move_it_in_display_line_to (struct it *, ptrdiff_t, int, enum move_operation_enum); void move_it_vertically_backward (struct it *, int); +static void get_visually_first_element (struct it *); static void init_to_row_start (struct it *, struct window *, struct glyph_row *); static int init_to_row_end (struct it *, struct window *, @@ -3113,6 +3114,40 @@ eassert (STRINGP (it->string)); it->current.string_pos = pos->string_pos; it->method = GET_FROM_STRING; + it->end_charpos = SCHARS (it->string); + /* Set up the bidi iterator for this overlay string. */ + if (it->bidi_p) + { + it->bidi_it.string.lstring = it->string; + it->bidi_it.string.s = NULL; + it->bidi_it.string.schars = SCHARS (it->string); + it->bidi_it.string.bufpos = it->overlay_strings_charpos; + it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; + it->bidi_it.string.unibyte = !it->multibyte_p; + bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), + FRAME_WINDOW_P (it->f), &it->bidi_it); + + /* Synchronize the state of the bidi iterator with + pos->string_pos. For any string position other than + zero, this will be done automagically when we resume + iteration over the string and get_visually_first_element + is called. But if string_pos is zero, and the string is + to be reordered for display, we need to resync manually, + since it could be that the iteration state recorded in + pos ended at string_pos of 0 moving backwards in string. */ + if (CHARPOS (pos->string_pos) == 0) + { + get_visually_first_element (it); + if (IT_STRING_CHARPOS (*it) != 0) + do { + /* Paranoia. */ + eassert (it->bidi_it.charpos < it->bidi_it.string.schars); + bidi_move_to_visually_next (&it->bidi_it); + } while (it->bidi_it.charpos != 0); + } + eassert (IT_STRING_CHARPOS (*it) == it->bidi_it.charpos + && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos); + } } if (CHARPOS (pos->string_pos) >= 0) @@ -3122,6 +3157,9 @@ IT should already be filled with that string. */ it->current.string_pos = pos->string_pos; eassert (STRINGP (it->string)); + if (it->bidi_p) + bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), + FRAME_WINDOW_P (it->f), &it->bidi_it); } /* Restore position in display vector translations, control ------------------------------------------------------------ revno: 110786 fixes bug: http://debbugs.gnu.org/9574 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-11-03 11:54:17 -0700 message: Fix data-loss with --batch. * admin/merge-gnulib (GNULIB_MODULES): Add close-stream. * lib/close-stream.c, lib/close-stream.h, lib/fpending.c * lib/fpending.h, m4/close-stream.m4, m4/fpending.m4: New files, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/emacs.c: Include . (close_output_streams): New function. (main): Pass it to atexit, so that Emacs closes stdout and stderr and handles errors appropriately. (Fkill_emacs): Don't worry about flushing, as close_output_stream does that now. diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-02 22:22:11 +0000 +++ ChangeLog 2012-11-03 18:54:17 +0000 @@ -1,3 +1,11 @@ +2012-11-03 Paul Eggert + + Fix data-loss with --batch (Bug#9574). + * lib/close-stream.c, lib/close-stream.h, lib/fpending.c + * lib/fpending.h, m4/close-stream.m4, m4/fpending.m4: + New files, from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + 2012-11-02 Glenn Morris * Makefile.in (EMACS_ICON): New variable. === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-10-19 19:25:18 +0000 +++ admin/ChangeLog 2012-11-03 18:54:17 +0000 @@ -1,3 +1,8 @@ +2012-11-01 Paul Eggert + + Fix data-loss with --batch (Bug#9574). + * merge-gnulib (GNULIB_MODULES): Add close-stream. + 2012-10-12 Kenichi Handa * charsets/Makefile (JISC6226.map): Add missing mappings. === modified file 'admin/merge-gnulib' --- admin/merge-gnulib 2012-10-19 19:25:18 +0000 +++ admin/merge-gnulib 2012-11-03 18:54:17 +0000 @@ -27,7 +27,7 @@ GNULIB_MODULES=' alloca-opt c-ctype c-strcase - careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 + careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat === added file 'lib/close-stream.c' --- lib/close-stream.c 1970-01-01 00:00:00 +0000 +++ lib/close-stream.c 2012-11-03 18:54:17 +0000 @@ -0,0 +1,78 @@ +/* Close a stream, with nicer error checking than fclose's. + + Copyright (C) 1998-2002, 2004, 2006-2012 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#include "close-stream.h" + +#include +#include + +#include "fpending.h" + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +/* Close STREAM. Return 0 if successful, EOF (setting errno) + otherwise. A failure might set errno to 0 if the error number + cannot be determined. + + A failure with errno set to EPIPE may or may not indicate an error + situation worth signaling to the user. See the documentation of the + close_stdout_set_ignore_EPIPE function for details. + + If a program writes *anything* to STREAM, that program should close + STREAM and make sure that it succeeds before exiting. Otherwise, + suppose that you go to the extreme of checking the return status + of every function that does an explicit write to STREAM. The last + printf can succeed in writing to the internal stream buffer, and yet + the fclose(STREAM) could still fail (due e.g., to a disk full error) + when it tries to write out that buffered data. Thus, you would be + left with an incomplete output file and the offending program would + exit successfully. Even calling fflush is not always sufficient, + since some file systems (NFS and CODA) buffer written/flushed data + until an actual close call. + + Besides, it's wasteful to check the return value from every call + that writes to STREAM -- just let the internal stream state record + the failure. That's what the ferror test is checking below. */ + +int +close_stream (FILE *stream) +{ + const bool some_pending = (__fpending (stream) != 0); + const bool prev_fail = (ferror (stream) != 0); + const bool fclose_fail = (fclose (stream) != 0); + + /* Return an error indication if there was a previous failure or if + fclose failed, with one exception: ignore an fclose failure if + there was no previous error, no data remains to be flushed, and + fclose failed with EBADF. That can happen when a program like cp + is invoked like this 'cp a b >&-' (i.e., with standard output + closed) and doesn't generate any output (hence no previous error + and nothing to be flushed). */ + + if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) + { + if (! fclose_fail) + errno = 0; + return EOF; + } + + return 0; +} === added file 'lib/close-stream.h' --- lib/close-stream.h 1970-01-01 00:00:00 +0000 +++ lib/close-stream.h 2012-11-03 18:54:17 +0000 @@ -0,0 +1,2 @@ +#include +int close_stream (FILE *stream); === added file 'lib/fpending.c' --- lib/fpending.c 1970-01-01 00:00:00 +0000 +++ lib/fpending.c 2012-11-03 18:54:17 +0000 @@ -0,0 +1,30 @@ +/* fpending.c -- return the number of pending output bytes on a stream + Copyright (C) 2000, 2004, 2006-2007, 2009-2012 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Jim Meyering. */ + +#include + +#include "fpending.h" + +/* Return the number of pending (aka buffered, unflushed) + bytes on the stream, FP, that is open for writing. */ +size_t +__fpending (FILE *fp) +{ + return PENDING_OUTPUT_N_BYTES; +} === added file 'lib/fpending.h' --- lib/fpending.h 1970-01-01 00:00:00 +0000 +++ lib/fpending.h 2012-11-03 18:54:17 +0000 @@ -0,0 +1,30 @@ +/* Declare __fpending. + + Copyright (C) 2000, 2003, 2005-2006, 2009-2012 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Written by Jim Meyering. */ + +#include +#include + +#if HAVE_DECL___FPENDING +# if HAVE_STDIO_EXT_H +# include +# endif +#else +size_t __fpending (FILE *); +#endif === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2012-10-19 19:25:18 +0000 +++ lib/gnulib.mk 2012-11-03 18:54:17 +0000 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings MOSTLYCLEANFILES += core *.stackdump @@ -84,6 +84,14 @@ ## end gnulib module careadlinkat +## begin gnulib module close-stream + +libgnu_a_SOURCES += close-stream.c + +EXTRA_DIST += close-stream.h + +## end gnulib module close-stream + ## begin gnulib module crypto/md5 libgnu_a_SOURCES += md5.c @@ -183,6 +191,15 @@ ## end gnulib module filemode +## begin gnulib module fpending + + +EXTRA_DIST += fpending.c fpending.h + +EXTRA_libgnu_a_SOURCES += fpending.c + +## end gnulib module fpending + ## begin gnulib module getloadavg === added file 'm4/close-stream.m4' --- m4/close-stream.m4 1970-01-01 00:00:00 +0000 +++ m4/close-stream.m4 2012-11-03 18:54:17 +0000 @@ -0,0 +1,11 @@ +#serial 4 +dnl Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Prerequisites of lib/close-stream.c. +AC_DEFUN([gl_CLOSE_STREAM], +[ + : +]) === added file 'm4/fpending.m4' --- m4/fpending.m4 1970-01-01 00:00:00 +0000 +++ m4/fpending.m4 2012-11-03 18:54:17 +0000 @@ -0,0 +1,90 @@ +# serial 19 + +# Copyright (C) 2000-2001, 2004-2012 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Jim Meyering +dnl Using code from emacs, based on suggestions from Paul Eggert +dnl and Ulrich Drepper. + +dnl Find out how to determine the number of pending output bytes on a stream. +dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems, +dnl we have to grub around in the FILE struct. + +AC_DEFUN([gl_FUNC_FPENDING], +[ + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) + AC_CHECK_FUNCS_ONCE([__fpending]) + fp_headers=' +# include +# if HAVE_STDIO_EXT_H +# include +# endif +' + AC_CHECK_DECLS([__fpending], , , $fp_headers) +]) + +AC_DEFUN([gl_PREREQ_FPENDING], +[ + AC_CACHE_CHECK( + [how to determine the number of pending output bytes on a stream], + ac_cv_sys_pending_output_n_bytes, + [ + for ac_expr in \ + \ + '# glibc2' \ + 'fp->_IO_write_ptr - fp->_IO_write_base' \ + \ + '# traditional Unix' \ + 'fp->_ptr - fp->_base' \ + \ + '# BSD' \ + 'fp->_p - fp->_bf._base' \ + \ + '# SCO, Unixware' \ + '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ + \ + '# QNX' \ + '(fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0)' \ + \ + '# old glibc?' \ + 'fp->__bufp - fp->__buffer' \ + \ + '# old glibc iostream?' \ + 'fp->_pptr - fp->_pbase' \ + \ + '# emx+gcc' \ + 'fp->_ptr - fp->_buffer' \ + \ + '# Minix' \ + 'fp->_ptr - fp->_buf' \ + \ + '# Plan9' \ + 'fp->wp - fp->buf' \ + \ + '# VMS' \ + '(*fp)->_ptr - (*fp)->_base' \ + \ + '# e.g., DGUX R4.11; the info is not available' \ + 1 \ + ; do + + # Skip each embedded comment. + case "$ac_expr" in '#'*) continue;; esac + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[FILE *fp = stdin; (void) ($ac_expr);]])], + [fp_done=yes] + ) + test "$fp_done" = yes && break + done + + ac_cv_sys_pending_output_n_bytes=$ac_expr + ] + ) + AC_DEFINE_UNQUOTED([PENDING_OUTPUT_N_BYTES], + $ac_cv_sys_pending_output_n_bytes, + [the number of pending output bytes on stream 'fp']) +]) === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2012-10-19 19:25:18 +0000 +++ m4/gnulib-comp.m4 2012-11-03 18:54:17 +0000 @@ -44,6 +44,7 @@ # Code from module c-strcase: # Code from module careadlinkat: # Code from module clock-time: + # Code from module close-stream: # Code from module crypto/md5: # Code from module crypto/sha1: # Code from module crypto/sha256: @@ -58,6 +59,7 @@ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module extern-inline: # Code from module filemode: + # Code from module fpending: # Code from module getloadavg: # Code from module getopt-gnu: # Code from module getopt-posix: @@ -141,6 +143,8 @@ gl_FUNC_ALLOCA AC_CHECK_FUNCS_ONCE([readlinkat]) gl_CLOCK_TIME + gl_CLOSE_STREAM + gl_MODULE_INDICATOR([close-stream]) gl_MD5 gl_SHA1 gl_SHA256 @@ -157,6 +161,11 @@ gl_EXECINFO_H AC_REQUIRE([gl_EXTERN_INLINE]) gl_FILEMODE + gl_FUNC_FPENDING + if test $ac_cv_func___fpending = no; then + AC_LIBOBJ([fpending]) + gl_PREREQ_FPENDING + fi gl_GETLOADAVG if test $HAVE_GETLOADAVG = 0; then AC_LIBOBJ([getloadavg]) @@ -534,6 +543,8 @@ lib/c-strncasecmp.c lib/careadlinkat.c lib/careadlinkat.h + lib/close-stream.c + lib/close-stream.h lib/dosname.h lib/dtoastr.c lib/dtotimespec.c @@ -542,6 +553,8 @@ lib/execinfo.in.h lib/filemode.c lib/filemode.h + lib/fpending.c + lib/fpending.h lib/ftoastr.c lib/ftoastr.h lib/getloadavg.c @@ -609,12 +622,14 @@ m4/alloca.m4 m4/c-strtod.m4 m4/clock_time.m4 + m4/close-stream.m4 m4/dup2.m4 m4/environ.m4 m4/execinfo.m4 m4/extensions.m4 m4/extern-inline.m4 m4/filemode.m4 + m4/fpending.m4 m4/getloadavg.m4 m4/getopt.m4 m4/gettime.m4 === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 18:32:41 +0000 +++ src/ChangeLog 2012-11-03 18:54:17 +0000 @@ -1,5 +1,13 @@ 2012-11-03 Paul Eggert + Fix data-loss with --batch (Bug#9574). + * emacs.c: Include . + (close_output_streams): New function. + (main): Pass it to atexit, so that Emacs closes stdout and stderr + and handles errors appropriately. + (Fkill_emacs): Don't worry about flushing, as close_output_stream + does that now. + Fix a race condition that causes Emacs to mess up glib (Bug#8855). The symptom is a diagnostic "GLib-WARNING **: In call to g_spawn_sync(), exit status of a child process was requested but === modified file 'src/emacs.c' --- src/emacs.c 2012-10-31 17:27:29 +0000 +++ src/emacs.c 2012-11-03 18:54:17 +0000 @@ -27,6 +27,7 @@ #include #include +#include #include #include "lisp.h" @@ -675,6 +676,22 @@ #endif /* DOUG_LEA_MALLOC */ +/* Close standard output and standard error, reporting any write + errors as best we can. This is intended for use with atexit. */ +static void +close_output_streams (void) +{ + if (close_stream (stdout) != 0) + { + fprintf (stderr, "Write error to standard output: %s\n", + emacs_strerror (errno)); + fflush (stderr); + _exit (EXIT_FAILURE); + } + + if (close_stream (stderr) != 0) + _exit (EXIT_FAILURE); +} /* ARGSUSED */ int @@ -890,6 +907,8 @@ if (do_initial_setlocale) setlocale (LC_ALL, ""); + atexit (close_output_streams); + inhibit_window_system = 0; /* Handle the -t switch, which specifies filename to use as terminal. */ @@ -1867,8 +1886,6 @@ exit_code = (XINT (arg) < 0 ? XINT (arg) | INT_MIN : XINT (arg) & INT_MAX); - else if (noninteractive && (fflush (stdout) || ferror (stdout))) - exit_code = EXIT_FAILURE; else exit_code = EXIT_SUCCESS; exit (exit_code); ------------------------------------------------------------ revno: 110785 fixes bug: http://debbugs.gnu.org/12773 committer: Glenn Morris branch nick: trunk timestamp: Sat 2012-11-03 11:36:09 -0700 message: Rename cl-random-time to cl--random-time * emacs-lisp/cl-lib.el (cl--random-time): Rename from cl-random-time. (cl--gensym-counter, cl--random-state): Update callers. * emacs-lisp/cl-extra.el (cl-make-random-state): Update callers. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-03 15:24:00 +0000 +++ lisp/ChangeLog 2012-11-03 18:36:09 +0000 @@ -1,3 +1,10 @@ +2012-11-03 Glenn Morris + + * emacs-lisp/cl-lib.el (cl--random-time): + Rename from cl-random-time. (Bug#12773) + (cl--gensym-counter, cl--random-state): Update callers. + * emacs-lisp/cl-extra.el (cl-make-random-state): Update callers. + 2012-11-03 Chong Yidong * cus-start.el: Make cursor-type customizable (Bug#11633). === modified file 'lisp/emacs-lisp/cl-extra.el' --- lisp/emacs-lisp/cl-extra.el 2012-10-30 08:03:22 +0000 +++ lisp/emacs-lisp/cl-extra.el 2012-11-03 18:36:09 +0000 @@ -440,7 +440,7 @@ (cond ((null state) (cl-make-random-state cl--random-state)) ((vectorp state) (copy-tree state t)) ((integerp state) (vector 'cl-random-state-tag -1 30 state)) - (t (cl-make-random-state (cl-random-time))))) + (t (cl-make-random-state (cl--random-time))))) ;;;###autoload (defun cl-random-state-p (object) === modified file 'lisp/emacs-lisp/cl-lib.el' --- lisp/emacs-lisp/cl-lib.el 2012-10-11 20:36:23 +0000 +++ lisp/emacs-lisp/cl-lib.el 2012-11-03 18:36:09 +0000 @@ -264,12 +264,12 @@ ;;; Symbols. -(defun cl-random-time () +(defun cl--random-time () (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0)) (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i)))) v)) -(defvar cl--gensym-counter (* (logand (cl-random-time) 1023) 100)) +(defvar cl--gensym-counter (* (logand (cl--random-time) 1023) 100)) ;;; Numbers. @@ -296,7 +296,7 @@ "Return t if INTEGER is even." (eq (logand integer 1) 0)) -(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl-random-time))) +(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl--random-time))) (defconst cl-most-positive-float nil "The largest value that a Lisp float can hold. ------------------------------------------------------------ revno: 110784 fixes bug: http://debbugs.gnu.org/8855 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-11-03 11:32:41 -0700 message: Fix a race condition that causes Emacs to mess up glib. The symptom is a diagnostic "GLib-WARNING **: In call to g_spawn_sync(), exit status of a child process was requested but SIGCHLD action was set to SIG_IGN and ECHILD was received by waitpid(), so exit status can't be returned." The diagnostic is partly wrong, as the SIGCHLD action is not set to SIG_IGN. The real bug is a race condition between Emacs and glib: Emacs does a waitpid (-1, ...) and reaps glib's subprocess by mistake, so that glib can't find it. Work around the bug by invoking waitpid only on subprocesses that Emacs itself creates. * process.c (create_process, record_child_status_change): Don't use special value -1 in pid field, as the caller now must know the pid rather than having the callee infer it. The inference was sometimes incorrect anyway, due to another race. (create_process): Set new 'alive' member if child is created. (process_status_retrieved): New function. (record_child_status_change): Use it. Accept negative 1st argument, which means to wait for the processes that Emacs already knows about. Move special-case code for DOS_NT (which lacks WNOHANG) here, from caller. Keep track of processes that have already been waited for, by testing and clearing new 'alive' member. (CAN_HANDLE_MULTIPLE_CHILDREN): Remove, as record_child_status_change now does this internally. (handle_child_signal): Let record_child_status_change do all the work, since we do not want to reap all exited child processes, only the child processes that Emacs itself created. * process.h (Lisp_Process): New boolean member 'alive'. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 18:19:50 +0000 +++ src/ChangeLog 2012-11-03 18:32:41 +0000 @@ -1,5 +1,34 @@ 2012-11-03 Paul Eggert + Fix a race condition that causes Emacs to mess up glib (Bug#8855). + The symptom is a diagnostic "GLib-WARNING **: In call to + g_spawn_sync(), exit status of a child process was requested but + SIGCHLD action was set to SIG_IGN and ECHILD was received by + waitpid(), so exit status can't be returned." The diagnostic + is partly wrong, as the SIGCHLD action is not set to SIG_IGN. + The real bug is a race condition between Emacs and glib: Emacs + does a waitpid (-1, ...) and reaps glib's subprocess by mistake, + so that glib can't find it. Work around the bug by invoking + waitpid only on subprocesses that Emacs itself creates. + * process.c (create_process, record_child_status_change): + Don't use special value -1 in pid field, as the caller now must + know the pid rather than having the callee infer it. The + inference was sometimes incorrect anyway, due to another race. + (create_process): Set new 'alive' member if child is created. + (process_status_retrieved): New function. + (record_child_status_change): Use it. + Accept negative 1st argument, which means to wait for the + processes that Emacs already knows about. Move special-case code + for DOS_NT (which lacks WNOHANG) here, from caller. Keep track of + processes that have already been waited for, by testing and + clearing new 'alive' member. + (CAN_HANDLE_MULTIPLE_CHILDREN): Remove, as record_child_status_change + now does this internally. + (handle_child_signal): Let record_child_status_change do all + the work, since we do not want to reap all exited child processes, + only the child processes that Emacs itself created. + * process.h (Lisp_Process): New boolean member 'alive'. + Omit duplicate definitions no longer needed with gcc -g3. * lisp.h (GCTYPEBITS, GCALIGNMENT, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG) (VALMASK, MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM): === modified file 'src/process.c' --- src/process.c 2012-11-03 16:36:23 +0000 +++ src/process.c 2012-11-03 18:32:41 +0000 @@ -130,6 +130,10 @@ EMACS_TIME *, void *); #endif +/* This is for DOS_NT ports. FIXME: Remove this old portability cruft + by having DOS_NT ports implement waitpid instead of wait. Nowadays + POSIXish hosts all define waitpid, WNOHANG, and WUNTRACED, as these + have been standard since POSIX.1-1988. */ #ifndef WNOHANG # undef waitpid # define waitpid(pid, status, options) wait (status) @@ -795,9 +799,8 @@ #ifdef SIGCHLD /* Fdelete_process promises to immediately forget about the process, but in reality, Emacs needs to remember those processes until they have been - treated by the SIGCHLD handler; otherwise this handler would consider the - process as being synchronous and say that the synchronous process is - dead. */ + treated by the SIGCHLD handler and waitpid has been invoked on them; + otherwise they might fill up the kernel's process table. */ static Lisp_Object deleted_pid_list; #endif @@ -1704,16 +1707,7 @@ if (inchannel > max_process_desc) max_process_desc = inchannel; - /* Until we store the proper pid, enable the SIGCHLD handler - to recognize an unknown pid as standing for this process. - It is very important not to let this `marker' value stay - in the table after this function has returned; if it does - it might cause call-process to hang and subsequent asynchronous - processes to get their return values scrambled. */ - XPROCESS (process)->pid = -1; - - /* This must be called after the above line because it may signal an - error. */ + /* This may signal an error. */ setup_process_coding_systems (process); encoded_current_dir = ENCODE_FILE (current_dir); @@ -1880,6 +1874,8 @@ #endif XPROCESS (process)->pid = pid; + if (0 <= pid) + XPROCESS (process)->alive = 1; /* Stop blocking signals in the parent. */ #ifdef SIGCHLD @@ -6271,9 +6267,35 @@ return process; } -/* On receipt of a signal that a child status has changed, loop asking - about children with changed statuses until the system says there - are no more. +/* If the status of the process DESIRED has changed, return true and + set *STATUS to its exit status; otherwise, return false. + If HAVE is nonnegative, assume that HAVE = waitpid (HAVE, STATUS, ...) + has already been invoked, and do not invoke waitpid again. */ + +static bool +process_status_retrieved (pid_t desired, pid_t have, int *status) +{ + if (have < 0) + { + /* Invoke waitpid only with a known process ID; do not invoke + waitpid with a nonpositive argument. Otherwise, Emacs might + reap an unwanted process by mistake. For example, invoking + waitpid (-1, ...) can mess up glib by reaping glib's subprocesses, + so that another thread running glib won't find them. */ + do + have = waitpid (desired, status, WNOHANG | WUNTRACED); + while (have < 0 && errno == EINTR); + } + + return have == desired; +} + +/* If PID is nonnegative, the child process PID with wait status W has + changed its status; record this and return true. + + If PID is negative, ignore W, and look for known child processes + of Emacs whose status have changed. For each one found, record its new + status. All we do is change the status; we do not run sentinels or print notifications. That is saved for the next time keyboard input is @@ -6296,13 +6318,23 @@ ** Malloc WARNING: This should never call malloc either directly or indirectly; if it does, that is a bug */ -/* Record the changed status of the child process PID with wait status W. */ void record_child_status_change (pid_t pid, int w) { #ifdef SIGCHLD - Lisp_Object proc; - struct Lisp_Process *p; + +# ifdef WNOHANG + /* On POSIXish hosts, record at most one child only if we already + know one child that has exited. */ + bool record_at_most_one_child = 0 <= pid; +# else + /* On DOS_NT (the only porting target that lacks WNOHANG), + record the status of at most one child process, since the SIGCHLD + handler must return right away. If any more processes want to + signal us, we will get another signal. */ + bool record_at_most_one_child = 1; +# endif + Lisp_Object tail; /* Find the process that signaled us, and record its status. */ @@ -6310,68 +6342,69 @@ /* The process can have been deleted by Fdelete_process. */ for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail)) { + bool all_pids_are_fixnums + = (MOST_NEGATIVE_FIXNUM <= TYPE_MINIMUM (pid_t) + && TYPE_MAXIMUM (pid_t) <= MOST_POSITIVE_FIXNUM); Lisp_Object xpid = XCAR (tail); - if ((INTEGERP (xpid) && pid == XINT (xpid)) - || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) + if (all_pids_are_fixnums ? INTEGERP (xpid) : NUMBERP (xpid)) { - XSETCAR (tail, Qnil); - return; + pid_t deleted_pid; + if (INTEGERP (xpid)) + deleted_pid = XINT (xpid); + else + deleted_pid = XFLOAT_DATA (xpid); + if (process_status_retrieved (deleted_pid, pid, &w)) + { + XSETCAR (tail, Qnil); + if (record_at_most_one_child) + return; + } } } /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ - p = 0; for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) { - proc = XCDR (XCAR (tail)); - p = XPROCESS (proc); - if (EQ (p->type, Qreal) && p->pid == pid) - break; - p = 0; - } - - /* Look for an asynchronous process whose pid hasn't been filled - in yet. */ - if (! p) - for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) - { - proc = XCDR (XCAR (tail)); - p = XPROCESS (proc); - if (p->pid == -1) - break; - p = 0; - } - - /* Change the status of the process that was found. */ - if (p) - { - int clear_desc_flag = 0; - - p->tick = ++process_tick; - p->raw_status = w; - p->raw_status_new = 1; - - /* If process has terminated, stop waiting for its output. */ - if ((WIFSIGNALED (w) || WIFEXITED (w)) - && p->infd >= 0) - clear_desc_flag = 1; - - /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ - if (clear_desc_flag) + Lisp_Object proc = XCDR (XCAR (tail)); + struct Lisp_Process *p = XPROCESS (proc); + if (p->alive && process_status_retrieved (p->pid, pid, &w)) { - FD_CLR (p->infd, &input_wait_mask); - FD_CLR (p->infd, &non_keyboard_wait_mask); + /* Change the status of the process that was found. */ + p->tick = ++process_tick; + p->raw_status = w; + p->raw_status_new = 1; + + /* If process has terminated, stop waiting for its output. */ + if (WIFSIGNALED (w) || WIFEXITED (w)) + { + int clear_desc_flag = 0; + p->alive = 0; + if (p->infd >= 0) + clear_desc_flag = 1; + + /* clear_desc_flag avoids a compiler bug in Microsoft C. */ + if (clear_desc_flag) + { + FD_CLR (p->infd, &input_wait_mask); + FD_CLR (p->infd, &non_keyboard_wait_mask); + } + } + + /* Tell wait_reading_process_output that it needs to wake up and + look around. */ + if (input_available_clear_time) + *input_available_clear_time = make_emacs_time (0, 0); + + if (record_at_most_one_child) + return; } - - /* Tell wait_reading_process_output that it needs to wake up and - look around. */ - if (input_available_clear_time) - *input_available_clear_time = make_emacs_time (0, 0); } - /* There was no asynchronous process found for that pid: we have - a synchronous process. */ - else + + if (0 <= pid) { + /* The caller successfully waited for a pid but no asynchronous + process was found for it, so this is a synchronous process. */ + synch_process_alive = 0; /* Report the status of the synchronous process. */ @@ -6390,38 +6423,10 @@ #ifdef SIGCHLD -/* On some systems, the SIGCHLD handler must return right away. If - any more processes want to signal us, we will get another signal. - Otherwise, loop around to use up all the processes that have - something to tell us. */ -#if (defined WINDOWSNT \ - || (defined USG && !defined GNU_LINUX \ - && !(defined HPUX && defined WNOHANG))) -enum { CAN_HANDLE_MULTIPLE_CHILDREN = 0 }; -#else -enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 }; -#endif - static void handle_child_signal (int sig) { - do - { - pid_t pid; - int status; - - do - pid = waitpid (-1, &status, WNOHANG | WUNTRACED); - while (pid < 0 && errno == EINTR); - - /* PID == 0 means no processes found, PID == -1 means a real failure. - Either way, we have done all our job. */ - if (pid <= 0) - break; - - record_child_status_change (pid, status); - } - while (CAN_HANDLE_MULTIPLE_CHILDREN); + record_child_status_change (-1, 0); } static void === modified file 'src/process.h' --- src/process.h 2012-08-27 17:23:48 +0000 +++ src/process.h 2012-11-03 18:32:41 +0000 @@ -142,6 +142,9 @@ /* Flag to set coding-system of the process buffer from the coding_system used to decode process output. */ unsigned int inherit_coding_system_flag : 1; + /* Whether the process is alive, i.e., can be waited for. Running + processes can be waited for, but exited and fake processes cannot. */ + unsigned int alive : 1; /* Record the process status in the raw form in which it comes from `wait'. This is to avoid consing in a signal handler. The `raw_status_new' flag indicates that `raw_status' contains a new status that still ------------------------------------------------------------ revno: 110783 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-11-03 11:19:50 -0700 message: Omit duplicate definitions no longer needed with gcc -g3. * lisp.h (GCTYPEBITS, GCALIGNMENT, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG) (VALMASK, MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM): Define only as macros. There's no longer any need to also define these symbols as enums or as constants, since we now assume gcc -g3 when debugging. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 16:36:23 +0000 +++ src/ChangeLog 2012-11-03 18:19:50 +0000 @@ -1,3 +1,12 @@ +2012-11-03 Paul Eggert + + Omit duplicate definitions no longer needed with gcc -g3. + * lisp.h (GCTYPEBITS, GCALIGNMENT, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG) + (VALMASK, MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM): + Define only as macros. There's no longer any need to also define + these symbols as enums or as constants, since we now assume + gcc -g3 when debugging. + 2012-11-03 Chong Yidong * process.c (wait_reading_process_output): Clean up the last === modified file 'src/lisp.h' --- src/lisp.h 2012-11-02 10:34:26 +0000 +++ src/lisp.h 2012-11-03 18:19:50 +0000 @@ -152,20 +152,15 @@ on the few static Lisp_Objects used: all the defsubr as well as the two special buffers buffer_defaults and buffer_local_symbols. */ -enum Lisp_Bits - { - /* Number of bits in a Lisp_Object tag. This can be used in #if, - and for GDB's sake also as a regular symbol. */ - GCTYPEBITS = +/* Number of bits in a Lisp_Object tag. This can be used in #if. */ #define GCTYPEBITS 3 - GCTYPEBITS, - /* 2**GCTYPEBITS. This must also be a macro that expands to a - literal integer constant, for MSVC. */ - GCALIGNMENT = +/* 2**GCTYPEBITS. This must be a macro that expands to a literal + integer constant, for MSVC. */ #define GCALIGNMENT 8 - GCALIGNMENT, +enum Lisp_Bits + { /* Number of bits in a Lisp_Object value, not counting the tag. */ VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS, @@ -383,15 +378,11 @@ /* In the size word of a vector, this bit means the vector has been marked. */ -static ptrdiff_t const ARRAY_MARK_FLAG #define ARRAY_MARK_FLAG PTRDIFF_MIN - = ARRAY_MARK_FLAG; /* In the size word of a struct Lisp_Vector, this bit means it's really some other vector-like object. */ -static ptrdiff_t const PSEUDOVECTOR_FLAG #define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) - = PSEUDOVECTOR_FLAG; /* In a pseudovector, the size field actually contains a word with one PSEUDOVECTOR_FLAG bit set, and one of the following values extracted @@ -473,9 +464,7 @@ #else /* not USE_LSB_TAG */ -static EMACS_INT const VALMASK #define VALMASK VAL_MAX - = VALMASK; #define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS)) @@ -523,14 +512,9 @@ #define EQ(x, y) (XHASH (x) == XHASH (y)) /* Largest and smallest representable fixnum values. These are the C - values. They are macros for use in static initializers, and - constants for visibility to GDB. */ -static EMACS_INT const MOST_POSITIVE_FIXNUM = + values. They are macros for use in static initializers. */ #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) - MOST_POSITIVE_FIXNUM; -static EMACS_INT const MOST_NEGATIVE_FIXNUM = #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) - MOST_NEGATIVE_FIXNUM; /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is written this way so that it also works if I is of unsigned ------------------------------------------------------------ revno: 110782 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-11-04 00:36:23 +0800 message: * process.c (wait_reading_process_output): Clean up last change. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 15:44:59 +0000 +++ src/ChangeLog 2012-11-03 16:36:23 +0000 @@ -1,3 +1,8 @@ +2012-11-03 Chong Yidong + + * process.c (wait_reading_process_output): Clean up the last + change. + 2012-11-03 Jim Paris (tiny change) * process.c (wait_reading_process_output): Avoid a race condition === modified file 'src/process.c' --- src/process.c 2012-11-03 15:44:59 +0000 +++ src/process.c 2012-11-03 16:36:23 +0000 @@ -4354,8 +4354,6 @@ while (1) { - int timeout_reduced_for_timers = 0; - /* If calling from keyboard input, do not quit since we want to return C-g as an input character. Otherwise, do pending quit if requested. */ @@ -4435,10 +4433,7 @@ if (EMACS_TIME_VALID_P (timer_delay)) { if (EMACS_TIME_LT (timer_delay, timeout)) - { - timeout = timer_delay; - timeout_reduced_for_timers = 1; - } + timeout = timer_delay; } else { @@ -4697,11 +4692,11 @@ /* If we woke up due to SIGWINCH, actually change size now. */ do_pending_window_change (0); - /* The following optimization fails if SIGIO is received between - set_waiting_for_input and select (Bug#11536). - if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers) - break; - */ + /* We used to break here if nfds == 0, i.e. we seemed to have + waited the full period. But apparently if Emacs receives + SIGIO between set_waiting_for_input and select, select can + return with nfds == 0 due to the timeout being zeroed out by + the signal handler (Bug#11536). */ if (nfds < 0) { ------------------------------------------------------------ revno: 110781 fixes bug: http://debbugs.gnu.org/11536 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-11-03 23:44:59 +0800 message: Fix a race condition in wait_reading_process_output (tiny change). * src/process.c (wait_reading_process_output): Avoid a race condition with SIGIO delivery. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 15:24:00 +0000 +++ src/ChangeLog 2012-11-03 15:44:59 +0000 @@ -1,3 +1,8 @@ +2012-11-03 Jim Paris (tiny change) + + * process.c (wait_reading_process_output): Avoid a race condition + with SIGIO delivery (Bug#11536). + 2012-11-03 Chong Yidong * buffer.c (cursor_type): Untabify docstring. === modified file 'src/process.c' --- src/process.c 2012-10-31 17:27:29 +0000 +++ src/process.c 2012-11-03 15:44:59 +0000 @@ -4697,9 +4697,12 @@ /* If we woke up due to SIGWINCH, actually change size now. */ do_pending_window_change (0); + /* The following optimization fails if SIGIO is received between + set_waiting_for_input and select (Bug#11536). if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers) - /* We waited the full specified time, so return now. */ break; + */ + if (nfds < 0) { if (xerrno == EINTR) ------------------------------------------------------------ revno: 110780 fixes bug: http://debbugs.gnu.org/11633 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-11-03 23:24:00 +0800 message: * lisp/cus-start.el: Make cursor-type customizable. * src/buffer.c (cursor_type): Untabify docstring. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-02 22:44:38 +0000 +++ lisp/ChangeLog 2012-11-03 15:24:00 +0000 @@ -1,3 +1,7 @@ +2012-11-03 Chong Yidong + + * cus-start.el: Make cursor-type customizable (Bug#11633). + 2012-11-02 Glenn Morris * filecache.el: No need to load find-lisp when compiling. === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2012-10-23 02:39:13 +0000 +++ lisp/cus-start.el 2012-11-03 15:24:00 +0000 @@ -51,6 +51,19 @@ (gc-cons-percentage alloc float) (garbage-collection-messages alloc boolean) ;; buffer.c + (cursor-type + display + (choice + (const :tag "Frame default" t) + (const :tag "Filled box" box) + (const :tag "Hollow cursor" hollow) + (const :tag "Vertical bar" bar) + (cons :tag "Vertical bar with specified width" + (const bar) integer) + (const :tag "Horizontal bar" hbar) + (cons :tag "Horizontal bar with specified width" + (const hbar) integer) + (const :tag "None "nil))) (mode-line-format mode-line sexp) ;Hard to do right. (major-mode internal function) (case-fold-search matching boolean) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 05:59:17 +0000 +++ src/ChangeLog 2012-11-03 15:24:00 +0000 @@ -1,3 +1,7 @@ +2012-11-03 Chong Yidong + + * buffer.c (cursor_type): Untabify docstring. + 2012-11-03 Dmitry Antipov * frame.h (struct frame): Drop can_have_scroll_bars member === modified file 'src/buffer.c' --- src/buffer.c 2012-10-17 05:22:23 +0000 +++ src/buffer.c 2012-11-03 15:24:00 +0000 @@ -6210,15 +6210,15 @@ doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: - t use the cursor specified for the frame - nil don't display a cursor - box display a filled box cursor - hollow display a hollow box cursor - bar display a vertical bar cursor with default width - (bar . WIDTH) display a vertical bar cursor with width WIDTH - hbar display a horizontal bar cursor with default height + t use the cursor specified for the frame + nil don't display a cursor + box display a filled box cursor + hollow display a hollow box cursor + bar display a vertical bar cursor with default width + (bar . WIDTH) display a vertical bar cursor with width WIDTH + hbar display a horizontal bar cursor with default height (hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT - ANYTHING ELSE display a hollow box cursor + ANYTHING ELSE display a hollow box cursor When the buffer is displayed in a non-selected window, the cursor's appearance is instead controlled by the variable ------------------------------------------------------------ revno: 110779 committer: Dmitry Antipov branch nick: trunk timestamp: Sat 2012-11-03 09:59:17 +0400 message: * frame.h (struct frame): Drop can_have_scroll_bars member which is meaningless for a long time. Adjust comments. (FRAME_CAN_HAVE_SCROLL_BARS): Remove. * frame.c, nsfns.m, term.c, w32fns.c, xfns.c: Adjust users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-03 05:11:34 +0000 +++ src/ChangeLog 2012-11-03 05:59:17 +0000 @@ -1,5 +1,12 @@ 2012-11-03 Dmitry Antipov + * frame.h (struct frame): Drop can_have_scroll_bars member + which is meaningless for a long time. Adjust comments. + (FRAME_CAN_HAVE_SCROLL_BARS): Remove. + * frame.c, nsfns.m, term.c, w32fns.c, xfns.c: Adjust users. + +2012-11-03 Dmitry Antipov + * window.c (decode_next_window_args): Update window arg after calling decode_live_window and so fix crash reported at http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html === modified file 'src/frame.c' --- src/frame.c 2012-10-30 18:28:48 +0000 +++ src/frame.c 2012-11-03 05:59:17 +0000 @@ -502,7 +502,6 @@ FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* The default value of menu-bar-mode is t. */ @@ -551,7 +550,6 @@ FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; #endif /* not MSDOS */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1; === modified file 'src/frame.h' --- src/frame.h 2012-10-20 21:30:51 +0000 +++ src/frame.h 2012-11-03 05:59:17 +0000 @@ -409,10 +409,6 @@ show no modeline for that window. */ unsigned wants_modeline : 1; - /* Non-zero if the hardware device this frame is displaying on can - support scroll bars. */ - char can_have_scroll_bars; - /* Non-0 means raise this frame to the top of the heap when selected. */ unsigned auto_raise : 1; @@ -438,8 +434,7 @@ /* Nonzero means that the pointer is invisible. */ unsigned pointer_invisible :1; - /* If can_have_scroll_bars is non-zero, this is non-zero if we should - actually display them on this frame. */ + /* Nonzero if we should actually display the scroll bars on this frame. */ enum vertical_scroll_bar_type vertical_scroll_bar_type; /* What kind of text cursor should we draw in the future? @@ -767,11 +762,6 @@ #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos #define FRAME_FOCUS_FRAME(f) f->focus_frame -/* Nonzero if frame F supports scroll bars. - If this is zero, then it is impossible to enable scroll bars - on frame F. */ -#define FRAME_CAN_HAVE_SCROLL_BARS(f) ((f)->can_have_scroll_bars) - /* This frame slot says whether scroll bars are currently enabled for frame F, and which side they are on. */ #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) === modified file 'src/nsfns.m' --- src/nsfns.m 2012-10-07 10:07:23 +0000 +++ src/nsfns.m 2012-11-03 05:59:17 +0000 @@ -1175,7 +1175,6 @@ f = make_frame (1); XSETFRAME (frame, f); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; f->terminal = dpyinfo->terminal; === modified file 'src/term.c' --- src/term.c 2012-10-25 04:35:39 +0000 +++ src/term.c 2012-11-03 05:59:17 +0000 @@ -3235,7 +3235,6 @@ FrameCols (tty) = FRAME_COLS (f); tty->specified_window = FRAME_LINES (f); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; terminal->char_ins_del_ok = 1; baud_rate = 19200; === modified file 'src/w32fns.c' --- src/w32fns.c 2012-11-02 14:00:45 +0000 +++ src/w32fns.c 2012-11-03 05:59:17 +0000 @@ -4284,9 +4284,6 @@ XSETFRAME (frame, f); - /* Note that Windows does support scroll bars. */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; - /* By default, make scrollbars the system standard width. */ FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); @@ -5387,7 +5384,6 @@ Finsert (1, &text); set_buffer_internal_1 (old_buffer); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); /* By setting the output method, we're essentially saying that === modified file 'src/xfns.c' --- src/xfns.c 2012-09-30 13:43:47 +0000 +++ src/xfns.c 2012-11-03 05:59:17 +0000 @@ -3111,9 +3111,6 @@ XSETFRAME (frame, f); - /* Note that X Windows does support scroll bars. */ - FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; - f->terminal = dpyinfo->terminal; f->output_method = output_x_window; @@ -4596,7 +4593,6 @@ Finsert (1, &text); set_buffer_internal_1 (old_buffer); - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); f->terminal = dpyinfo->terminal; ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.