branch: externals/denote commit 4ad77f92dd6c71a701afe1f969cae54ab0cbddd3 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Document inclusion of subdirs for denote-dired-mode; update symbol of user option This is a follow-up to pull request 190 on the GitHub mirror, which added the original idea: <https://github.com/protesilaos/denote/pull/191>. Thanks to leinfink for the contribution! --- README.org | 7 +++++++ denote.el | 27 +++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index 3886ec6b10..3a09781932 100644 --- a/README.org +++ b/README.org @@ -2237,6 +2237,13 @@ the function ~denote-dired-mode-in-directories~: (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories) #+end_src +#+vindex: denote-dired-directories-include-subdirectories +The user option ~denote-dired-directories-include-subdirectories~ +specifies whether the ~denote-dired-directories~ also cover their +subdirectories. By default they do not. Set this option to ~t~ to +include subdirectories as well. [ This feature is part of +{{{development-version}}}. ] + The faces we define for this purpose are: #+vindex: denote-faces-date diff --git a/denote.el b/denote.el index e9dc910de2..23e074d24f 100644 --- a/denote.el +++ b/denote.el @@ -2805,20 +2805,23 @@ and seconds." (defcustom denote-dired-directories (list denote-directory) "List of directories where `denote-dired-mode' should apply to. For this to take effect, add `denote-dired-mode-in-directories', -to the `dired-mode-hook'." +to the `dired-mode-hook'. + +If `denote-dired-directories-include-subdirectories' is non-nil, +also apply the effect to all subdirectories of those specified in +the list." :type '(repeat directory) :package-version '(denote . "0.1.0") :link '(info-link "(denote) Fontification in Dired") :group 'denote-dired) - (defcustom denote-dired-include-subdirectories nil - "Whether to enable `denote-dired-mode' in subdirectories of `denote-dired-directories'. - -If nil, enable `denote-dired-mode' only in directories exactly matching one of `denote-dired-directories', excluding subdirectories. - -If non-nil, enable `denote-dired-mode' in `denote-dired-directories' and their subdirectories." - :group 'denote-dired - :type 'boolean) +(defcustom denote-dired-directories-include-subdirectories nil + "If non-nil `denote-dired-directories' also affects all subdirectories. +Otherwise `denote-dired-directories' works only with exact matches." + :package-version '(denote . "2.2.0") + :link '(info-link "(denote) Fontification in Dired") + :type 'boolean + :group 'denote-dired) ;; FIXME 2022-08-12: Make `denote-dired-mode' work with diredfl. This ;; may prove challenging. @@ -2873,12 +2876,12 @@ written, it is always returned as a directory." "Enable `denote-dired-mode' in `denote-dired-directories'. Add this function to `dired-mode-hook'. -If `denote-dired-include-subdirectories' is non-nil, also enable -it in all subdirectories." +If `denote-dired-directories-include-subdirectories' is non-nil, +also enable it in all subdirectories." (when-let ((dirs (denote-dired--modes-dirs-as-dirs)) ;; Also include subdirs ((or (member (file-truename default-directory) dirs) - (and denote-dired-include-subdirectories + (and denote-dired-directories-include-subdirectories (seq-some (lambda (dir) (string-prefix-p dir (file-truename default-directory)))