Mark +org-dir obsolete (use org-directory instead)
I prefer not to invent new variables when they aren't strictly necessary. org-directory is one such variable (although the other path variables are still necessary).
This commit is contained in:
parent
db8b4091dd
commit
6693db48af
8 changed files with 30 additions and 33 deletions
|
@ -13,7 +13,7 @@
|
||||||
(elfeed-db-compact)
|
(elfeed-db-compact)
|
||||||
(doom-kill-matching-buffers "^\\*elfeed")
|
(doom-kill-matching-buffers "^\\*elfeed")
|
||||||
(dolist (file +rss-elfeed-files)
|
(dolist (file +rss-elfeed-files)
|
||||||
(when-let* ((buf (get-file-buffer (expand-file-name file +org-dir))))
|
(when-let* ((buf (get-file-buffer (expand-file-name file org-directory))))
|
||||||
(kill-buffer buf))))
|
(kill-buffer buf))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
;; don't care for the UI you can invoke elfeed directly with `elfeed'.
|
;; don't care for the UI you can invoke elfeed directly with `elfeed'.
|
||||||
|
|
||||||
(defvar +rss-elfeed-files (list "elfeed.org")
|
(defvar +rss-elfeed-files (list "elfeed.org")
|
||||||
"Where to look for elfeed.org files, relative to `+org-dir'. Can be absolute
|
"Where to look for elfeed.org files, relative to `org-directory'. Can be
|
||||||
paths.")
|
absolute paths.")
|
||||||
|
|
||||||
(defvar +rss-split-direction 'below
|
(defvar +rss-split-direction 'below
|
||||||
"What direction to pop up the entry buffer in elfeed.")
|
"What direction to pop up the entry buffer in elfeed.")
|
||||||
|
@ -65,6 +65,6 @@ paths.")
|
||||||
:after elfeed
|
:after elfeed
|
||||||
:config
|
:config
|
||||||
(setq rmh-elfeed-org-files
|
(setq rmh-elfeed-org-files
|
||||||
(let ((default-directory +org-dir))
|
(let ((default-directory org-directory))
|
||||||
(mapcar #'expand-file-name +rss-elfeed-files)))
|
(mapcar #'expand-file-name +rss-elfeed-files)))
|
||||||
(elfeed-org))
|
(elfeed-org))
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +default/browse-notes ()
|
(defun +default/browse-notes ()
|
||||||
(interactive) (doom-project-browse +org-dir))
|
(interactive) (doom-project-browse org-directory))
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +default/find-in-notes ()
|
(defun +default/find-in-notes ()
|
||||||
(interactive) (doom-project-find-file +org-dir))
|
(interactive) (doom-project-find-file org-directory))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +default/browse-snippets ()
|
(defun +default/browse-snippets ()
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
;; files with metadata I don't want. So I wrote my own, which:
|
;; files with metadata I don't want. So I wrote my own, which:
|
||||||
;;
|
;;
|
||||||
;; + Places attachments in a centralized location (`+org-attach-dir' in
|
;; + Places attachments in a centralized location (`+org-attach-dir' in
|
||||||
;; `+org-dir'), using an attach:* link abbreviation.
|
;; `org-directory'), using an attach:* link abbreviation.
|
||||||
;; + Use `+org-attach/sync' to index all attachments in `+org-dir' that use the
|
;; + Use `+org-attach/sync' to index all attachments in `org-directory' that use
|
||||||
;; attach:* abbreviation and delete orphaned ones that are no longer
|
;; the attach:* abbreviation and delete orphaned ones that are no longer
|
||||||
;; referenced.
|
;; referenced.
|
||||||
;; + Adds drag-and-drop support for images (with inline image preview)
|
;; + Adds drag-and-drop support for images (with inline image preview)
|
||||||
;; + Adds drag-and-drop support for media files (pdfs, zips, etc) with a
|
;; + Adds drag-and-drop support for media files (pdfs, zips, etc) with a
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
;; + `+org-attach/sync'
|
;; + `+org-attach/sync'
|
||||||
|
|
||||||
(defvar +org-attach-dir ".attach/"
|
(defvar +org-attach-dir ".attach/"
|
||||||
"Where to store attachments relative to `+org-dir'.")
|
"Where to store attachments relative to `org-directory'.")
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -55,14 +55,14 @@
|
||||||
(advice-add #'org-download-insert-link :override #'+org-attach*insert-link)
|
(advice-add #'org-download-insert-link :override #'+org-attach*insert-link)
|
||||||
|
|
||||||
(defun +org-attach*download-subdir ()
|
(defun +org-attach*download-subdir ()
|
||||||
(when (file-in-directory-p buffer-file-name +org-dir)
|
(when (file-in-directory-p buffer-file-name org-directory)
|
||||||
(file-relative-name buffer-file-name +org-dir)))
|
(file-relative-name buffer-file-name org-directory)))
|
||||||
|
|
||||||
(defun +org-attach*download-fullname (path)
|
(defun +org-attach*download-fullname (path)
|
||||||
"Write PATH relative to current file."
|
"Write PATH relative to current file."
|
||||||
(let ((dir (or (if buffer-file-name (file-name-directory buffer-file-name))
|
(let ((dir (or (if buffer-file-name (file-name-directory buffer-file-name))
|
||||||
default-directory)))
|
default-directory)))
|
||||||
(if (file-in-directory-p dir +org-dir)
|
(if (file-in-directory-p dir org-directory)
|
||||||
(file-relative-name path dir)
|
(file-relative-name path dir)
|
||||||
path)))
|
path)))
|
||||||
(advice-add #'org-download--dir-2 :override #'ignore)
|
(advice-add #'org-download--dir-2 :override #'ignore)
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun +org|init-attach ()
|
(defun +org|init-attach ()
|
||||||
(setq org-attach-directory (expand-file-name +org-attach-dir +org-dir))
|
(setq org-attach-directory (expand-file-name +org-attach-dir org-directory))
|
||||||
|
|
||||||
;; A shorter link to attachments
|
;; A shorter link to attachments
|
||||||
(push (cons "attach" (abbreviate-file-name org-attach-directory)) org-link-abbrev-alist)
|
(push (cons "attach" (abbreviate-file-name org-attach-directory)) org-link-abbrev-alist)
|
||||||
|
|
|
@ -29,10 +29,8 @@
|
||||||
|
|
||||||
|
|
||||||
(defun +org|init-capture ()
|
(defun +org|init-capture ()
|
||||||
(defvaralias 'org-default-notes-file '+org-default-notes-file)
|
(setq org-default-notes-file (expand-file-name +org-default-notes-file org-directory)
|
||||||
|
+org-default-todo-file (expand-file-name +org-default-todo-file org-directory))
|
||||||
(setq org-default-notes-file (expand-file-name +org-default-notes-file +org-dir)
|
|
||||||
+org-default-todo-file (expand-file-name +org-default-todo-file +org-dir))
|
|
||||||
|
|
||||||
(add-hook 'org-capture-after-finalize-hook #'+org-capture|cleanup-frame)
|
(add-hook 'org-capture-after-finalize-hook #'+org-capture|cleanup-frame)
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,17 @@
|
||||||
(when (executable-find "pandoc")
|
(when (executable-find "pandoc")
|
||||||
(require 'ox-pandoc))
|
(require 'ox-pandoc))
|
||||||
|
|
||||||
;; Export to a central location by default or if target isn't in `+org-dir'.
|
;; Export to a central location by default or if target isn't in `org-directory'.
|
||||||
(setq org-export-directory (expand-file-name ".export" +org-dir))
|
(setq org-export-directory (expand-file-name ".export" org-directory))
|
||||||
(unless (file-directory-p org-export-directory)
|
(unless (file-directory-p org-export-directory)
|
||||||
(make-directory org-export-directory t))
|
(make-directory org-export-directory t))
|
||||||
|
|
||||||
(defun +org*export-output-file-name (args)
|
(defun +org*export-output-file-name (args)
|
||||||
"Return a centralized export location unless one is provided or the current
|
"Return a centralized export location unless one is provided or the current
|
||||||
file isn't in `+org-dir'."
|
file isn't in `org-directory'."
|
||||||
(when (and (not (nth 2 args))
|
(when (and (not (nth 2 args))
|
||||||
buffer-file-name
|
buffer-file-name
|
||||||
(file-in-directory-p (file-truename buffer-file-name) (file-truename +org-dir)))
|
(file-in-directory-p (file-truename buffer-file-name) (file-truename org-directory)))
|
||||||
(setq args (append args (list org-export-directory))))
|
(setq args (append args (list org-export-directory))))
|
||||||
args)
|
args)
|
||||||
(advice-add #'org-export-output-file-name :filter-args #'+org*export-output-file-name))
|
(advice-add #'org-export-output-file-name :filter-args #'+org*export-output-file-name))
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defvar +org-attachments nil
|
(defvar +org-attachments nil
|
||||||
"A list of all indexed attachments in `+org-dir'.")
|
"A list of all indexed attachments in `org-directory'.")
|
||||||
|
|
||||||
(defvar +org-attachments-files nil
|
(defvar +org-attachments-files nil
|
||||||
"A list of all attachments in `org-attach-directory'.")
|
"A list of all attachments in `org-attach-directory'.")
|
||||||
|
@ -42,7 +42,7 @@ and END (defaults to `point-min' and `point-max')."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +org-attach/sync (arg)
|
(defun +org-attach/sync (arg)
|
||||||
"Reindex all attachments in `+org-dir' and delete orphaned attachments in
|
"Reindex all attachments in `org-directory' and delete orphaned attachments in
|
||||||
`org-attach-directory'. If ARG (universal arg), conduct a dry run."
|
`org-attach-directory'. If ARG (universal arg), conduct a dry run."
|
||||||
(declare (interactive-only t))
|
(declare (interactive-only t))
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
|
@ -50,7 +50,7 @@ and END (defaults to `point-min' and `point-max')."
|
||||||
(setq +org-attachments-files (directory-files org-attach-directory nil "^[^.]" t))
|
(setq +org-attachments-files (directory-files org-attach-directory nil "^[^.]" t))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(delay-mode-hooks (org-mode))
|
(delay-mode-hooks (org-mode))
|
||||||
(dolist (org-file (directory-files-recursively +org-dir "\\.org$"))
|
(dolist (org-file (directory-files-recursively org-directory "\\.org$"))
|
||||||
(insert-file-contents-literally org-file))
|
(insert-file-contents-literally org-file))
|
||||||
(setq +org-attachments (+org-attachments--list)))
|
(setq +org-attachments (+org-attachments--list)))
|
||||||
;; clean up
|
;; clean up
|
||||||
|
@ -132,8 +132,8 @@ an file icon produced by `+org-attach--icon')."
|
||||||
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))
|
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))
|
||||||
(cond ((file-in-directory-p filename org-attach-directory)
|
(cond ((file-in-directory-p filename org-attach-directory)
|
||||||
(format "[[attach:%s]]" (file-relative-name filename org-attach-directory)))
|
(format "[[attach:%s]]" (file-relative-name filename org-attach-directory)))
|
||||||
((file-in-directory-p filename +org-dir)
|
((file-in-directory-p filename org-directory)
|
||||||
(format org-download-link-format (file-relative-name filename +org-dir)))
|
(format org-download-link-format (file-relative-name filename org-directory)))
|
||||||
(t
|
(t
|
||||||
(format org-download-link-format filename)))))
|
(format org-download-link-format filename)))))
|
||||||
(org-display-inline-images))
|
(org-display-inline-images))
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
;;; lang/org/config.el -*- lexical-binding: t; -*-
|
;;; lang/org/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +org-dir (expand-file-name "~/org/")
|
;; FIXME deprecated
|
||||||
"The directory where org files are kept.")
|
(define-obsolete-variable-alias '+org-dir 'org-directory "2.1.0")
|
||||||
|
|
||||||
|
(defvar org-directory "~/org/")
|
||||||
|
|
||||||
;; Sub-modules
|
;; Sub-modules
|
||||||
(if (featurep! +attach) (load! "+attach"))
|
(if (featurep! +attach) (load! "+attach"))
|
||||||
|
@ -61,9 +63,6 @@
|
||||||
+org|unfold-to-2nd-level-or-point
|
+org|unfold-to-2nd-level-or-point
|
||||||
+org|show-paren-mode-compatibility))
|
+org|show-paren-mode-compatibility))
|
||||||
|
|
||||||
(after! org
|
|
||||||
(defvaralias 'org-directory '+org-dir))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; `org-mode' hooks
|
;; `org-mode' hooks
|
||||||
|
@ -240,7 +239,7 @@ unfold to point on startup."
|
||||||
'org-link
|
'org-link
|
||||||
'error)))))
|
'error)))))
|
||||||
|
|
||||||
(def-org-file-link! "org" +org-dir)
|
(def-org-file-link! "org" org-directory)
|
||||||
(def-org-file-link! "doom" doom-emacs-dir)
|
(def-org-file-link! "doom" doom-emacs-dir)
|
||||||
(def-org-file-link! "doom-docs" doom-docs-dir)
|
(def-org-file-link! "doom-docs" doom-docs-dir)
|
||||||
(def-org-file-link! "doom-modules" doom-modules-dir)
|
(def-org-file-link! "doom-modules" doom-modules-dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue