mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix(lib): doom-file-cookie: what argument-less cookies return
Used to be that a ;;;###COOKIE with no argument would return NULL-VALUE. No more, it will now return `t`. Also corrects the docstring to properly reflect what this does.
This commit is contained in:
@ -144,8 +144,7 @@ MATCH is a string regexp. Only entries that match it will be included."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-file-cookie (file &optional cookie null-value)
|
(defun doom-file-cookie (file &optional cookie null-value)
|
||||||
"Returns the evaluated result of FORM in a ;;;###COOKIE FORM at the top of
|
"Returns the quoted FORM in a ;;;###COOKIE FORM at the top of FILE.
|
||||||
FILE.
|
|
||||||
|
|
||||||
If COOKIE doesn't exist, or cookie isn't within the first 256 bytes of FILE,
|
If COOKIE doesn't exist, or cookie isn't within the first 256 bytes of FILE,
|
||||||
return NULL-VALUE."
|
return NULL-VALUE."
|
||||||
@ -155,10 +154,12 @@ return NULL-VALUE."
|
|||||||
(error "%S is unreadable" file))
|
(error "%S is unreadable" file))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents file nil 0 256)
|
(insert-file-contents file nil 0 256)
|
||||||
(if (re-search-forward (format "^;;;###%s " (regexp-quote (or cookie "if")))
|
(if (not (re-search-forward (format "^;;;###%s" (regexp-quote (or cookie "if")))
|
||||||
nil t)
|
nil t))
|
||||||
(sexp-at-point)
|
null-value
|
||||||
null-value)))
|
(skip-chars-forward " \t" (pos-eol))
|
||||||
|
(or (eolp)
|
||||||
|
(read (current-buffer))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-file-cookie-p (file &optional cookie null-value)
|
(defun doom-file-cookie-p (file &optional cookie null-value)
|
||||||
|
Reference in New Issue
Block a user