Merge from origin/emacs-26
5cb3991
Fix a typo in emacs-lisp-intro.texid6aa55e
Avoid segfaults in replace-buffer-contents with large buffersd22b8d1
Adjust for scaling for mode-line popup menus (Bug#31880)3d2e3dc
Change name of `seqp' argument (Bug#26411)40e1db8
Change index of ";" to better reflect it's usage (Bug#31623)d289e7e
Fix bug of 'mouse-drag-and-drop-region' to detect edges of re...e292c09
Fix #'fun handling inside `labels' (Bug#31792)
This commit is contained in:
commit
b81e193ac0
11 changed files with 97 additions and 39 deletions
|
@ -1998,13 +1998,16 @@ a `let' form, except that the list of symbols can be computed at run-time."
|
|||
;;;###autoload
|
||||
(defmacro cl-flet (bindings &rest body)
|
||||
"Make local function definitions.
|
||||
Like `cl-labels' but the definitions are not recursive.
|
||||
Each binding can take the form (FUNC EXP) where
|
||||
Each definition can take the form (FUNC EXP) where
|
||||
FUNC is the function name, and EXP is an expression that returns the
|
||||
function value to which it should be bound, or it can take the more common
|
||||
form \(FUNC ARGLIST BODY...) which is a shorthand
|
||||
for (FUNC (lambda ARGLIST BODY)).
|
||||
|
||||
FUNC is defined only within FORM, not BODY, so you can't write
|
||||
recursive function definitions. Use `cl-labels' for that. See
|
||||
info node `(cl) Function Bindings' for details.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
||||
(declare (indent 1) (debug ((&rest (cl-defun)) cl-declarations body)))
|
||||
(let ((binds ()) (newenv macroexpand-all-environment))
|
||||
|
@ -2046,9 +2049,13 @@ Like `cl-flet' but the definitions can refer to previous ones.
|
|||
|
||||
;;;###autoload
|
||||
(defmacro cl-labels (bindings &rest body)
|
||||
"Make temporary function bindings.
|
||||
The bindings can be recursive and the scoping is lexical, but capturing them
|
||||
in closures will only work if `lexical-binding' is in use.
|
||||
"Make local (recursive) function definitions.
|
||||
Each definition can take the form (FUNC ARGLIST BODY...) where
|
||||
FUNC is the function name, ARGLIST its arguments, and BODY the
|
||||
forms of the function body. FUNC is defined in any BODY, as well
|
||||
as FORM, so you can write recursive and mutually recursive
|
||||
function definitions. See info node `(cl) Function Bindings' for
|
||||
details.
|
||||
|
||||
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
|
||||
(declare (indent 1) (debug cl-flet))
|
||||
|
|
|
@ -466,9 +466,12 @@ rather than relying on `lexical-binding'."
|
|||
(push var sets)
|
||||
(push (cons (car binding)
|
||||
`(lambda (&rest cl-labels-args)
|
||||
(cl-list* 'funcall ',var
|
||||
cl-labels-args)))
|
||||
(if (eq (car cl-labels-args) cl--labels-magic)
|
||||
(list cl--labels-magic ',var)
|
||||
(cl-list* 'funcall ',var cl-labels-args))))
|
||||
newenv)))
|
||||
;; `lexical-let' adds `cl--function-convert' (which calls
|
||||
;; `cl--labels-convert') as a macroexpander for `function'.
|
||||
(macroexpand-all `(lexical-let ,vars (setq ,@sets) ,@body) newenv)))
|
||||
|
||||
;; Generalized variables are provided by gv.el, but some details are
|
||||
|
|
|
@ -127,9 +127,9 @@ the sequence, and its index within the sequence."
|
|||
(setq index (1+ index)))
|
||||
sequence)))
|
||||
|
||||
(cl-defgeneric seqp (sequence)
|
||||
"Return non-nil if SEQUENCE is a sequence, nil otherwise."
|
||||
(sequencep sequence))
|
||||
(cl-defgeneric seqp (object)
|
||||
"Return non-nil if OBJECT is a sequence, nil otherwise."
|
||||
(sequencep object))
|
||||
|
||||
(cl-defgeneric seq-copy (sequence)
|
||||
"Return a shallow copy of SEQUENCE."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue