mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 12:00:24 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -6,26 +6,33 @@
|
||||
;;
|
||||
;;; External frame
|
||||
|
||||
(defvar +org-capture-fn #'org-capture
|
||||
"Command to use to initiate org-capture.")
|
||||
|
||||
;;;###autoload
|
||||
(defvar +org-capture-frame-parameters
|
||||
`((name . "org-capture")
|
||||
`((name . "doom-capture")
|
||||
(width . 70)
|
||||
(height . 25)
|
||||
(transient . t)
|
||||
,(if IS-LINUX '(display . ":0")))
|
||||
,(when (and IS-LINUX (not (getenv "DISPLAY")))
|
||||
`(display . ":0"))
|
||||
,(if IS-MAC '(menu-bar-lines . 1)))
|
||||
"TODO")
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-capture-cleanup-frame-h ()
|
||||
"Closes the org-capture frame once done adding an entry."
|
||||
(when (+org-capture-frame-p)
|
||||
(when (and (+org-capture-frame-p)
|
||||
(not org-capture-is-refiling))
|
||||
(delete-frame nil t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-capture-frame-p (&rest _)
|
||||
"Return t if the current frame is an org-capture frame opened by
|
||||
`+org-capture/open-frame'."
|
||||
(and (equal "org-capture" (frame-parameter nil 'name))
|
||||
(and (equal (alist-get 'name +org-capture-frame-parameters)
|
||||
(frame-parameter nil 'name))
|
||||
(frame-parameter nil 'transient)))
|
||||
|
||||
;;;###autoload
|
||||
@@ -45,23 +52,13 @@ you're done. This can be called from an external shell script."
|
||||
(with-selected-frame frame
|
||||
(require 'org-capture)
|
||||
(condition-case ex
|
||||
(cl-letf (((symbol-function #'pop-to-buffer)
|
||||
(symbol-function #'switch-to-buffer)))
|
||||
(letf! ((#'pop-to-buffer #'switch-to-buffer))
|
||||
(switch-to-buffer (doom-fallback-buffer))
|
||||
(let ((org-capture-initial initial-input)
|
||||
org-capture-entry)
|
||||
(when (and key (not (string-empty-p key)))
|
||||
(setq org-capture-entry (org-capture-select-template key)))
|
||||
(if (or org-capture-entry
|
||||
(not (fboundp 'counsel-org-capture)))
|
||||
(org-capture)
|
||||
(unwind-protect
|
||||
(counsel-org-capture)
|
||||
(if-let (buf (cl-find-if (doom-partial #'buffer-local-value 'org-capture-mode)
|
||||
(buffer-list)))
|
||||
(with-current-buffer buf
|
||||
(add-hook 'kill-buffer-hook #'+org-capture-cleanup-frame-h nil t))
|
||||
(delete-frame frame))))))
|
||||
(funcall +org-capture-fn)))
|
||||
('error
|
||||
(message "org-capture: %s" (error-message-string ex))
|
||||
(delete-frame frame))))))
|
||||
@@ -148,16 +145,16 @@ project."
|
||||
(defun +org-capture-central-project-todo-file ()
|
||||
"TODO"
|
||||
(+org--capture-central-file
|
||||
+org-capture-todo-file (projectile-project-name)))
|
||||
+org-capture-projects-file (projectile-project-name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-capture-central-project-notes-file ()
|
||||
"TODO"
|
||||
(+org--capture-central-file
|
||||
+org-capture-notes-file (projectile-project-name)))
|
||||
+org-capture-projects-file (projectile-project-name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-capture-central-project-changelog-file ()
|
||||
"TODO"
|
||||
(+org--capture-central-file
|
||||
+org-capture-changelog-file (projectile-project-name)))
|
||||
+org-capture-projects-file (projectile-project-name)))
|
||||
|
||||
Reference in New Issue
Block a user