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

    Make the denote-directory function obsolete
    
    I have gone back and forth on this issue. Jean-Philippe Gagné Guay
    convinced me that it is better to deprecate it because this way the
    users will be more informed about what is happening.
    
    This is done in a comment and was then reminded it of it again in pull
    request 632:
    
    - 
<https://github.com/protesilaos/denote/commit/947f0be070c686f2b253498d6eb65ac2abcaee8e>.
    - <https://github.com/protesilaos/denote/pull/632>
---
 README.org |  8 --------
 denote.el  | 12 +++++++-----
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/README.org b/README.org
index eaafb1479f..372f76bddc 100644
--- a/README.org
+++ b/README.org
@@ -5099,14 +5099,6 @@ The following sections cover the specifics.
   or ~date-to-time~ .Those functions signal an error if =DATE= is a
   value they do not recognise. If =DATE= is nil, return nil.
 
-#+findex: denote-directory
-+ Function ~denote-directory~ :: Return the ~car~ of
-  ~denote-directories~. Unless this is definitely what you need, use
-  the ~denote-directories~ instead. Also see
-  ~denote-directories-get-common-root~. [ Updated as part of
-  {{{development-version}}} because the user option ~denote-directory~
-  can now also accept a list of directories. ]
-
 #+findex: denote-directories
 + Function ~denote-directories~ :: Return list of paths to the
   variable ~denote-directory~. [ Part of {{{development-version}}}. ]
diff --git a/denote.el b/denote.el
index 6d399bb682..2ce30c6658 100644
--- a/denote.el
+++ b/denote.el
@@ -1039,6 +1039,8 @@ Unless this is definitely what you need, use the 
`denote-directories'
 instead.  Also see `denote-directories-get-common-root'."
   (car (denote-directories)))
 
+(make-obsolete 'denote-directory 'denote-directories "4.2.0")
+
 (defvar denote-generate-identifier-automatically t
   "Make creation and renaming commands automatically create and identifier.
 
@@ -1506,7 +1508,7 @@ Return the absolute path to the matching file."
          ;; Some external program may use `default-directory' with the
          ;; relative file paths of the completion candidates.
          (default-directory (if single-dir-p
-                                (denote-directory)
+                                (car (denote-directories))
                               (denote-directories-get-common-root)))
          (files (denote-directory-files
                  (or denote-file-prompt-use-files-matching-regexp 
files-matching-regexp)
@@ -1941,7 +1943,7 @@ When called from Lisp, the arguments are a string, a 
symbol among
                                   (mapcar #'file-relative-name files)
                                 files)))))
     (if-let* ((directory (if relative-p ; see comment in `denote-file-prompt'
-                             (denote-directory)
+                             (car (denote-directories))
                            (denote-directories-get-common-root)))
               (files (funcall files-fn))
               (dired-name (format-message files-matching-regexp))
@@ -3367,7 +3369,7 @@ instead of that of the parameter."
                            (t "")))
          (directory (if (and directory (denote--dir-in-denote-directory-p 
directory))
                         (file-name-as-directory directory)
-                      (denote-directory)))
+                      (car (denote-directories))))
          (template (if (or (stringp template) (functionp template))
                        template
                      (or (alist-get template denote-templates) "")))
@@ -5388,7 +5390,7 @@ the generic one."
                     (denote--completion-table 'file file-names)
                     nil t nil 'denote-link-find-file-history)))
     (if (denote-has-single-denote-directory-p)
-        (expand-file-name selected (denote-directory))
+        (expand-file-name selected (car (denote-directories)))
       selected)))
 
 (define-obsolete-function-alias
@@ -6485,7 +6487,7 @@ contents, not file names.  Optional ID-ONLY has the same 
meaning as in
                     (denote--completion-table 'file file-names)
                     nil t)))
     (if (denote-has-single-denote-directory-p)
-        (expand-file-name selected (denote-directory))
+        (expand-file-name selected (car (denote-directories)))
       selected)))
 
 (defun denote-link--map-over-notes ()

Reply via email to