mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
merging with my changes in cond-star.el.
This commit is contained in:
commit
abd861ca26
135 changed files with 1999 additions and 841 deletions
|
|
@ -3772,7 +3772,7 @@ This assumes the function has the `important-return-value' property."
|
|||
;; Add missing &optional (or &rest) arguments.
|
||||
(dotimes (_ (- (/ (1+ fmax2) 2) alen))
|
||||
(byte-compile-push-constant nil)))
|
||||
((zerop (logand fmax2 1))
|
||||
((evenp fmax2)
|
||||
(byte-compile-report-error
|
||||
(format "Too many arguments for inlined function %S" form))
|
||||
(byte-compile-discard (- alen (/ fmax2 2))))
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ of the drawing."
|
|||
(odd nil)
|
||||
p1)
|
||||
(while s
|
||||
(setq odd (= (% (length s) 2) 1))
|
||||
(setq odd (oddp (length s)))
|
||||
(setq r (chart-translate-namezone (oref a chart) i))
|
||||
(if (eq dir 'vertical)
|
||||
(setq p (/ (+ (car r) (cdr r)) 2))
|
||||
|
|
|
|||
|
|
@ -2109,7 +2109,7 @@ The text checked is between START and LIMIT."
|
|||
(goto-char start)
|
||||
(while (and (< (point) p) (re-search-forward "\\\\\"" limit t))
|
||||
(setq c (1+ c)))
|
||||
(and (< 0 c) (= (% c 2) 0))))))
|
||||
(and (< 0 c) (evenp c))))))
|
||||
|
||||
(defun checkdoc-in-abbreviation-p (begin)
|
||||
"Return non-nil if point is at an abbreviation.
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ With two arguments, return rounding and remainder of their quotient."
|
|||
(res (cl-floor (+ x hy) y)))
|
||||
(if (and (= (car (cdr res)) 0)
|
||||
(= (+ hy hy) y)
|
||||
(/= (% (car res) 2) 0))
|
||||
(oddp (car res)))
|
||||
(list (1- (car res)) hy)
|
||||
(list (car res) (- (car (cdr res)) hy))))
|
||||
(let ((q (round (/ x y))))
|
||||
|
|
|
|||
|
|
@ -270,27 +270,29 @@ so that they are registered at compile-time as well as run-time."
|
|||
|
||||
(define-obsolete-function-alias 'cl-floatp-safe 'floatp "24.4")
|
||||
|
||||
(defsubst cl-plusp (number)
|
||||
"Return t if NUMBER is positive."
|
||||
(declare (side-effect-free t))
|
||||
(> number 0))
|
||||
(defalias 'cl-plusp #'plusp
|
||||
"Return t if NUMBER is positive.
|
||||
|
||||
(defsubst cl-minusp (number)
|
||||
"Return t if NUMBER is negative."
|
||||
(declare (side-effect-free t))
|
||||
(< number 0))
|
||||
This function is considered deprecated in favor of the built-in function
|
||||
`plusp' that was added in Emacs 31.1.")
|
||||
|
||||
(defun cl-oddp (integer)
|
||||
"Return t if INTEGER is odd."
|
||||
(declare (side-effect-free t)
|
||||
(compiler-macro (lambda (_) `(eq (logand ,integer 1) 1))))
|
||||
(eq (logand integer 1) 1))
|
||||
(defalias 'cl-minusp #'minusp
|
||||
"Return t if NUMBER is negative.
|
||||
|
||||
(defun cl-evenp (integer)
|
||||
"Return t if INTEGER is even."
|
||||
(declare (side-effect-free t)
|
||||
(compiler-macro (lambda (_) `(eq (logand ,integer 1) 0))))
|
||||
(eq (logand integer 1) 0))
|
||||
This function is considered deprecated in favor of the built-in function
|
||||
`minusp' that was added in Emacs 31.1.")
|
||||
|
||||
(defalias 'cl-oddp #'oddp
|
||||
"Return t if INTEGER is odd.
|
||||
|
||||
This function is considered deprecated in favor of the built-in function
|
||||
`evenp' that was added in Emacs 31.1.")
|
||||
|
||||
(defalias 'cl-evenp #'evenp
|
||||
"Return t if INTEGER is even.
|
||||
|
||||
This function is considered deprecated in favor of the built-in function
|
||||
`evenp' that was added in Emacs 31.1.")
|
||||
|
||||
(defconst cl-digit-char-table
|
||||
(let* ((digits (make-vector 256 nil))
|
||||
|
|
|
|||
|
|
@ -2701,7 +2701,7 @@ Example:
|
|||
(let ((speed (assq (nth 1 (assq 'speed (cdr spec)))
|
||||
'((0 nil) (1 t) (2 t) (3 t))))
|
||||
(safety (assq (nth 1 (assq 'safety (cdr spec)))
|
||||
'((0 t) (1 t) (2 t) (3 nil)))))
|
||||
'((0 t) (1 nil) (2 nil) (3 nil)))))
|
||||
(if speed (setq cl--optimize-speed (car speed)
|
||||
byte-optimize (nth 1 speed)))
|
||||
(if safety (setq cl--optimize-safety (car safety)
|
||||
|
|
@ -3259,7 +3259,7 @@ To see the documentation for a defined struct type, use
|
|||
(declare (side-effect-free t))
|
||||
,access-body)
|
||||
forms)
|
||||
(when (cl-oddp (length desc))
|
||||
(when (oddp (length desc))
|
||||
(push
|
||||
(macroexp-warn-and-return
|
||||
(format-message
|
||||
|
|
|
|||
|
|
@ -79,9 +79,25 @@
|
|||
|
||||
(define-obsolete-variable-alias 'crm-default-separator 'crm-separator "29.1")
|
||||
|
||||
(defvar crm-separator "[ \t]*,[ \t]*"
|
||||
(defvar crm-separator
|
||||
(propertize "[ \t]*,[ \t]*" 'separator "," 'description "comma-separated list")
|
||||
"Separator regexp used for separating strings in `completing-read-multiple'.
|
||||
It should be a regexp that does not match the list of completion candidates.")
|
||||
It should be a regexp that does not match the list of completion
|
||||
candidates. The regexp string can carry the text properties `separator'
|
||||
and `description', which if present `completing-read-multiple' will show
|
||||
as part of the prompt. See the user option `crm-prompt'.")
|
||||
|
||||
(defcustom crm-prompt "[%d] %p"
|
||||
"Prompt format for `completing-read-multiple'.
|
||||
The prompt is formatted by `format-spec' with the keys %d, %s and %p
|
||||
standing for the separator description, the separator itself and the
|
||||
original prompt respectively."
|
||||
:type '(choice (const :tag "Original prompt" "%p")
|
||||
(const :tag "Description and prompt" "[%d] %p")
|
||||
(const :tag "Short CRM indication" "[CRM%s] %p")
|
||||
(string :tag "Custom string"))
|
||||
:group 'minibuffer
|
||||
:version "31.1")
|
||||
|
||||
(defvar-keymap crm-local-completion-map
|
||||
:doc "Local keymap for minibuffer multiple input with completion.
|
||||
|
|
@ -266,8 +282,14 @@ with empty strings removed."
|
|||
(unless (eq require-match t) require-match))
|
||||
(setq-local crm-completion-table table))
|
||||
(setq input (read-from-minibuffer
|
||||
prompt initial-input map
|
||||
nil hist def inherit-input-method)))
|
||||
(format-spec
|
||||
crm-prompt
|
||||
(let* ((sep (or (get-text-property 0 'separator crm-separator)
|
||||
(string-replace "[ \t]*" "" crm-separator)))
|
||||
(desc (or (get-text-property 0 'description crm-separator)
|
||||
(concat "list separated by " sep))))
|
||||
`((?s . ,sep) (?d . ,desc) (?p . ,prompt))))
|
||||
initial-input map nil hist def inherit-input-method)))
|
||||
;; If the user enters empty input, `read-from-minibuffer'
|
||||
;; returns the empty string, not DEF.
|
||||
(when (and def (string-equal input ""))
|
||||
|
|
|
|||
|
|
@ -115,10 +115,10 @@ and reference them using the function `class-option'."
|
|||
(cl-check-type superclasses list)
|
||||
|
||||
(cond ((and (stringp (car options-and-doc))
|
||||
(/= 1 (% (length options-and-doc) 2)))
|
||||
(evenp (length options-and-doc)))
|
||||
(error "Too many arguments to `defclass'"))
|
||||
((and (symbolp (car options-and-doc))
|
||||
(/= 0 (% (length options-and-doc) 2)))
|
||||
(oddp (length options-and-doc)))
|
||||
(error "Too many arguments to `defclass'")))
|
||||
|
||||
(if (stringp (car options-and-doc))
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ CODE can be a lambda expression, a macro, or byte-compiled code."
|
|||
|
||||
(defun elint-check-setq-form (form env)
|
||||
"Lint the setq FORM in ENV."
|
||||
(or (= (mod (length form) 2) 1)
|
||||
(or (oddp (length form))
|
||||
;; (setq foo) is valid and equivalent to (setq foo nil).
|
||||
(elint-warning "Missing value in setq: %s" form))
|
||||
(let ((newenv env)
|
||||
|
|
@ -833,7 +833,7 @@ CODE can be a lambda expression, a macro, or byte-compiled code."
|
|||
"Lint the defcustom FORM in ENV."
|
||||
(if (and (> (length form) 3)
|
||||
;; even no. of keyword/value args ?
|
||||
(zerop (logand (length form) 1)))
|
||||
(evenp (length form)))
|
||||
(elint-env-add-global-var (elint-form (nth 2 form) env)
|
||||
(car (cdr form)))
|
||||
(elint-error "Malformed variable declaration: %s" form)
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ structure with the plists in ARGS."
|
|||
(string (let ((begin (point)))
|
||||
(insert x)
|
||||
(set-text-properties begin (point) current-plist)))
|
||||
(list (unless (zerop (mod (length x) 2))
|
||||
(list (unless (evenp (length x))
|
||||
(error "Odd number of args in plist: %S" x))
|
||||
(setq current-plist x))))
|
||||
(buffer-string)))
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ Return nil if they are."
|
|||
|
||||
(defun ert--significant-plist-keys (plist)
|
||||
"Return the keys of PLIST that have non-null values, in order."
|
||||
(cl-assert (zerop (mod (length plist) 2)) t)
|
||||
(cl-assert (evenp (length plist)) t)
|
||||
(cl-loop for (key value . rest) on plist by #'cddr
|
||||
unless (or (null value) (memq key accu)) collect key into accu
|
||||
finally (cl-return accu)))
|
||||
|
|
@ -587,8 +587,8 @@ Return nil if they are."
|
|||
Returns nil if they are equivalent, i.e., have the same value for
|
||||
each key, where absent values are treated as nil. The order of
|
||||
key/value pairs in each list does not matter."
|
||||
(cl-assert (zerop (mod (length a) 2)) t)
|
||||
(cl-assert (zerop (mod (length b) 2)) t)
|
||||
(cl-assert (evenp (length a)) t)
|
||||
(cl-assert (evenp (length b)) t)
|
||||
;; Normalizing the plists would be another way to do this but it
|
||||
;; requires a total ordering on all lisp objects (since any object
|
||||
;; is valid as a text property key). Perhaps defining such an
|
||||
|
|
@ -1419,7 +1419,7 @@ Returns the stats object."
|
|||
(message "%9s %S%s"
|
||||
(ert-string-for-test-result result nil)
|
||||
(ert-test-name test)
|
||||
(if (cl-plusp
|
||||
(if (plusp
|
||||
(length (getenv "EMACS_TEST_VERBOSE")))
|
||||
(ert-reason-for-test-result result)
|
||||
""))))
|
||||
|
|
@ -1432,7 +1432,7 @@ Returns the stats object."
|
|||
(message "%9s %S%s"
|
||||
(ert-string-for-test-result result nil)
|
||||
(ert-test-name test)
|
||||
(if (cl-plusp
|
||||
(if (plusp
|
||||
(length (getenv "EMACS_TEST_VERBOSE")))
|
||||
(ert-reason-for-test-result result)
|
||||
""))))
|
||||
|
|
@ -2123,7 +2123,7 @@ non-nil, returns the face for expected results.."
|
|||
(defun ert-face-for-stats (stats)
|
||||
"Return a face that represents STATS."
|
||||
(cond ((ert--stats-aborted-p stats) 'nil)
|
||||
((cl-plusp (ert-stats-completed-unexpected stats))
|
||||
((plusp (ert-stats-completed-unexpected stats))
|
||||
(ert-face-for-test-result nil))
|
||||
((eql (ert-stats-completed-expected stats) (ert-stats-total stats))
|
||||
(ert-face-for-test-result t))
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ The return value is the last VAL in the list.
|
|||
|
||||
\(fn PLACE VAL PLACE VAL ...)"
|
||||
(declare (debug (&rest [gv-place form])))
|
||||
(if (/= (logand (length args) 1) 0)
|
||||
(if (oddp (length args))
|
||||
(signal 'wrong-number-of-arguments (list 'setf (length args))))
|
||||
(if (and args (null (cddr args)))
|
||||
(let ((place (pop args))
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
(recenter))
|
||||
((and (or (eq continue 'backspace)
|
||||
(eq continue ?\177))
|
||||
(zerop (% state 2)))
|
||||
(evenp state))
|
||||
(scroll-down))
|
||||
(t (setq continue nil))))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
|
|||
;; Malformed code is translated to code that signals an error
|
||||
;; at run time.
|
||||
(let ((nargs (length args)))
|
||||
(if (/= (logand nargs 1) 0)
|
||||
(if (oddp nargs)
|
||||
(macroexp-warn-and-return
|
||||
(format-message "odd number of arguments in `setq' form")
|
||||
`(signal 'wrong-number-of-arguments '(setq ,nargs))
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ undetected, binding variables to arbitrary values, such as nil.
|
|||
(cond
|
||||
(args
|
||||
(let ((arg-length (length args)))
|
||||
(unless (= 0 (mod arg-length 2))
|
||||
(unless (evenp arg-length)
|
||||
(signal 'wrong-number-of-arguments
|
||||
(list 'pcase-setq (+ 2 arg-length)))))
|
||||
(let ((result))
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ the bounds of a region containing Lisp code to pretty-print."
|
|||
(insert ")")))
|
||||
|
||||
(defun pp--format-definition (sexp indent edebug)
|
||||
(while (and (cl-plusp indent)
|
||||
(while (and (plusp indent)
|
||||
sexp)
|
||||
(insert " ")
|
||||
;; We don't understand all the edebug specs.
|
||||
|
|
|
|||
|
|
@ -1072,7 +1072,7 @@ Return (REGEXP . PRECEDENCE)."
|
|||
"Expand `eval' arguments. Return a new rx form."
|
||||
(unless (and body (null (cdr body)))
|
||||
(error "rx `eval' form takes exactly one argument"))
|
||||
(eval (car body)))
|
||||
(eval (car body) lexical-binding))
|
||||
|
||||
(defun rx--translate-eval (body)
|
||||
"Translate the `eval' form. Return (REGEXP . PRECEDENCE)."
|
||||
|
|
|
|||
|
|
@ -278,17 +278,17 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
|
|||
:args (function map)
|
||||
:eval (map-values-apply #'1+ (list '(1 . 2) '(3 . 4))))
|
||||
(map-filter
|
||||
:eval (map-filter (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-filter (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
:eval (map-filter (lambda (k _) (oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-filter (lambda (k v) (evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
(map-remove
|
||||
:eval (map-remove (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-remove (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
:eval (map-remove (lambda (k _) (oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-remove (lambda (k v) (evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
(map-some
|
||||
:eval (map-some (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-some (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
:eval (map-some (lambda (k _) (oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-some (lambda (k v) (evenp (+ k v))) (list '(1 . 2) '(4 . 6))))
|
||||
(map-every-p
|
||||
:eval (map-every-p (lambda (k _) (cl-oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-every-p (lambda (k v) (cl-evenp (+ k v))) (list '(1 . 3) '(4 . 6))))
|
||||
:eval (map-every-p (lambda (k _) (oddp k)) (list '(1 . 2) '(4 . 6)))
|
||||
:eval (map-every-p (lambda (k v) (evenp (+ k v))) (list '(1 . 3) '(4 . 6))))
|
||||
"Combining and changing maps"
|
||||
(map-merge
|
||||
:eval (map-merge 'alist '(1 2 3 4) #s(hash-table data (5 6 7 8)))
|
||||
|
|
@ -1412,16 +1412,16 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
|
|||
:eval (natnump -1)
|
||||
:eval (natnump 0)
|
||||
:eval (natnump 23))
|
||||
(cl-plusp
|
||||
:eval (cl-plusp 0)
|
||||
:eval (cl-plusp 1))
|
||||
(cl-minusp
|
||||
:eval (cl-minusp 0)
|
||||
:eval (cl-minusp -1))
|
||||
(cl-oddp
|
||||
:eval (cl-oddp 3))
|
||||
(cl-evenp
|
||||
:eval (cl-evenp 6))
|
||||
(plusp
|
||||
:eval (plusp 0)
|
||||
:eval (plusp 1))
|
||||
(minusp
|
||||
:eval (minusp 0)
|
||||
:eval (minusp -1))
|
||||
(oddp
|
||||
:eval (oddp 3))
|
||||
(evenp
|
||||
:eval (evenp 6))
|
||||
(bignump
|
||||
:eval (bignump 4)
|
||||
:eval (bignump (expt 2 90)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue