1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

Prefer seq-random-elt to nth+random

* lisp/emacs-lisp/seq.el (seq-random-elt): Autoload.
* lisp/avoid.el (mouse-avoidance-random-shape):
* lisp/epa-ks.el (epa-ks--query-url):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/gnus/gnus-fun.el (gnus--random-face-with-type)
(gnus-fun-ppm-change-string):
* lisp/net/soap-inspect.el (soap-sample-value-for-xs-simple-type):
* lisp/obsolete/landmark.el (landmark-random-move):
* lisp/play/mpuz.el (mpuz-build-random-perm):
* lisp/play/zone.el (zone-pgm-stress):
* lisp/vc/add-log.el (add-change-log-entry):
* test/lisp/net/tramp-tests.el
(tramp-test44-asynchronous-requests): Prefer seq-random-elt to
nth+random.
This commit is contained in:
Stefan Kangas 2021-09-24 19:41:03 +02:00
parent 8fbf816ccd
commit 35d0675467
11 changed files with 16 additions and 22 deletions

View file

@ -43,7 +43,7 @@
;;
;; (if (eq window-system 'x)
;; (mouse-avoidance-set-pointer-shape
;; (nth (random 4)
;; (seq-random-elt
;; (list x-pointer-man x-pointer-spider
;; x-pointer-gobbler x-pointer-gumby))))
;;
@ -125,7 +125,6 @@ TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window."
;; Internal variables
(defvar mouse-avoidance-state nil)
(defvar mouse-avoidance-pointer-shapes nil)
(defvar mouse-avoidance-n-pointer-shapes 0)
(defvar mouse-avoidance-old-pointer-shape nil)
(defvar mouse-avoidance-animating-pointer nil)
@ -306,11 +305,8 @@ redefine this function to suit your own tastes."
(all-completions "x-pointer-" obarray
(lambda (x)
(and (boundp x)
(integerp (symbol-value x)))))))
(setq mouse-avoidance-n-pointer-shapes
(length mouse-avoidance-pointer-shapes))))
(nth (random mouse-avoidance-n-pointer-shapes)
mouse-avoidance-pointer-shapes))
(integerp (symbol-value x)))))))))
(seq-random-elt mouse-avoidance-pointer-shapes))
(defun mouse-avoidance-ignore-p ()
(let ((mp (mouse-position)))