branch: externals/denote
commit 9f5a16f62584e06ed31e0f41ce2e923ff4a81b30
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Tweak how denote--get-common-root-directory checks absolute paths to also 
work on Windows
    
    I do not have a Windows machine to test this, though it seems
    reasonable. I am doing this in response to issue 682 by Pratik-Mishra-497:
    <https://github.com/protesilaos/denote/issues/682>.
---
 README.org           | 6 +++---
 denote.el            | 9 +++++----
 tests/denote-test.el | 1 +
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/README.org b/README.org
index acfbe12b9a..e66b73962d 100644
--- a/README.org
+++ b/README.org
@@ -6961,9 +6961,9 @@ Denote is meant to be a collective effort.  Every bit of 
help matters.
   Liu, Ypot, atanasj, azegas, babusri, bdillahu, coherentstate,
   doolio, duli, drcxd, elge70, elliottw, fingerknight, hpgisler,
   hyperfocus1337,johkneisl, jtpavlock, juh, leafarbelm,
-  mentalisttraceur, mjkalyan, oatmealm, pRot0ta1p, rbenit68,
-  relict007, sarcom-sar, sienic, skissue, sundar bp, wuzhihao,
-  yetanotherfossman, zadca123
+  mentalisttraceur, mjkalyan, oatmealm, Pratik-Mishra-4979, pRot0ta1p,
+  rbenit68, relict007, sarcom-sar, sienic, skissue, sundar bp,
+  wuzhihao, yetanotherfossman, zadca123
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.
diff --git a/denote.el b/denote.el
index bf4be15246..333713b6d3 100644
--- a/denote.el
+++ b/denote.el
@@ -985,11 +985,12 @@ to override what this function returns."
   "Return common root directory among DIRECTORIES.
 DIRECTORIES are absolute file system paths."
   (cond
-   ;; FIXME 2026-01-14: The `file-name-absolute-p' actually returns
-   ;; non-nil for ~/PATH.  This will not work here.  Does the prefix
-   ;; check work on all operating systems?  Linux is fine.
    ((or (null directories)
-        (not (seq-every-p (lambda (d) (string-prefix-p "/" d)) directories)))
+        (not (seq-every-p
+              (lambda (d)
+                (and (file-name-absolute-p d)
+                     (not (string-prefix-p "~" d))))
+              directories)))
     (error "DIRECTORIES must be a list of absolute filesystem paths, not `%S'" 
directories))
    ((null (cdr directories))
     (car directories))
diff --git a/tests/denote-test.el b/tests/denote-test.el
index 58153b1ab9..6191a30eed 100644
--- a/tests/denote-test.el
+++ b/tests/denote-test.el
@@ -531,6 +531,7 @@ does not involve the time zone."
   (should-error (denote--date-convert '(26454 45206 461174 657000) 
:not-valid-type))
   (should-error (denote--date-convert nil :not-valid-type)))
 
+;; TODO 2026-02-23: Add support for Windows paths.
 (ert-deftest dt-denote--get-common-root-directory ()
   "Test that `denote--get-common-root-directory' returns the right path."
   (should (string=

Reply via email to