branch: externals/denote
commit 693c43ede816d76268814b42405e3cab6903d8d3
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Quote the lambda used in denote-sort-dired
    
    Because of lexical-binding, the return value was fixed. But if a user
    copies the code into the scratch buffer, renames the function, and
    evaluates it, the lambda will be subject to dynamic scoping. This way,
    we protect users from a faulty revert-buffer-function.
---
 denote.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/denote.el b/denote.el
index afe29114cb..7b13ec92dd 100644
--- a/denote.el
+++ b/denote.el
@@ -1898,11 +1898,11 @@ When called from Lisp, the arguments are a string, a 
symbol among
   (interactive (append (list (denote-files-matching-regexp-prompt)) 
(denote-sort-dired--prompts)))
   (pcase-let* ((`(,component . ,reverse-sort) 
(denote-sort-dired--get-sort-parameters sort-by-component reverse))
                (relative-p (denote-has-single-denote-directory-p))
-               (files-fn (lambda ()
-                           (let ((files (denote-sort-get-directory-files 
files-matching-regexp component reverse-sort nil exclude-regexp)))
-                             (if relative-p
-                                 (mapcar #'file-relative-name files)
-                               files)))))
+               (files-fn `(lambda ()
+                            (let ((files (denote-sort-get-directory-files 
,files-matching-regexp ',component ,reverse-sort nil ,exclude-regexp)))
+                              (if ,relative-p
+                                  (mapcar #'file-relative-name files)
+                                files)))))
     (if-let* ((directory (if relative-p ; see comment in `denote-file-prompt'
                              (car (denote-directories))
                            (denote-sort-dired--find-common-directory 
(denote-directories))))

Reply via email to