footer 局部变量不可见


(defun read-lines (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (split-string (buffer-string) "\n" t)))


(let* (
       (footers (read-lines "~/.emacs.d/learning/emacs/dairy/tipoftheday.org"))
       (footer (nth (random (length footers)) footers ))
       (keymap (let ((map (make-sparse-keymap)))
                 (define-key map [down-mouse-1]
                   (lambda (&rest _)
                     (interactive)
                     (message footer)))
                 map))
       )
  (add-text-properties 0 (length footer) `(keymap ,keymap mouse-face highlight) footer)
  (setq dashboard-footer-messages (list footer)))

显示报错

Symbol’s value as variable is void: footer

没开 lexical-binding: t

在文件第一行加入 ;; -*- lexical-binding: t -*-