branch: externals/denote-sequence
commit 307eb52c2161d8b1fecd89f90cab1fa1ceadc312
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Quote the lambda used in denote-sequence-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-sequence.el | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/denote-sequence.el b/denote-sequence.el
index 23256ca510..8ce3c3314c 100644
--- a/denote-sequence.el
+++ b/denote-sequence.el
@@ -1023,18 +1023,17 @@ For a more specialised case, see 
`denote-sequence-find-relatives-dired'."
       (t
        nil))))
   (pcase-let* ((relative-p (denote-has-single-denote-directory-p))
-               (files-fn
-                (lambda ()
-                  (let* ((files (if prefix
-                                    (denote-sequence-get-all-files-with-prefix 
prefix)
-                                  (denote-sequence-get-all-files)))
-                         (files-with-depth (if depth
-                                               
(denote-sequence-get-all-files-with-max-depth depth files)
-                                             files))
-                         (files-sorted (denote-sequence-sort-files 
files-with-depth)))
-                    (if relative-p
-                        (mapcar #'file-relative-name files-sorted)
-                      files-sorted)))))
+               (files-fn `(lambda ()
+                            (let* ((files (if ,prefix
+                                              
(denote-sequence-get-all-files-with-prefix ,prefix)
+                                            (denote-sequence-get-all-files)))
+                                   (files-with-depth (if ,depth
+                                                         
(denote-sequence-get-all-files-with-max-depth ,depth files)
+                                                       files))
+                                   (files-sorted (denote-sequence-sort-files 
files-with-depth)))
+                              (if ,relative-p
+                                  (mapcar #'file-relative-name files-sorted)
+                                files-sorted)))))
     (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