------------------------------------------------------------ revno: 115148 committer: Leo Liu branch nick: trunk timestamp: Tue 2013-11-19 16:59:53 +0800 message: * obsolete/rcompile.el: Mark obsolete. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-19 02:34:04 +0000 +++ lisp/ChangeLog 2013-11-19 08:59:53 +0000 @@ -1,5 +1,7 @@ 2013-11-19 Leo Liu + * obsolete/rcompile.el: Mark obsolete. + * progmodes/compile.el (compilation-start) (compilation-goto-locus, compilation-find-file): Pass no-display-ok and handle nil value from display-buffer. === renamed file 'lisp/net/rcompile.el' => 'lisp/obsolete/rcompile.el' --- lisp/net/rcompile.el 2013-01-01 09:11:05 +0000 +++ lisp/obsolete/rcompile.el 2013-11-19 08:59:53 +0000 @@ -6,6 +6,7 @@ ;; Maintainer: FSF ;; Created: 1993 Oct 6 ;; Keywords: tools, processes +;; Obsolete-since: 24.4 ;; This file is part of GNU Emacs. ------------------------------------------------------------ revno: 115147 committer: Paul Eggert branch nick: trunk timestamp: Tue 2013-11-19 00:57:22 -0800 message: * charset.c (syms_of_charset): Don't read past end of string. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-19 02:32:26 +0000 +++ src/ChangeLog 2013-11-19 08:57:22 +0000 @@ -1,3 +1,7 @@ +2013-11-19 Paul Eggert + + * charset.c (syms_of_charset): Don't read past end of string. + 2013-11-19 Glenn Morris * frame.c (Fhandle_focus_in, Fhandle_focus_out): Doc fixes. === modified file 'src/charset.c' --- src/charset.c 2013-10-03 04:41:23 +0000 +++ src/charset.c 2013-11-19 08:57:22 +0000 @@ -2428,19 +2428,19 @@ Vcurrent_iso639_language = Qnil; charset_ascii - = define_charset_internal (Qascii, 1, "\x00\x7F\x00\x00\x00\x00", + = define_charset_internal (Qascii, 1, "\x00\x7F\0\0\0\0\0", 0, 127, 'B', -1, 0, 1, 0, 0); charset_iso_8859_1 - = define_charset_internal (Qiso_8859_1, 1, "\x00\xFF\x00\x00\x00\x00", + = define_charset_internal (Qiso_8859_1, 1, "\x00\xFF\0\0\0\0\0", 0, 255, -1, -1, -1, 1, 0, 0); charset_unicode - = define_charset_internal (Qunicode, 3, "\x00\xFF\x00\xFF\x00\x10", + = define_charset_internal (Qunicode, 3, "\x00\xFF\x00\xFF\x00\x10\0", 0, MAX_UNICODE_CHAR, -1, 0, -1, 1, 0, 0); charset_emacs - = define_charset_internal (Qemacs, 3, "\x00\xFF\x00\xFF\x00\x3F", + = define_charset_internal (Qemacs, 3, "\x00\xFF\x00\xFF\x00\x3F\0", 0, MAX_5_BYTE_CHAR, -1, 0, -1, 1, 1, 0); charset_eight_bit - = define_charset_internal (Qeight_bit, 1, "\x80\xFF\x00\x00\x00\x00", + = define_charset_internal (Qeight_bit, 1, "\x80\xFF\0\0\0\0\0", 128, 255, -1, 0, -1, 0, 1, MAX_5_BYTE_CHAR + 1); charset_unibyte = charset_iso_8859_1; ------------------------------------------------------------ revno: 115146 fixes bug: http://debbugs.gnu.org/13594 committer: Leo Liu branch nick: trunk timestamp: Tue 2013-11-19 10:34:04 +0800 message: * window.el (display-buffer-alist, display-buffer): Document the new parameter no-display-ok. * progmodes/compile.el (compilation-start) (compilation-goto-locus, compilation-find-file): Pass no-display-ok and handle nil value from display-buffer. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-18 02:01:34 +0000 +++ lisp/ChangeLog 2013-11-19 02:34:04 +0000 @@ -1,3 +1,13 @@ +2013-11-19 Leo Liu + + * progmodes/compile.el (compilation-start) + (compilation-goto-locus, compilation-find-file): Pass + no-display-ok and handle nil value from display-buffer. + (Bug#13594) + + * window.el (display-buffer-alist, display-buffer): Document the + new parameter no-display-ok. + 2013-11-18 Stefan Monnier * electric.el (electric-indent-mode-map): Remove. === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2013-10-23 16:25:56 +0000 +++ lisp/progmodes/compile.el 2013-11-19 02:34:04 +0000 @@ -1632,7 +1632,7 @@ (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html - (setq outwin (display-buffer outbuf)) + (setq outwin (display-buffer outbuf '(nil (no-display-ok . t)))) (with-current-buffer outbuf (let ((process-environment (append @@ -1654,7 +1654,7 @@ (list command mode name-function highlight-regexp)) (set (make-local-variable 'revert-buffer-function) 'compilation-revert-buffer) - (set-window-start outwin (point-min)) + (and outwin (set-window-start outwin (point-min))) ;; Position point as the user will see it. (let ((desired-visible-point @@ -1663,15 +1663,15 @@ (point-max) ;; Normally put it at the top. (point-min)))) - (if (eq outwin (selected-window)) - (goto-char desired-visible-point) + (goto-char desired-visible-point) + (when (and outwin (not (eq outwin (selected-window)))) (set-window-point outwin desired-visible-point))) ;; The setup function is called before compilation-set-window-height ;; so it can set the compilation-window-height buffer locally. (if compilation-process-setup-function (funcall compilation-process-setup-function)) - (compilation-set-window-height outwin) + (and outwin (compilation-set-window-height outwin)) ;; Start the compilation. (if (fboundp 'start-process) (let ((proc @@ -2513,14 +2513,16 @@ ;; the error location if the two buffers are in two ;; different frames. So don't do it if it's not necessary. pre-existing - (display-buffer (marker-buffer msg)))) + (display-buffer (marker-buffer msg) '(nil (no-display-ok . t))))) (highlight-regexp (with-current-buffer (marker-buffer msg) ;; also do this while we change buffer - (compilation-set-window w msg) + (goto-char (marker-position msg)) + (and w (compilation-set-window w msg)) compilation-highlight-regexp))) ;; Ideally, the window-size should be passed to `display-buffer' ;; so it's only used when creating a new window. - (unless pre-existing (compilation-set-window-height w)) + (when (and (not pre-existing) w) + (compilation-set-window-height w)) (if from-compilation-buffer ;; If the compilation buffer window was selected, @@ -2631,9 +2633,12 @@ (while (null buffer) ;Repeat until the user selects an existing file. ;; The file doesn't exist. Ask the user where to find it. (save-excursion ;This save-excursion is probably not right. - (let ((pop-up-windows t)) - (compilation-set-window (display-buffer (marker-buffer marker)) - marker) + (let ((w (let ((pop-up-windows t)) + (display-buffer (marker-buffer marker) + '(nil (no-display-ok . t)))))) + (with-current-buffer (marker-buffer marker) + (goto-char marker) + (and w (compilation-set-window w marker))) (let* ((name (read-file-name (format "Find this %s in (default %s): " compilation-error filename) === modified file 'lisp/window.el' --- lisp/window.el 2013-11-12 07:25:14 +0000 +++ lisp/window.el 2013-11-19 02:34:04 +0000 @@ -5355,7 +5355,10 @@ ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a function or a list of functions. Each such function should accept two arguments: a buffer to display and an alist of the - same form as ALIST. See `display-buffer' for details. + same form as ALIST. If (no-display-ok . t) is in ALIST, the + caller is prepared for the case of not displaying the buffer + and FUNCTION can safely return a non-window value to suppress + displaying. See `display-buffer' for details. `display-buffer' scans this alist until it either finds a matching regular expression or the function specified by a @@ -5439,9 +5442,10 @@ ALIST is an arbitrary association list (alist). Each such FUNCTION should accept two arguments: the buffer to -display and an alist. Based on those arguments, it should either -display the buffer and return the window, or return nil if unable -to display the buffer. +display and an alist. Based on those arguments, it should +display the buffer and return the window. If the caller is +prepared to handle the case of not displaying the buffer it +should pass (no-display-ok . t) as an element of the ALIST. The `display-buffer' function builds a function list and an alist by combining the functions and alists specified in @@ -5542,7 +5546,7 @@ (while (and functions (not window)) (setq window (funcall (car functions) buffer alist) functions (cdr functions))) - window)))) + (and (windowp window) window))))) (defun display-buffer-other-frame (buffer) "Display buffer BUFFER preferably in another frame. ------------------------------------------------------------ revno: 115145 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-11-18 21:32:26 -0500 message: * src/frame.c (Fhandle_focus_in, Fhandle_focus_out): Doc fixes. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-19 02:23:50 +0000 +++ src/ChangeLog 2013-11-19 02:32:26 +0000 @@ -1,3 +1,7 @@ +2013-11-19 Glenn Morris + + * frame.c (Fhandle_focus_in, Fhandle_focus_out): Doc fixes. + 2013-11-19 Brian Jenkins (tiny change) Add hooks to run on gaining/losing focus. (Bug#15029) === modified file 'src/frame.c' --- src/frame.c 2013-11-19 02:23:50 +0000 +++ src/frame.c 2013-11-19 02:32:26 +0000 @@ -892,7 +892,8 @@ Focus in events are usually bound to this function. Focus in events occur when a frame has focus, but a switch-frame event is not generated. -This function checks if blink-cursor timers should be turned on again. */) +This function runs the hook `focus-in-hook'. +It also checks if blink-cursor timers should be turned on again. */) (Lisp_Object event) { Frun_hooks (1, &Qfocus_in_hook); @@ -903,7 +904,8 @@ doc: /* Handle a focus-out event. Focus out events are usually bound to this function. Focus out events occur when no frame has focus. -This function checks if blink-cursor timers should be turned off. */) +This function runs the hook `focus-out-hook'. +It also checks if blink-cursor timers should be turned off. */) (Lisp_Object event) { Frun_hooks (1, &Qfocus_out_hook); ------------------------------------------------------------ revno: 115144 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-11-18 21:26:34 -0500 message: * etc/NEWS: Placeholder. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-11-18 18:56:42 +0000 +++ etc/NEWS 2013-11-19 02:26:34 +0000 @@ -164,6 +164,8 @@ Generic commands are interactive functions whose implementation can be selected among several alternatives, as a matter of user preference. +** New hooks `focus-in-hook', `focus-out-hook'. + ** The blink cursor stops blinking after 10 blinks (default) on X and NS. You can change the default by customizing the variable blink-cursor-blinks. Also timers for blinking are stopped when no blinking is done, so Emacs does ------------------------------------------------------------ revno: 115143 fixes bug: http://debbugs.gnu.org/15029 author: Brian Jenkins committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-11-18 21:23:50 -0500 message: Add hooks to run on gaining/losing focus (tiny change) * src/frame.c (Qfocus_in_hook, Qfocus_out_hook): New static lisp objects. (Fhandle_focus_in, Fhandle_focus_out): Run focus hooks. (syms_of_frame): Add focus-in-hook, focus-out-hook. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-18 19:31:05 +0000 +++ src/ChangeLog 2013-11-19 02:23:50 +0000 @@ -1,3 +1,10 @@ +2013-11-19 Brian Jenkins (tiny change) + + Add hooks to run on gaining/losing focus. (Bug#15029) + * frame.c (Qfocus_in_hook, Qfocus_out_hook): New static lisp objects. + (Fhandle_focus_in, Fhandle_focus_out): Run focus hooks. + (syms_of_frame): Add focus-in-hook, focus-out-hook. + 2013-11-18 Paul Eggert * data.c (bool_vector_binop_driver): Rename locals for sanity's sake. === modified file 'src/frame.c' --- src/frame.c 2013-11-06 18:41:31 +0000 +++ src/frame.c 2013-11-19 02:23:50 +0000 @@ -109,6 +109,8 @@ Lisp_Object Qface_set_after_frame_default; +static Lisp_Object Qfocus_in_hook; +static Lisp_Object Qfocus_out_hook; static Lisp_Object Qdelete_frame_functions; static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; @@ -893,6 +895,7 @@ This function checks if blink-cursor timers should be turned on again. */) (Lisp_Object event) { + Frun_hooks (1, &Qfocus_in_hook); return call0 (intern ("blink-cursor-check")); } @@ -903,6 +906,7 @@ This function checks if blink-cursor timers should be turned off. */) (Lisp_Object event) { + Frun_hooks (1, &Qfocus_out_hook); return call0 (intern ("blink-cursor-suspend")); } @@ -4465,6 +4469,16 @@ The pointer becomes visible again when the mouse is moved. */); Vmake_pointer_invisible = Qt; + DEFVAR_LISP ("focus-in-hook", Vfocus_in_hook, + doc: /* Normal hook run when a frame gains input focus. */); + Vfocus_in_hook = Qnil; + DEFSYM (Qfocus_in_hook, "focus-in-hook"); + + DEFVAR_LISP ("focus-out-hook", Vfocus_out_hook, + doc: /* Normal hook run when a frame loses input focus. */); + Vfocus_out_hook = Qnil; + DEFSYM (Qfocus_out_hook, "focus-out-hook"); + DEFVAR_LISP ("delete-frame-functions", Vdelete_frame_functions, doc: /* Functions run before deleting a frame. The functions are run with one arg, the frame to be deleted. ------------------------------------------------------------ revno: 115142 committer: Xue Fuqiao branch nick: trunk timestamp: Tue 2013-11-19 06:53:47 +0800 message: Add some indexes and a cross-reference. * doc/lispref/os.texi (Session Management, Desktop Notifications): Add some indexes and a cross-reference. diff: === modified file 'doc/emacs/cmdargs.texi' --- doc/emacs/cmdargs.texi 2013-11-04 01:36:14 +0000 +++ doc/emacs/cmdargs.texi 2013-11-18 22:53:47 +0000 @@ -10,6 +10,7 @@ @cindex switches (command line) @cindex startup (command line arguments) @cindex invocation (command line arguments) +@c FIXME: Document `--smid'? --xfq Emacs supports command line arguments to request various actions when invoking Emacs. These are for compatibility with other editors === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-11-17 22:30:44 +0000 +++ doc/lispref/ChangeLog 2013-11-18 22:53:47 +0000 @@ -1,3 +1,8 @@ +2013-11-18 Xue Fuqiao + + * os.texi (Session Management, Desktop Notifications): Add some + indexes and a cross-reference. + 2013-11-17 Xue Fuqiao * os.texi (Time Parsing): === modified file 'doc/lispref/os.texi' --- doc/lispref/os.texi 2013-11-17 22:30:44 +0000 +++ doc/lispref/os.texi 2013-11-18 22:53:47 +0000 @@ -2244,6 +2244,7 @@ @var{session}}. @defvar emacs-save-session-functions +@cindex session file Emacs supports saving state via a hook called @code{emacs-save-session-functions}. Emacs runs this hook when the session manager tells it that the window system is shutting down. The @@ -2283,11 +2284,13 @@ @node Desktop Notifications @section Desktop Notifications @cindex desktop notifications +@cindex notifications, on desktop Emacs is able to send @dfn{notifications} on systems that support the freedesktop.org Desktop Notifications Specification. In order to use this functionality, Emacs must have been compiled with D-Bus support, -and the @code{notifications} library must be loaded. +and the @code{notifications} library must be loaded. @xref{Top, , +D-Bus,dbus,D-Bus integration in Emacs}. @defun notifications-notify &rest params This function sends a notification to the desktop via D-Bus, ------------------------------------------------------------ revno: 115141 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-11-18 11:31:05 -0800 message: * data.c (bool_vector_binop_driver): Rename locals for sanity's sake. The old names predated the API change that put destination at end. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-18 18:56:42 +0000 +++ src/ChangeLog 2013-11-18 19:31:05 +0000 @@ -1,5 +1,8 @@ 2013-11-18 Paul Eggert + * data.c (bool_vector_binop_driver): Rename locals for sanity's sake. + The old names predated the API change that put destination at end. + Improve API of recently-added bool vector functions (Bug#15912). The old API had (bool-vector-count-matches A B) and (bool-vector-count-matches-at A B I), which gave the === modified file 'src/data.c' --- src/data.c 2013-11-18 18:56:42 +0000 +++ src/data.c 2013-11-18 19:31:05 +0000 @@ -3018,62 +3018,62 @@ bool_vector_subsetp }; static Lisp_Object -bool_vector_binop_driver (Lisp_Object op1, - Lisp_Object op2, +bool_vector_binop_driver (Lisp_Object a, + Lisp_Object b, Lisp_Object dest, enum bool_vector_op op) { EMACS_INT nr_bits; - bits_word *adata, *bdata, *cdata; + bits_word *adata, *bdata, *destdata; ptrdiff_t i = 0; ptrdiff_t nr_words; - CHECK_BOOL_VECTOR (op1); - CHECK_BOOL_VECTOR (op2); + CHECK_BOOL_VECTOR (a); + CHECK_BOOL_VECTOR (b); - nr_bits = bool_vector_size (op1); - if (bool_vector_size (op2) != nr_bits) - wrong_length_argument (op1, op2, dest); + nr_bits = bool_vector_size (a); + if (bool_vector_size (b) != nr_bits) + wrong_length_argument (a, b, dest); nr_words = bool_vector_words (nr_bits); - bdata = bool_vector_data (op1); - cdata = bool_vector_data (op2); + adata = bool_vector_data (a); + bdata = bool_vector_data (b); if (NILP (dest)) { dest = make_uninit_bool_vector (nr_bits); - adata = bool_vector_data (dest); + destdata = bool_vector_data (dest); } else { CHECK_BOOL_VECTOR (dest); - adata = bool_vector_data (dest); + destdata = bool_vector_data (dest); if (bool_vector_size (dest) != nr_bits) - wrong_length_argument (op1, op2, dest); + wrong_length_argument (a, b, dest); switch (op) { case bool_vector_exclusive_or: - while (adata[i] == (bdata[i] ^ cdata[i])) + while (destdata[i] == (adata[i] ^ bdata[i])) if (! (++i < nr_words)) return Qnil; break; case bool_vector_subsetp: case bool_vector_union: - while (adata[i] == (bdata[i] | cdata[i])) + while (destdata[i] == (adata[i] | bdata[i])) if (! (++i < nr_words)) return Qnil; break; case bool_vector_intersection: - while (adata[i] == (bdata[i] & cdata[i])) + while (destdata[i] == (adata[i] & bdata[i])) if (! (++i < nr_words)) return Qnil; break; case bool_vector_set_difference: - while (adata[i] == (bdata[i] &~ cdata[i])) + while (destdata[i] == (adata[i] &~ bdata[i])) if (! (++i < nr_words)) return Qnil; break; @@ -3084,7 +3084,7 @@ { case bool_vector_exclusive_or: do - adata[i] = bdata[i] ^ cdata[i]; + destdata[i] = adata[i] ^ bdata[i]; while (++i < nr_words); break; @@ -3093,19 +3093,19 @@ case bool_vector_union: do - adata[i] = bdata[i] | cdata[i]; + destdata[i] = adata[i] | bdata[i]; while (++i < nr_words); break; case bool_vector_intersection: do - adata[i] = bdata[i] & cdata[i]; + destdata[i] = adata[i] & bdata[i]; while (++i < nr_words); break; case bool_vector_set_difference: do - adata[i] = bdata[i] &~ cdata[i]; + destdata[i] = adata[i] &~ bdata[i]; while (++i < nr_words); break; } ------------------------------------------------------------ revno: 115140 fixes bug: http://debbugs.gnu.org/15912 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-11-18 10:56:42 -0800 message: Improve API of recently-added bool vector functions. The old API had (bool-vector-count-matches A B) and (bool-vector-count-matches-at A B I), which gave the misleading impression that the two functions were variants, one with a location I. The new API has (bool-vector-count-population A) and (bool-vector-count-consecutive A B I) to make the distinction clearer. The first function no longer has a B argument, since the caller can easily determine the number of nils if the length and number of ts is known. * src/data.c (Fbool_vector_count_population): Rename from bool_vector_count_matches, and accept just 1 argument. (Fbool_vector_count_consecutive): Rename from Fbool_vector_count_matches_at. * test/automated/data-tests.el: Adjust to API changes. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-11-18 02:27:12 +0000 +++ etc/NEWS 2013-11-18 18:56:42 +0000 @@ -736,8 +736,8 @@ *** `bool-vector-set-difference' *** `bool-vector-not' *** `bool-vector-subsetp' -*** `bool-vector-count-matches' -*** `bool-vector-count-matches-at' +*** `bool-vector-count-consecutive' +*** `bool-vector-count-population' ** Comparison functions =, <, >, <=, >= now take many arguments. === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-18 18:37:25 +0000 +++ src/ChangeLog 2013-11-18 18:56:42 +0000 @@ -1,5 +1,19 @@ 2013-11-18 Paul Eggert + Improve API of recently-added bool vector functions (Bug#15912). + The old API had (bool-vector-count-matches A B) + and (bool-vector-count-matches-at A B I), which gave the + misleading impression that the two functions were variants, one + with a location I. The new API has (bool-vector-count-population A) + and (bool-vector-count-consecutive A B I) to make the distinction + clearer. The first function no longer has a B argument, since the + caller can easily determine the number of nils if the length and + number of ts is known. + * data.c (Fbool_vector_count_population): Rename from + bool_vector_count_matches, and accept just 1 argument. + (Fbool_vector_count_consecutive): Rename from + Fbool_vector_count_matches_at. + Always allocate at least one bits_word per bool vector. See Daniel Colascione in: http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00518.html === modified file 'src/data.c' --- src/data.c 2013-11-18 18:37:25 +0000 +++ src/data.c 2013-11-18 18:56:42 +0000 @@ -3282,11 +3282,12 @@ return b; } -DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches, - Sbool_vector_count_matches, 2, 2, 0, - doc: /* Count how many elements in A equal B. -A must be a bool vector. B is a generalized bool. */) - (Lisp_Object a, Lisp_Object b) +DEFUN ("bool-vector-count-population", Fbool_vector_count_population, + Sbool_vector_count_population, 1, 1, 0, + doc: /* Count how many elements in A are t. +A is a bool vector. To count A's nil elements, subtract the return +value from A's length. */) + (Lisp_Object a) { EMACS_INT count; EMACS_INT nr_bits; @@ -3303,17 +3304,13 @@ for (i = 0; i < nwords; i++) count += count_one_bits_word (adata[i]); - if (NILP (b)) - count = nr_bits - count; return make_number (count); } -DEFUN ("bool-vector-count-matches-at", - Fbool_vector_count_matches_at, - Sbool_vector_count_matches_at, 3, 3, 0, - doc: /* Count how many consecutive elements in A equal B at i. -A must be a bool vector. B is a generalized boolean. i is an -index into the vector. */) +DEFUN ("bool-vector-count-consecutive", Fbool_vector_count_consecutive, + Sbool_vector_count_consecutive, 3, 3, 0, + doc: /* Count how many consecutive elements in A equal B starting at I. +A is a bool vector, B is t or nil, and I is an index into A. */) (Lisp_Object a, Lisp_Object b, Lisp_Object i) { EMACS_INT count; @@ -3660,8 +3657,8 @@ defsubr (&Sbool_vector_set_difference); defsubr (&Sbool_vector_not); defsubr (&Sbool_vector_subsetp); - defsubr (&Sbool_vector_count_matches); - defsubr (&Sbool_vector_count_matches_at); + defsubr (&Sbool_vector_count_consecutive); + defsubr (&Sbool_vector_count_population); set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function); === modified file 'test/ChangeLog' --- test/ChangeLog 2013-11-16 11:46:37 +0000 +++ test/ChangeLog 2013-11-18 18:56:42 +0000 @@ -1,3 +1,8 @@ +2013-11-18 Paul Eggert + + Improve API of recently-added bool vector functions (Bug#15912). + * automated/data-tests.el: Adjust to API changes. + 2013-11-16 Michael Albinus * automated/tramp-tests.el (tramp-test07-file-exists-p) === modified file 'test/automated/data-tests.el' --- test/automated/data-tests.el 2013-09-22 09:31:55 +0000 +++ test/automated/data-tests.el 2013-11-18 18:56:42 +0000 @@ -77,42 +77,40 @@ ;; Bool vector tests. Compactly represent bool vectors as hex ;; strings. -(ert-deftest bool-vector-count-matches-all-0-nil () +(ert-deftest bool-vector-count-population-all-0-nil () (cl-loop for sz in '(0 45 1 64 9 344) do (let* ((bv (make-bool-vector sz nil))) (should + (zerop + (bool-vector-count-population bv)))))) + +(ert-deftest bool-vector-count-population-all-1-t () + (cl-loop for sz in '(0 45 1 64 9 344) + do (let* ((bv (make-bool-vector sz t))) + (should (eql - (bool-vector-count-matches bv nil) + (bool-vector-count-population bv) sz))))) -(ert-deftest bool-vector-count-matches-all-0-t () - (cl-loop for sz in '(0 45 1 64 9 344) - do (let* ((bv (make-bool-vector sz nil))) - (should - (eql - (bool-vector-count-matches bv t) - 0))))) - -(ert-deftest bool-vector-count-matches-1-nil () - (let* ((bv (make-bool-vector 45 nil))) - (aset bv 40 t) - (aset bv 0 t) - (should - (eql - (bool-vector-count-matches bv t) - 2))) - ) - -(ert-deftest bool-vector-count-matches-1-t () - (let* ((bv (make-bool-vector 45 nil))) - (aset bv 40 t) - (aset bv 0 t) - (should - (eql - (bool-vector-count-matches bv nil) +(ert-deftest bool-vector-count-population-1-nil () + (let* ((bv (make-bool-vector 45 nil))) + (aset bv 40 t) + (aset bv 0 t) + (should + (eql + (bool-vector-count-population bv) + 2)))) + +(ert-deftest bool-vector-count-population-1-t () + (let* ((bv (make-bool-vector 45 t))) + (aset bv 40 nil) + (aset bv 0 nil) + (should + (eql + (bool-vector-count-population bv) 43)))) -(defun mock-bool-vector-count-matches-at (a b i) +(defun mock-bool-vector-count-consecutive (a b i) (loop for i from i below (length a) while (eq (aref a i) b) sum 1)) @@ -147,8 +145,8 @@ (nreverse nibbles) ""))) -(defun test-bool-vector-count-matches-at-tc (desc) - "Run a test case for bool-vector-count-matches-at. +(defun test-bool-vector-count-consecutive-tc (desc) + "Run a test case for bool-vector-count-consecutive. DESC is a string describing the test. It is a sequence of hexadecimal digits describing the bool vector. We exhaustively test all counts at all possible positions in the vector by @@ -158,8 +156,8 @@ for lf in '(nil t) do (loop for pos from 0 upto (length bv) - for cnt = (mock-bool-vector-count-matches-at bv lf pos) - for rcnt = (bool-vector-count-matches-at bv lf pos) + for cnt = (mock-bool-vector-count-consecutive bv lf pos) + for rcnt = (bool-vector-count-consecutive bv lf pos) unless (eql cnt rcnt) do (error "FAILED testcase %S %3S %3S %3S" pos lf cnt rcnt))))) @@ -182,8 +180,8 @@ "0000000000000000000000000" "FFFFFFFFFFFFFFFF1")) -(ert-deftest bool-vector-count-matches-at () - (mapc #'test-bool-vector-count-matches-at-tc +(ert-deftest bool-vector-count-consecutive () + (mapc #'test-bool-vector-count-consecutive-tc bool-vector-test-vectors)) (defun test-bool-vector-apply-mock-op (mock a b c) ------------------------------------------------------------ revno: 115139 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-11-18 10:37:25 -0800 message: Always allocate at least one bits_word per bool vector. See Daniel Colascione in: http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00518.html * alloc.c (make_uninit_bool_vector): Always allocate at least one word. * data.c (bool_vector_binop_driver): Rely on this. Tune. * lisp.h (struct Lisp_Bool_vector): Document this. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-18 16:29:49 +0000 +++ src/ChangeLog 2013-11-18 18:37:25 +0000 @@ -1,3 +1,12 @@ +2013-11-18 Paul Eggert + + Always allocate at least one bits_word per bool vector. + See Daniel Colascione in: + http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00518.html + * alloc.c (make_uninit_bool_vector): Always allocate at least one word. + * data.c (bool_vector_binop_driver): Rely on this. Tune. + * lisp.h (struct Lisp_Bool_vector): Document this. + 2013-11-18 Eli Zaretskii * insdel.c (invalidate_buffer_caches): New function, consolidated === modified file 'src/alloc.c' --- src/alloc.c 2013-11-14 02:39:28 +0000 +++ src/alloc.c 2013-11-18 18:37:25 +0000 @@ -2066,20 +2066,21 @@ make_uninit_bool_vector (EMACS_INT nbits) { Lisp_Object val; - struct Lisp_Bool_Vector *p; - EMACS_INT word_bytes, needed_elements; - word_bytes = bool_vector_words (nbits) * sizeof (bits_word); - needed_elements = ((bool_header_size - header_size + word_bytes - + word_size - 1) - / word_size); - p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements); + EMACS_INT words0 = bool_vector_words (nbits); + EMACS_INT words = words0 + !words0; /* Allocate at least one word. */ + EMACS_INT word_bytes = words * sizeof (bits_word); + EMACS_INT needed_elements = ((bool_header_size - header_size + word_bytes + + word_size - 1) + / word_size); + struct Lisp_Bool_Vector *p + = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements); XSETVECTOR (val, p); XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0); p->size = nbits; - /* Clear padding at the end. */ - if (nbits) - p->data[bool_vector_words (nbits) - 1] = 0; + /* Clear padding at the end. If NBITS != 0 this initializes more + than it needs to, but that's OK. */ + p->data[words - 1] = 0; return val; } === modified file 'src/data.c' --- src/data.c 2013-11-15 18:01:04 +0000 +++ src/data.c 2013-11-18 18:37:25 +0000 @@ -3025,9 +3025,7 @@ { EMACS_INT nr_bits; bits_word *adata, *bdata, *cdata; - ptrdiff_t i; - bool changed = 0; - bits_word mword; + ptrdiff_t i = 0; ptrdiff_t nr_words; CHECK_BOOL_VECTOR (op1); @@ -3037,45 +3035,82 @@ if (bool_vector_size (op2) != nr_bits) wrong_length_argument (op1, op2, dest); + nr_words = bool_vector_words (nr_bits); + bdata = bool_vector_data (op1); + cdata = bool_vector_data (op2); + if (NILP (dest)) { dest = make_uninit_bool_vector (nr_bits); - changed = 1; + adata = bool_vector_data (dest); } else { CHECK_BOOL_VECTOR (dest); + adata = bool_vector_data (dest); if (bool_vector_size (dest) != nr_bits) wrong_length_argument (op1, op2, dest); + + switch (op) + { + case bool_vector_exclusive_or: + while (adata[i] == (bdata[i] ^ cdata[i])) + if (! (++i < nr_words)) + return Qnil; + break; + + case bool_vector_subsetp: + case bool_vector_union: + while (adata[i] == (bdata[i] | cdata[i])) + if (! (++i < nr_words)) + return Qnil; + break; + + case bool_vector_intersection: + while (adata[i] == (bdata[i] & cdata[i])) + if (! (++i < nr_words)) + return Qnil; + break; + + case bool_vector_set_difference: + while (adata[i] == (bdata[i] &~ cdata[i])) + if (! (++i < nr_words)) + return Qnil; + break; + } } - nr_words = bool_vector_words (nr_bits); - - adata = bool_vector_data (dest); - bdata = bool_vector_data (op1); - cdata = bool_vector_data (op2); - - for (i = 0; i < nr_words; i++) + switch (op) { - if (op == bool_vector_exclusive_or) - mword = bdata[i] ^ cdata[i]; - else if (op == bool_vector_union || op == bool_vector_subsetp) - mword = bdata[i] | cdata[i]; - else if (op == bool_vector_intersection) - mword = bdata[i] & cdata[i]; - else if (op == bool_vector_set_difference) - mword = bdata[i] &~ cdata[i]; - else - abort (); - - if (! changed) - changed = adata[i] != mword; - - if (op != bool_vector_subsetp) - adata[i] = mword; + case bool_vector_exclusive_or: + do + adata[i] = bdata[i] ^ cdata[i]; + while (++i < nr_words); + break; + + case bool_vector_subsetp: + break; + + case bool_vector_union: + do + adata[i] = bdata[i] | cdata[i]; + while (++i < nr_words); + break; + + case bool_vector_intersection: + do + adata[i] = bdata[i] & cdata[i]; + while (++i < nr_words); + break; + + case bool_vector_set_difference: + do + adata[i] = bdata[i] &~ cdata[i]; + while (++i < nr_words); + break; } - return changed ? dest : Qnil; + return dest; } /* PRECONDITION must be true. Return VALUE. This odd construction @@ -3314,7 +3349,10 @@ mword = bits_word_to_host_endian (adata[pos]); mword ^= twiddle; mword >>= offset; + + /* Do not count the pad bits. */ mword |= (bits_word) 1 << (BITS_PER_BITS_WORD - offset); + count = count_trailing_zero_bits (mword); pos++; if (count + offset < BITS_PER_BITS_WORD) === modified file 'src/lisp.h' --- src/lisp.h 2013-11-18 16:29:49 +0000 +++ src/lisp.h 2013-11-18 18:37:25 +0000 @@ -1213,6 +1213,7 @@ /* This is the size in bits. */ EMACS_INT size; /* The actual bits, packed into bytes. + Zeros fill out the last word as needed; there's always at least one word. The bits are in little-endian order in the bytes, and the bytes are in little-endian order in the words. */ bits_word data[FLEXIBLE_ARRAY_MEMBER]; ------------------------------------------------------------ revno: 115138 fixes bug: http://debbugs.gnu.org/15841 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2013-11-18 18:29:49 +0200 message: Fix bug #15841 with assertion violations due to newline cache. src/insdel.c (invalidate_buffer_caches): New function, consolidated from part of prepare_to_modify_buffer. (insert_from_gap, prepare_to_modify_buffer): src/coding.c (code_convert_region, code_convert_string): Call invalidate_buffer_caches. src/lisp.h (invalidate_buffer_caches): Add prototype. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-17 21:02:09 +0000 +++ src/ChangeLog 2013-11-18 16:29:49 +0000 @@ -1,3 +1,13 @@ +2013-11-18 Eli Zaretskii + + * insdel.c (invalidate_buffer_caches): New function, consolidated + from part of prepare_to_modify_buffer. + (insert_from_gap, prepare_to_modify_buffer): + * coding.c (code_convert_region, code_convert_string): Call + invalidate_buffer_caches. (Bug#15841) + + * lisp.h (invalidate_buffer_caches): Add prototype. + 2013-11-17 Eli Zaretskii * w32term.c (x_update_window_end): Don't invalidate the entire === modified file 'src/coding.c' --- src/coding.c 2013-10-08 06:40:09 +0000 +++ src/coding.c 2013-11-18 16:29:49 +0000 @@ -9358,6 +9358,14 @@ setup_coding_system (coding_system, &coding); coding.mode |= CODING_MODE_LAST_BLOCK; + if (BUFFERP (dst_object) && !EQ (dst_object, src_object)) + { + struct buffer *buf = XBUFFER (dst_object); + ptrdiff_t buf_pt = BUF_PT (buf); + + invalidate_buffer_caches (buf, buf_pt, buf_pt); + } + if (encodep) encode_coding_object (&coding, src_object, from, from_byte, to, to_byte, dst_object); @@ -9447,6 +9455,15 @@ coding.mode |= CODING_MODE_LAST_BLOCK; chars = SCHARS (string); bytes = SBYTES (string); + + if (BUFFERP (dst_object)) + { + struct buffer *buf = XBUFFER (dst_object); + ptrdiff_t buf_pt = BUF_PT (buf); + + invalidate_buffer_caches (buf, buf_pt, buf_pt); + } + if (encodep) encode_coding_object (&coding, string, 0, 0, chars, bytes, dst_object); else === modified file 'src/insdel.c' --- src/insdel.c 2013-11-11 05:18:53 +0000 +++ src/insdel.c 2013-11-18 16:29:49 +0000 @@ -993,6 +993,11 @@ if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nchars = nbytes; + /* No need to call prepare_to_modify_buffer, since this is called + from places that replace some region with a different text, so + prepare_to_modify_buffer was already called by the deletion part + of this dance. */ + invalidate_buffer_caches (current_buffer, GPT, GPT); record_insert (GPT, nchars); MODIFF++; @@ -1869,19 +1874,26 @@ ptrdiff_t *preserve_ptr) { prepare_to_modify_buffer_1 (start, end, preserve_ptr); + invalidate_buffer_caches (current_buffer, start, end); +} - if (current_buffer->newline_cache) - invalidate_region_cache (current_buffer, - current_buffer->newline_cache, - start - BEG, Z - end); - if (current_buffer->width_run_cache) - invalidate_region_cache (current_buffer, - current_buffer->width_run_cache, - start - BEG, Z - end); - if (current_buffer->bidi_paragraph_cache) - invalidate_region_cache (current_buffer, - current_buffer->bidi_paragraph_cache, - start - BEG, Z - end); +/* Invalidate the caches maintained by the buffer BUF, if any, for the + region between buffer positions START and END. */ +void +invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) +{ + if (buf->newline_cache) + invalidate_region_cache (buf, + buf->newline_cache, + start - BUF_BEG (buf), BUF_Z (buf) - end); + if (buf->width_run_cache) + invalidate_region_cache (buf, + buf->width_run_cache, + start - BUF_BEG (buf), BUF_Z (buf) - end); + if (buf->bidi_paragraph_cache) + invalidate_region_cache (buf, + buf->bidi_paragraph_cache, + start - BUF_BEG (buf), BUF_Z (buf) - end); } /* These macros work with an argument named `preserve_ptr' === modified file 'src/lisp.h' --- src/lisp.h 2013-11-17 03:58:30 +0000 +++ src/lisp.h 2013-11-18 16:29:49 +0000 @@ -3479,6 +3479,7 @@ extern void modify_text (ptrdiff_t, ptrdiff_t); extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void prepare_to_modify_buffer_1 (ptrdiff_t, ptrdiff_t, ptrdiff_t *); +extern void invalidate_buffer_caches (struct buffer *, ptrdiff_t, ptrdiff_t); extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); ------------------------------------------------------------ revno: 115137 committer: Leo Liu branch nick: trunk timestamp: Mon 2013-11-18 10:27:12 +0800 message: * NEWS: Mention new features for Octave mode. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2013-11-01 15:47:10 +0000 +++ etc/ChangeLog 2013-11-18 02:27:12 +0000 @@ -1,3 +1,7 @@ +2013-11-18 Leo Liu + + * NEWS: Mention new features for Octave mode. + 2013-11-01 Jan Djärv * NEWS: Mention :distant-foreground. === modified file 'etc/NEWS' --- etc/NEWS 2013-11-11 05:18:53 +0000 +++ etc/NEWS 2013-11-18 02:27:12 +0000 @@ -408,6 +408,14 @@ will revert to the old behavior. +** New features for Octave mode: +*** Font locking for texinfo comments and new keywords +*** Completion in Octave file buffers +*** Eldoc support +*** Jump to definition +*** Documentation lookup/search +*** Code cleanup and various bug fixes + ** Ido *** Ido has a manual now. *** `ido-use-virtual-buffers' takes a new value 'auto.