;; Copyright (C) 2022, Paul Horton ;; License: GPLv3 ;;; Commentary: ;; Example to illustrate the effects of declaring lexical binding in elisp. ;; ;; Compare the code in this file and its companion file "example-with-lexical-header.el". ;; Load them and examine the information displayed in buffer "*dynamic vs lexical*". (get-buffer-create "*dynamic vs lexical*") (setq sans-lexical-header/sans-defvar "global value") (defun sans-lexical-header/sans-defvar () sans-lexical-header/sans-defvar) (defvar sans-lexical-header/with-defvar "global value") (defun sans-lexical-header/with-defvar () sans-lexical-header/with-defvar) (let( (sans-lexical-header/sans-defvar "local value") (sans-lexical-header/with-defvar "local value") ) (pop-to-buffer "*dynamic vs lexical*") (goto-char (point-max)) (insert "\n# Results sans lexical binding header\n" " sans-lexical-header/sans-defvar contains \t" sans-lexical-header/sans-defvar "\n" "(sans-lexical-header/sans-defvar) returns: \t" (sans-lexical-header/sans-defvar) "\n" " sans-lexical-header/with-defvar contains \t" sans-lexical-header/with-defvar "\n" "(sans-lexical-header/with-defvar) returns: \t" (sans-lexical-header/with-defvar) "\n" ) ) ;;; example-sans-lexical-header.el ends here