Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cl-generic.el: lexical-let patch for method dispatch lambdas #27

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lisp/emacs-lisp/cl-generic.el
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ the specializer used will be the one returned by BODY."
,nbody))
(cons 'curried
`#'(lambda (,nm) ;Called when constructing the effective method.
(let ((,nmp (if (cl--generic-isnot-nnm-p ,nm)
#'always #'ignore)))
(lexical-let* ((,nm ,nm)
(,nmp (if (cl--generic-isnot-nnm-p ,nm)
#'always #'ignore)))
;; This `(λ (&rest x) .. (apply (λ (args) ..) x))'
;; dance is needed because we need to get the original
;; args as a list when `cl-call-next-method' is
Expand All @@ -458,8 +459,9 @@ the specializer used will be the one returned by BODY."
(setcar ds (help-add-fundoc-usage (car ds)
args)))
prebody)
(let ((,cnm (lambda (&rest args)
(apply ,nm (or args ,arglist)))))
(lexical-let ((,nmp ,nmp)
(,cnm (lambda (&rest args)
(apply ,nm (or args ,arglist)))))
;; This `apply+lambda' basically parses
;; `arglist' according to `args'.
;; A destructuring-bind would do the trick
Expand Down