Now on revision 109835. ------------------------------------------------------------ revno: 109835 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12254 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2012-09-01 00:28:24 -0400 message: * lisp/minibuffer.el (completion-at-point-functions): Complete docstring. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-01 01:04:26 +0000 +++ lisp/ChangeLog 2012-09-01 04:28:24 +0000 @@ -1,3 +1,8 @@ +2012-09-01 Stefan Monnier + + * minibuffer.el (completion-at-point-functions): Complete docstring + (bug#12254). + 2012-09-01 Paul Eggert Better seed support for (random). === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2012-08-14 17:10:38 +0000 +++ lisp/minibuffer.el 2012-09-01 04:28:24 +0000 @@ -1821,7 +1821,9 @@ `:predicate' a predicate that completion candidates need to satisfy. `:exclusive' If `no', means that if the completion table fails to match the text at point, then instead of reporting a completion - failure, the completion should try the next completion function.") + failure, the completion should try the next completion function. +As is the case with most hooks, the functions are responsible to preserve +things like point and current buffer.") (defvar completion--capf-misbehave-funs nil "List of functions found on `completion-at-point-functions' that misbehave. ------------------------------------------------------------ revno: 109834 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-31 18:13:50 -0700 message: * sysdep.c (seed_random): Fix typo: HAV_LRAND48 -> HAVE_LRAND48. This fixes a bug on old systems that do not have the 'random' function. diff: === modified file 'src/sysdep.c' --- src/sysdep.c 2012-09-01 01:04:26 +0000 +++ src/sysdep.c 2012-09-01 01:13:50 +0000 @@ -1767,7 +1767,7 @@ void seed_random (void *seed, ptrdiff_t seed_size) { -#if defined HAVE_RANDOM || ! defined HAV_LRAND48 +#if defined HAVE_RANDOM || ! defined HAVE_LRAND48 unsigned int arg = 0; #else long int arg = 0; ------------------------------------------------------------ revno: 109833 committer: Paul Eggert branch nick: trunk timestamp: Fri 2012-08-31 18:04:26 -0700 message: Better seed support for (random). * doc/lispref/numbers.texi (Random Numbers): Document new behavior of the calls (random) and (random STRING). * etc/NEWS: Document new behavior of (random), (random "string"). * lisp/play/5x5.el, lisp/play/animate.el, lisp/play/cookie1.el: * lisp/play/dissociate.el, lisp/play/doctor.el, lisp/play/dunnet.el: * lisp/play/gomoku.el, lisp/play/landmark.el, lisp/play/mpuz.el: * lisp/play/tetris.el, lisp/play/zone.el: * lisp/calc/calc-comb.el (math-init-random-base): * lisp/play/blackbox.el (bb-init-board): * lisp/play/life.el (life): * lisp/server.el (server-use-tcp): * lisp/type-break.el (type-break): Remove unnecessary call to (random t). * lisp/net/sasl.el (sasl-unique-id-function): Change (random t) to (random), now that the latter is more random. * lisp/play/life.el (life-initialized): Remove no-longer-needed var. * lisp/gnus/gnus-sync.el (gnus-sync-lesync-setup): * lisp/gnus/message.el (message-canlock-generate, message-unique-id): Change (random t) to (random), now that the latter is more random. * lisp/org/org-id.el (org-id-uuid): Change (random t) to (random), now that the latter is more random. * src/emacs.c (main): Call init_random. * src/fns.c (Frandom): Set the seed from a string argument, if given. Remove long-obsolete Gentzel cruft. * src/lisp.h, src/sysdep.c (seed_random): Now takes address and size, not long. (init_random): New function. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-08-28 16:01:59 +0000 +++ doc/lispref/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,9 @@ +2012-09-01 Paul Eggert + + Better seed support for (random). + * numbers.texi (Random Numbers): Document new behavior of + the calls (random) and (random STRING). + 2012-08-21 Martin Rudalics * windows.texi (Window Point): Document recent changes in === modified file 'doc/lispref/numbers.texi' --- doc/lispref/numbers.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/numbers.texi 2012-09-01 01:04:26 +0000 @@ -1199,30 +1199,32 @@ mimic a random series. For example, all possible values occur equally often in a pseudo-random series. -In Emacs, pseudo-random numbers are generated from a ``seed'' number. +In Emacs, pseudo-random numbers are generated from a ``seed''. Starting from any given seed, the @code{random} function always -generates the same sequence of numbers. Emacs always starts with the -same seed value, so the sequence of values of @code{random} is actually -the same in each Emacs run! For example, in one operating system, the -first call to @code{(random)} after you start Emacs always returns -@minus{}1457731, and the second one always returns @minus{}7692030. This -repeatability is helpful for debugging. +generates the same sequence of numbers. Emacs typically starts with a +different seed each time, so the sequence of values of @code{random} +typically differs in each Emacs run. -If you want random numbers that don't always come out the same, execute -@code{(random t)}. This chooses a new seed based on the current time of -day and on Emacs's process @acronym{ID} number. +Sometimes you want the random number sequence to be repeatable. For +example, when debugging a program whose behavior depends on the random +number sequence, it is helpful to get the same behavior in each +program run. To make the sequence repeat, execute @code{(random "")}. +This sets the seed to a constant value for your particular Emacs +executable (though it may differ for other Emacs builds). You can use +other strings to choose various seed values. @defun random &optional limit This function returns a pseudo-random integer. Repeated calls return a series of pseudo-random integers. If @var{limit} is a positive integer, the value is chosen to be -nonnegative and less than @var{limit}. +nonnegative and less than @var{limit}. Otherwise, the value +might be any integer representable in Lisp. If @var{limit} is @code{t}, it means to choose a new seed based on the current time of day and on Emacs's process @acronym{ID} number. -On some machines, any integer representable in Lisp may be the result -of @code{random}. On other machines, the result can never be larger -than a certain maximum or less than a certain (negative) minimum. +If @var{limit} is a string, it means to choose a new seed based on the +string's contents. + @end defun === modified file 'etc/ChangeLog' --- etc/ChangeLog 2012-08-28 16:08:50 +0000 +++ etc/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,8 @@ +2012-09-01 Paul Eggert + + Better seeds for (random). + * NEWS: Document new behavior of (random), (random "string"). + 2012-08-28 Andreas Schwab * charsets/MULE-ethiopic.map: Fix typo in comment. === modified file 'etc/NEWS' --- etc/NEWS 2012-08-30 17:09:51 +0000 +++ etc/NEWS 2012-09-01 01:04:26 +0000 @@ -527,6 +527,11 @@ * Incompatible Lisp Changes in Emacs 24.3 +** (random) by default now returns a different random sequence in +every Emacs run. Use (random S), where S is a string, to set the +random seed to a value based on S, in order to get a repeatable +sequence in later calls. + ** The function `x-select-font' can return a font spec, instead of a font name as a string. Whether it returns a font spec or a font name depends on the graphical library. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-31 16:51:49 +0000 +++ lisp/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,19 @@ +2012-09-01 Paul Eggert + + Better seed support for (random). + * play/5x5.el, play/animate.el, play/cookie1.el, play/dissociate.el: + * play/doctor.el, play/dunnet.el, play/gomoku.el, play/landmark.el: + * play/mpuz.el, play/tetris.el, play/zone.el: + * calc/calc-comb.el (math-init-random-base): + * play/blackbox.el (bb-init-board): + * play/life.el (life): + * server.el (server-use-tcp): + * type-break.el (type-break): + Remove unnecessary call to (random t). + * net/sasl.el (sasl-unique-id-function): + Change (random t) to (random), now that the latter is more random. + * play/life.el (life-initialized): Remove no-longer-needed var. + 2012-08-31 Alp Aker * window.el (switch-to-prev-buffer, switch-to-next-buffer): === modified file 'lisp/allout-widgets.el' --- lisp/allout-widgets.el 2012-06-10 13:20:58 +0000 +++ lisp/allout-widgets.el 2012-09-01 01:04:26 +0000 @@ -1374,7 +1374,6 @@ ;; (time-trial ;; '(let ((size 10000) ;; doing) -;; (random t) ;; (dotimes (count size) ;; (setq doing (random size)) ;; (funcall try doing (+ doing (random 5))) === modified file 'lisp/calc/calc-comb.el' --- lisp/calc/calc-comb.el 2012-01-19 07:21:25 +0000 +++ lisp/calc/calc-comb.el 2012-09-01 01:04:26 +0000 @@ -77,7 +77,7 @@ 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973 4987 4993 4999 5003]) -;; The variable math-prime-factors-finished is set by calcFunc-prfac to +;; The variable math-prime-factors-finished is set by calcFunc-prfac to ;; indicate whether factoring is complete, and used by calcFunc-factors, ;; calcFunc-totient and calcFunc-moebius. (defvar math-prime-factors-finished) @@ -510,8 +510,8 @@ (while (<= (length math-stirling-local-cache) n) (let ((i (1- (length math-stirling-local-cache))) row) - (setq math-stirling-local-cache - (vconcat math-stirling-local-cache + (setq math-stirling-local-cache + (vconcat math-stirling-local-cache (make-vector (length math-stirling-local-cache) nil))) (aset math-stirling-cache k math-stirling-local-cache) (while (< (setq i (1+ i)) (length math-stirling-local-cache)) @@ -572,7 +572,6 @@ (let ((i 200)) (while (> (setq i (1- i)) 0) (math-random-base)))) - (random t) (setq var-RandSeed nil math-random-cache nil math-random-shift -4) ; assume RAND_MAX >= 16383 @@ -629,7 +628,7 @@ (i (/ (+ n slop) 3)) (rnum 0)) (while (> i 0) - (setq rnum + (setq rnum (math-add (math-random-three-digit-number) (math-mul rnum 1000))) @@ -823,11 +822,11 @@ (setq sum (% (+ sum - (calcFunc-mod + (calcFunc-mod q 1000000)) 111111)) - (setq q - (math-quotient + (setq q + (math-quotient q 1000000))) (cond ((= (% sum 3) 0) '(nil 3)) ((= (% sum 7) 0) '(nil 7)) === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-08-31 04:39:30 +0000 +++ lisp/gnus/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,10 @@ +2012-09-01 Paul Eggert + + Better seeds for (random). + * gnus-sync.el (gnus-sync-lesync-setup): + * message.el (message-canlock-generate, message-unique-id): + Change (random t) to (random), now that the latter is more random. + 2012-08-31 Dave Abrahams * auth-source.el (auth-sources): Fix macos keychain access. === modified file 'lisp/gnus/gnus-sync.el' --- lisp/gnus/gnus-sync.el 2012-07-02 00:48:41 +0000 +++ lisp/gnus/gnus-sync.el 2012-09-01 01:04:26 +0000 @@ -225,7 +225,7 @@ (security-object (concat url "/_security")) (user-record `((names . [,user]) (roles . []))) (couch-user-name (format "org.couchdb.user:%s" user)) - (salt (or salt (sha1 (format "%s" (random t))))) + (salt (or salt (sha1 (format "%s" (random))))) (couch-user-record `((_id . ,couch-user-name) (type . user) === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2012-08-15 16:29:11 +0000 +++ lisp/gnus/message.el 2012-09-01 01:04:26 +0000 @@ -4820,9 +4820,7 @@ (require 'sha1) (let (sha1-maximum-internal-length) (sha1 (concat (message-unique-id) - (format "%x%x%x" (random) - (progn (random t) (random)) - (random)) + (format "%x%x%x" (random) (random) (random)) (prin1-to-string (recent-keys)) (prin1-to-string (garbage-collect)))))) @@ -5525,7 +5523,6 @@ ;; You might for example insert a "." somewhere (not next to another dot ;; or string boundary), or modify the "fsf" string. (defun message-unique-id () - (random t) ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq message-unique-id-char === modified file 'lisp/net/sasl.el' --- lisp/net/sasl.el 2012-01-19 07:21:25 +0000 +++ lisp/net/sasl.el 2012-09-01 01:04:26 +0000 @@ -183,7 +183,7 @@ ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq sasl-unique-id-char - (% (1+ (or sasl-unique-id-char (logand (random t) (1- (lsh 1 20))))) + (% (1+ (or sasl-unique-id-char (logand (random) (1- (lsh 1 20))))) ;; (current-time) returns 16-bit ints, ;; and 2^16*25 just fits into 4 digits i base 36. (* 25 25))) === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2012-08-28 16:01:59 +0000 +++ lisp/org/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,9 @@ +2012-09-01 Paul Eggert + + Better seed support for (random). + * org-id.el (org-id-uuid): + Change (random t) to (random), now that the latter is more random. + 2012-07-29 Paul Eggert Don't use the abbreviation "win" to refer to Windows (Bug#10421). === modified file 'lisp/org/org-id.el' --- lisp/org/org-id.el 2012-01-19 07:21:25 +0000 +++ lisp/org/org-id.el 2012-09-01 01:04:26 +0000 @@ -318,7 +318,7 @@ (defun org-id-uuid () "Return string with random (version 4) UUID." (let ((rnd (md5 (format "%s%s%s%s%s%s%s" - (random t) + (random) (current-time) (user-uid) (emacs-pid) === modified file 'lisp/play/5x5.el' --- lisp/play/5x5.el 2012-07-11 23:13:41 +0000 +++ lisp/play/5x5.el 2012-09-01 01:04:26 +0000 @@ -953,8 +953,6 @@ (y-or-n-p prompt) t)) -(random t) - (provide '5x5) ;;; 5x5.el ends here === modified file 'lisp/play/animate.el' --- lisp/play/animate.el 2012-04-09 13:05:48 +0000 +++ lisp/play/animate.el 2012-09-01 01:04:26 +0000 @@ -201,8 +201,6 @@ (animate-string "my sunshine" 18 34) (animate-string "to stay!" 19 34)) -(random t) - (provide 'animate) ;;; animate.el ends here === modified file 'lisp/play/blackbox.el' --- lisp/play/blackbox.el 2012-01-19 07:21:25 +0000 +++ lisp/play/blackbox.el 2012-09-01 01:04:26 +0000 @@ -93,7 +93,7 @@ (define-key map (vector 'remap oldfun) newfun)) -(defvar blackbox-mode-map +(defvar blackbox-mode-map (let ((map (make-keymap))) (suppress-keymap map t) (blackbox-redefine-key map 'backward-char 'bb-left) @@ -257,7 +257,6 @@ (bb-goto (cons bb-x bb-y))) (defun bb-init-board (num-balls) - (random t) (let (board pos) (while (>= (setq num-balls (1- num-balls)) 0) (while === modified file 'lisp/play/cookie1.el' --- lisp/play/cookie1.el 2012-04-16 19:04:27 +0000 +++ lisp/play/cookie1.el 2012-09-01 01:04:26 +0000 @@ -53,9 +53,6 @@ ;;; Code: -; Randomize the seed in the random number generator. -(random t) - (defconst cookie-delimiter "\n%%\n\\|\n%\n\\|\0" "Delimiter used to separate cookie file entries.") === modified file 'lisp/play/dissociate.el' --- lisp/play/dissociate.el 2012-01-19 07:21:25 +0000 +++ lisp/play/dissociate.el 2012-09-01 01:04:26 +0000 @@ -94,8 +94,6 @@ (funcall search-function overlap opoint t)))))) (sit-for 0)))) -(random t) - (provide 'dissociate) ;;; dissociate.el ends here === modified file 'lisp/play/doctor.el' --- lisp/play/doctor.el 2012-06-14 14:22:37 +0000 +++ lisp/play/doctor.el 2012-09-01 01:04:26 +0000 @@ -1620,8 +1620,6 @@ (defun doctor-chat () (doctor-type (doc$ doctor--chatlst))) -(random t) - (provide 'doctor) ;;; doctor.el ends here === modified file 'lisp/play/dunnet.el' --- lisp/play/dunnet.el 2012-01-19 07:21:25 +0000 +++ lisp/play/dunnet.el 2012-09-01 01:04:26 +0000 @@ -3010,7 +3010,6 @@ (dun-uexit nil))) -(random t) (setq tloc (+ 60 (random 18))) (dun-replace dun-room-objects tloc (append (nth tloc dun-room-objects) (list 18))) === modified file 'lisp/play/gomoku.el' --- lisp/play/gomoku.el 2012-04-09 13:05:48 +0000 +++ lisp/play/gomoku.el 2012-09-01 01:04:26 +0000 @@ -1197,8 +1197,6 @@ (move-to-column (+ gomoku-x-offset (* gomoku-square-width (1- gomoku-board-width))))) -(random t) - (provide 'gomoku) ;;; gomoku.el ends here === modified file 'lisp/play/landmark.el' --- lisp/play/landmark.el 2012-07-11 23:13:41 +0000 +++ lisp/play/landmark.el 2012-09-01 01:04:26 +0000 @@ -1683,8 +1683,6 @@ ;;;allout-layout: (0 : -1 -1 0) ;;;End: -(random t) - (provide 'landmark) ;;; landmark.el ends here === modified file 'lisp/play/life.el' --- lisp/play/life.el 2012-01-19 07:21:25 +0000 +++ lisp/play/life.el 2012-09-01 01:04:26 +0000 @@ -111,9 +111,6 @@ ;; Sadly, mode-line-format won't display numbers. (defvar life-generation-string nil) -(defvar life-initialized nil - "Non-nil if `life' has been run at least once.") - ;;;###autoload (defun life (&optional sleeptime) "Run Conway's Life simulation. @@ -121,9 +118,6 @@ arg non-nil from a program) is the number of seconds to sleep between generations (this defaults to 1)." (interactive "p") - (or life-initialized - (random t)) - (setq life-initialized t) (or sleeptime (setq sleeptime 1)) (life-setup) (catch 'life-exit === modified file 'lisp/play/mpuz.el' --- lisp/play/mpuz.el 2012-06-08 16:39:49 +0000 +++ lisp/play/mpuz.el 2012-09-01 01:04:26 +0000 @@ -35,8 +35,6 @@ :prefix "mpuz-" :group 'games) -(random t) ; randomize - (defcustom mpuz-silent 'error "Set this to nil if you want dings on inputs. The value t means never ding, and `error' means only ding on wrong input." === modified file 'lisp/play/tetris.el' --- lisp/play/tetris.el 2012-07-11 23:13:41 +0000 +++ lisp/play/tetris.el 2012-09-01 01:04:26 +0000 @@ -635,8 +635,6 @@ (tetris-mode) (tetris-start-game)) -(random t) - (provide 'tetris) ;;; tetris.el ends here === modified file 'lisp/play/zone.el' --- lisp/play/zone.el 2012-06-02 10:56:09 +0000 +++ lisp/play/zone.el 2012-09-01 01:04:26 +0000 @@ -675,8 +675,6 @@ (kill-buffer nil)))) -(random t) - ;;;;;;;;;;;;;;; (provide 'zone) === modified file 'lisp/server.el' --- lisp/server.el 2012-08-15 16:29:11 +0000 +++ lisp/server.el 2012-09-01 01:04:26 +0000 @@ -94,7 +94,6 @@ (setq val t) (unless load-in-progress (message "Local sockets unsupported, using TCP sockets"))) - (when val (random t)) (set-default sym val)) :group 'server :type 'boolean === modified file 'lisp/type-break.el' --- lisp/type-break.el 2012-04-09 13:05:48 +0000 +++ lisp/type-break.el 2012-09-01 01:04:26 +0000 @@ -577,7 +577,6 @@ (unless type-break-terse-messages (message "Press any key to resume from typing break.")) - (random t) (let* ((len (length type-break-demo-functions)) (idx (random len)) (fn (nth idx type-break-demo-functions))) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-31 10:53:19 +0000 +++ src/ChangeLog 2012-09-01 01:04:26 +0000 @@ -1,3 +1,12 @@ +2012-09-01 Paul Eggert + + Better seed support for (random). + * emacs.c (main): Call init_random. + * fns.c (Frandom): Set the seed from a string argument, if given. + Remove long-obsolete Gentzel cruft. + * lisp.h, sysdep.c (seed_random): Now takes address and size, not long. + (init_random): New function. + 2012-08-31 Dmitry Antipov Remove mark_ttys function and fix tty_display_info initialization. === modified file 'src/emacs.c' --- src/emacs.c 2012-08-25 06:38:43 +0000 +++ src/emacs.c 2012-09-01 01:04:26 +0000 @@ -1281,6 +1281,7 @@ init_data (); init_atimer (); running_asynch_code = 0; + init_random (); no_loadup = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); === modified file 'src/fns.c' --- src/fns.c 2012-08-28 06:20:08 +0000 +++ src/fns.c 2012-09-01 01:04:26 +0000 @@ -74,32 +74,16 @@ (Lisp_Object limit) { EMACS_INT val; - Lisp_Object lispy_val; if (EQ (limit, Qt)) - { - EMACS_TIME t = current_emacs_time (); - seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t)); - } + init_random (); + else if (STRINGP (limit)) + seed_random (SSDATA (limit), SBYTES (limit)); + val = get_random (); if (NATNUMP (limit) && XFASTINT (limit) != 0) - { - /* Try to take our random number from the higher bits of VAL, - not the lower, since (says Gentzel) the low bits of `random' - are less random than the higher ones. We do this by using the - quotient rather than the remainder. At the high end of the RNG - it's possible to get a quotient larger than n; discarding - these values eliminates the bias that would otherwise appear - when using a large n. */ - EMACS_INT denominator = (INTMASK + 1) / XFASTINT (limit); - do - val = get_random () / denominator; - while (val >= XFASTINT (limit)); - } - else - val = get_random (); - XSETINT (lispy_val, val); - return lispy_val; + val %= XFASTINT (limit); + return make_number (val); } /* Heuristic on how many iterations of a tight loop can be safely done === modified file 'src/lisp.h' --- src/lisp.h 2012-08-31 10:53:19 +0000 +++ src/lisp.h 2012-09-01 01:04:26 +0000 @@ -3405,7 +3405,8 @@ extern void setup_pty (int); extern int set_window_size (int, int, int); extern EMACS_INT get_random (void); -extern void seed_random (long); +extern void seed_random (void *, ptrdiff_t); +extern void init_random (void); extern int emacs_open (const char *, int, int); extern int emacs_close (int); extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); === modified file 'src/sysdep.c' --- src/sysdep.c 2012-08-18 02:49:24 +0000 +++ src/sysdep.c 2012-09-01 01:04:26 +0000 @@ -1765,19 +1765,37 @@ #endif /* !RAND_BITS */ void -seed_random (long int arg) +seed_random (void *seed, ptrdiff_t seed_size) { +#if defined HAVE_RANDOM || ! defined HAV_LRAND48 + unsigned int arg = 0; +#else + long int arg = 0; +#endif + unsigned char *argp = (unsigned char *) &arg; + unsigned char *seedp = seed; + ptrdiff_t i; + for (i = 0; i < seed_size; i++) + argp[i % sizeof arg] ^= seedp[i]; #ifdef HAVE_RANDOM - srandom ((unsigned int)arg); + srandom (arg); #else # ifdef HAVE_LRAND48 srand48 (arg); # else - srand ((unsigned int)arg); + srand (arg); # endif #endif } +void +init_random (void) +{ + EMACS_TIME t = current_emacs_time (); + uintmax_t v = getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t); + seed_random (&v, sizeof v); +} + /* * Return a nonnegative random integer out of whatever we've got. * It contains enough bits to make a random (signed) Emacs fixnum. ------------------------------------------------------------ revno: 109832 committer: Andreas Schwab branch nick: emacs timestamp: Fri 2012-08-31 18:53:48 +0200 message: Fixes: debbugs:12306 * etags.c (consider_token): Always zero-terminate token buffer. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-08-28 16:01:59 +0000 +++ lib-src/ChangeLog 2012-08-31 16:53:48 +0000 @@ -1,3 +1,8 @@ +2012-08-31 Andreas Schwab + + * etags.c (consider_token): Always zero-terminate token buffer. + (Bug#12306) + 2012-08-19 Paul Eggert Rely on + to declare 'environ'. === modified file 'lib-src/etags.c' --- lib-src/etags.c 2012-08-15 08:57:14 +0000 +++ lib-src/etags.c 2012-08-31 16:53:48 +0000 @@ -2878,6 +2878,7 @@ objdef = omethodtag; linebuffer_setlen (&token_name, oldlen + len); memcpy (token_name.buffer + oldlen, str, len); + token_name.buffer[oldlen + len] = '\0'; return TRUE; } return FALSE; ------------------------------------------------------------ revno: 109831 committer: martin rudalics branch nick: trunk timestamp: Fri 2012-08-31 18:51:49 +0200 message: Consider frame's buffer predicate in switch-to-prev-/next-buffer. * window.el (switch-to-prev-buffer, switch-to-next-buffer): Consider frame's buffer predicate when choosing the buffer. (Bug#12081) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-08-30 17:09:11 +0000 +++ lisp/ChangeLog 2012-08-31 16:51:49 +0000 @@ -1,3 +1,9 @@ +2012-08-31 Alp Aker + + * window.el (switch-to-prev-buffer, switch-to-next-buffer): + Consider frame's buffer predicate when choosing the buffer. + (Bug#12081) + 2012-08-30 Richard Stallman * simple.el (special-mode-map): Delete binding for `z'. === modified file 'lisp/window.el' --- lisp/window.el 2012-08-30 03:45:51 +0000 +++ lisp/window.el 2012-08-31 16:51:49 +0000 @@ -2979,6 +2979,7 @@ (old-buffer (window-buffer window)) ;; Save this since it's destroyed by `set-window-buffer'. (next-buffers (window-next-buffers window)) + (pred (frame-parameter frame 'buffer-predicate)) entry buffer new-buffer killed-buffers visible) (when (window-dedicated-p window) (error "Window %s is dedicated to buffer %s" window old-buffer)) @@ -2991,6 +2992,7 @@ (or (buffer-live-p buffer) (not (setq killed-buffers (cons buffer killed-buffers)))) + (or (null pred) (funcall pred buffer)) (not (eq buffer old-buffer)) (or bury-or-kill (not (memq buffer next-buffers)))) (if (and (not switch-to-visible-buffer) @@ -3013,6 +3015,7 @@ (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) + (or (null pred) (funcall pred buffer)) (or bury-or-kill (not (memq buffer next-buffers)))) (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. @@ -3031,6 +3034,7 @@ (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -3075,6 +3079,7 @@ (frame (window-frame window)) (old-buffer (window-buffer window)) (next-buffers (window-next-buffers window)) + (pred (frame-parameter frame 'buffer-predicate)) buffer new-buffer entry killed-buffers visible) (when (window-dedicated-p window) (error "Window %s is dedicated to buffer %s" window old-buffer)) @@ -3086,6 +3091,7 @@ (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -3096,6 +3102,7 @@ (dolist (buffer (buffer-list frame)) (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) + (or (null pred) (funcall pred buffer)) (not (assq buffer (window-prev-buffers window)))) (if (get-buffer-window buffer frame) ;; Try to avoid showing a buffer visible in some other window. @@ -3110,6 +3117,7 @@ (or (buffer-live-p buffer) (not (setq killed-buffers (cons buffer killed-buffers)))) + (or (null pred) (funcall pred buffer)) (not (eq buffer old-buffer))) (if (and (not switch-to-visible-buffer) (get-buffer-window buffer frame)) ------------------------------------------------------------ revno: 109830 committer: Michael Albinus branch nick: trunk timestamp: Fri 2012-08-31 14:53:19 +0400 message: Remove mark_ttys function and fix tty_display_info initialization. * lisp.h (mark_ttys): Remove prototype. * alloc.c (Fgarbage_collect): Remove redundant (and the only) call to mark_ttys because all possible values of 'top_frame' slot are the frames which are reachable from Vframe_list. * term.c (mark_ttys): Remove. (init_tty): Safely initialize 'top_frame' slot with Qnil. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-08-31 04:40:52 +0000 +++ src/ChangeLog 2012-08-31 10:53:19 +0000 @@ -1,5 +1,15 @@ 2012-08-31 Dmitry Antipov + Remove mark_ttys function and fix tty_display_info initialization. + * lisp.h (mark_ttys): Remove prototype. + * alloc.c (Fgarbage_collect): Remove redundant (and the only) call + to mark_ttys because all possible values of 'top_frame' slot are + the frames which are reachable from Vframe_list. + * term.c (mark_ttys): Remove. + (init_tty): Safely initialize 'top_frame' slot with Qnil. + +2012-08-31 Dmitry Antipov + Change struct frame bitfields from unsigned char to unsigned. * frame.h (struct frame): Change type of 'display_preempted', 'visible', 'iconified', 'has_minibuffer', 'wants_modeline', === modified file 'src/alloc.c' --- src/alloc.c 2012-08-27 09:30:26 +0000 +++ src/alloc.c 2012-08-31 10:53:19 +0000 @@ -5476,7 +5476,6 @@ } mark_terminals (); mark_kboards (); - mark_ttys (); #ifdef USE_GTK { === modified file 'src/lisp.h' --- src/lisp.h 2012-08-28 00:33:56 +0000 +++ src/lisp.h 2012-08-31 10:53:19 +0000 @@ -3438,7 +3438,6 @@ /* Defined in term.c */ extern int *char_ins_del_vector; -extern void mark_ttys (void); extern void syms_of_term (void); extern _Noreturn void fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); === modified file 'src/term.c' --- src/term.c 2012-08-17 23:38:43 +0000 +++ src/term.c 2012-08-31 10:53:19 +0000 @@ -3001,6 +3001,7 @@ #else tty = xzalloc (sizeof *tty); #endif + tty->top_frame = Qnil; tty->next = tty_list; tty_list = tty; @@ -3541,22 +3542,6 @@ xfree (tty); } - - -/* Mark the pointers in the tty_display_info objects. - Called by Fgarbage_collect. */ - -void -mark_ttys (void) -{ - struct tty_display_info *tty; - - for (tty = tty_list; tty; tty = tty->next) - mark_object (tty->top_frame); -} - - - void syms_of_term (void) { ------------------------------------------------------------ revno: 109828 author: Dave Abrahams committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2012-08-31 04:39:30 +0000 message: [Gnus] Miscellaneous fixes by Dave Abrahams diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-08-31 00:46:01 +0000 +++ lisp/gnus/ChangeLog 2012-08-31 04:39:30 +0000 @@ -1,3 +1,19 @@ +2012-08-31 Dave Abrahams + + * auth-source.el (auth-sources): Fix macos keychain access. + + * gnus-int.el (gnus-request-head): When gnus-override-method is set, + allow the backend `request-head' function to determine the group + name on its own. + (gnus-request-expire-articles): Filter out negative article numbers + during expiry (Bug#11980). + + * gnus-range.el (gnus-set-difference): Change gnus-set-difference from + O(N^2) to O(N). This makes warping into huge groups tolerable. + + * gnus-registry.el (gnus-try-warping-via-registry): Don't act as though + you've found the article when you haven't. + 2012-08-31 Stefan Monnier * gnus-notifications.el (gnus-notifications-action): Avoid CL-ism. === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2012-08-10 14:38:37 +0000 +++ lisp/gnus/auth-source.el 2012-08-31 04:39:30 +0000 @@ -256,10 +256,10 @@ (const :tag "Temp Secrets API Collection" "secrets:session") (const :tag "Default internet Mac OS Keychain" - 'macos-keychain-internet) + macos-keychain-internet) (const :tag "Default generic Mac OS Keychain" - 'macos-keychain-generic) + macos-keychain-generic) (list :tag "Source definition" (const :format "" :value :source) === modified file 'lisp/gnus/gnus-int.el' --- lisp/gnus/gnus-int.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/gnus-int.el 2012-08-31 04:39:30 +0000 @@ -599,7 +599,8 @@ clean-up t)) ;; Use `head' function. ((fboundp head) - (setq res (funcall head article (gnus-group-real-name group) + (setq res (funcall head article + (and (not gnus-override-method) (gnus-group-real-name group)) (nth 1 gnus-command-method)))) ;; Use `article' function. (t @@ -706,6 +707,10 @@ (defun gnus-request-expire-articles (articles group &optional force) (let* ((gnus-command-method (gnus-find-method-for-group group)) + ;; Filter out any negative article numbers; they can't be + ;; expired here. + (articles + (delq nil (mapcar (lambda (n) (and (>= n 0) n)) articles))) (gnus-inhibit-demon t) (not-deleted (funcall === modified file 'lisp/gnus/gnus-range.el' --- lisp/gnus/gnus-range.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/gnus-range.el 2012-08-31 04:39:30 +0000 @@ -52,11 +52,13 @@ (defun gnus-set-difference (list1 list2) "Return a list of elements of LIST1 that do not appear in LIST2." - (let ((list1 (copy-sequence list1))) - (while list2 - (setq list1 (delq (car list2) list1)) - (setq list2 (cdr list2))) - list1)) + (let ((hash2 (make-hash-table :test 'eq)) + (result nil)) + (dolist (elt list2) (puthash elt t hash2)) + (dolist (elt list1) + (unless (gethash elt hash2) + (setq result (cons elt result)))) + (nreverse result))) (defun gnus-range-nconcat (&rest ranges) "Return a range comprising all the RANGES, which are pre-sorted. === modified file 'lisp/gnus/gnus-registry.el' --- lisp/gnus/gnus-registry.el 2012-06-26 22:52:31 +0000 +++ lisp/gnus/gnus-registry.el 2012-08-31 04:39:30 +0000 @@ -1169,9 +1169,10 @@ ;; Try to activate the group. If that fails, just move ;; along. We may have more groups to work with - (ignore-errors - (gnus-select-group-with-message-id group message-id)) - (throw 'found t))))))) + (when + (ignore-errors + (gnus-select-group-with-message-id group message-id) t) + (throw 'found t)))))))) ;; TODO: a few things