Minor refactors across the board

This commit is contained in:
Henrik Lissner 2020-08-20 03:43:50 -04:00
parent 995b45285c
commit 91ab02951d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 20 additions and 26 deletions

View file

@ -410,12 +410,6 @@ Made for `org-tab-first-hook' in evil-mode."
(call-interactively #'tab-to-tab-stop)
t)))
;;;###autoload
(defun +org-update-cookies-h ()
"Update statistics cookies/todo statistics in headlines."
(when (and buffer-file-name (file-exists-p buffer-file-name))
(org-update-parent-todo-statistics)))
;;;###autoload
(defun +org-yas-expand-maybe-h ()
"Expand a yasnippet snippet, if trigger exists at point or region is active.
@ -490,5 +484,5 @@ All my (performant) foldings needs are met between this and `org-show-subtree'
(defun +org-enable-auto-update-cookies-h ()
"Update statistics cookies when saving or exiting insert mode (`evil-mode')."
(when (bound-and-true-p evil-local-mode)
(add-hook 'evil-insert-state-exit-hook #'+org-update-cookies-h nil t))
(add-hook 'before-save-hook #'+org-update-cookies-h nil t))
(add-hook 'evil-insert-state-exit-hook #'org-update-parent-todo-statistics nil t))
(add-hook 'before-save-hook #'org-update-parent-todo-statistics nil t))

View file

@ -13,12 +13,12 @@
(defun +org-journal-p ()
(when-let (buffer-file-name (buffer-file-name (buffer-base-buffer)))
(if (or (featurep 'org-journal)
(and (file-in-directory-p
buffer-file-name (expand-file-name org-journal-dir org-directory))
(delq! '+org-journal-p magic-mode-alist 'assq)
(require 'org-journal nil t)))
(org-journal-is-journal))))
(when (or (featurep 'org-journal)
(and (file-in-directory-p
buffer-file-name (expand-file-name org-journal-dir org-directory))
(require 'org-journal nil t)))
(delq! '+org-journal-p magic-mode-alist 'assq)
(org-journal-is-journal))))
;; `org-journal-dir' defaults to "~/Documents/journal/", which is an odd
;; default, so we change it to {org-directory}/journal (we expand it after

View file

@ -354,18 +354,18 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
;;; `+modeline-buffer-identification'
(def-modeline-var! +modeline-buffer-identification ; slightly more informative buffer id
'((:eval
(propertize
(let ((buffer-file-name (buffer-file-name (buffer-base-buffer))))
(or (when (and buffer-file-name (not (file-remote-p buffer-file-name)))
(if-let (project (doom-project-root buffer-file-name))
(let ((filename (or buffer-file-truename (file-truename buffer-file-name))))
(file-relative-name filename (concat project "..")))))
"%b"))
'face (cond ((buffer-modified-p)
'(error bold mode-line-buffer-id))
((+modeline-active)
'mode-line-buffer-id))
'help-echo buffer-file-name))
(let ((file-name (buffer-file-name (buffer-base-buffer))))
(propertize
(or (when (and file-name (not (file-remote-p file-name)))
(when-let (project (doom-project-root file-name))
(file-relative-name (or buffer-file-truename (file-truename file-name))
(concat project ".."))))
"%b")
'face (cond ((buffer-modified-p)
'(error bold mode-line-buffer-id))
((+modeline-active)
'mode-line-buffer-id))
'help-echo file-name)))
(buffer-read-only (:propertize " RO" face warning))))