Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Last active December 19, 2015 18:49
Show Gist options
  • Save jordonbiondo/6001887 to your computer and use it in GitHub Desktop.
Save jordonbiondo/6001887 to your computer and use it in GitHub Desktop.
let vs cl-flet scope
(defvar foo 2)
(defun return-foo()
foo)
(defun just-call-return-foo()
(return-foo))
(defadvice return-foo (around change-it activate)
"This let block redefines foo in the expansion of ad-do-it"
(let ((foo 10))
ad-do-it))
(defadvice just-call-return-foo (around change-baz activate)
"This flet block has no effect on the function just-call-return-foo"
(cl-flet ((just-call-return-foo () "hi"))
ad-do-it))
(return-foo) ;; returns 10
(just-call-return-foo) ;; returns 10, hoping for "hi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment