Move lang/org => org/*
Since lang/org has grown (and is expected to grow much, much more), it has been given its own module category. Concerns #129, #138
This commit is contained in:
parent
576a91b66c
commit
d2d4166b42
31 changed files with 774 additions and 721 deletions
10
modules/org/org-capture/autoload/evil.el
Normal file
10
modules/org/org-capture/autoload/evil.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
;;; org/org-capture/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload (autoload '+org-capture:dwim "org/org-capture/autoload/evil" nil t)
|
||||
(evil-define-operator +org-capture:dwim (&optional beg end)
|
||||
"Evil ex interface to `+org-capture/dwim'."
|
||||
:move-point nil :type inclusive
|
||||
(interactive "<r>")
|
||||
(+org-capture/dwim
|
||||
(unless (or (evil-normal-state-p) (evil-insert-state-p))
|
||||
(buffer-substring beg end))))
|
17
modules/org/org-capture/autoload/org-capture.el
Normal file
17
modules/org/org-capture/autoload/org-capture.el
Normal file
|
@ -0,0 +1,17 @@
|
|||
;;; org/org-capture/autoload/org-capture.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-capture/dwim (&optional string key)
|
||||
"Sends STRING, the current selection or prompted input to `org-capture'.
|
||||
|
||||
Uses the capture template specified by KEY. Otherwise, prompts you for one."
|
||||
(interactive)
|
||||
(let ((key (or key "n")))
|
||||
(if-let (string (cond ((not (equal string ""))
|
||||
string)
|
||||
((region-active-p)
|
||||
(buffer-substring-no-properties
|
||||
(region-beginning)
|
||||
(region-end)))))
|
||||
(org-capture-string string key)
|
||||
(org-capture nil key))))
|
61
modules/org/org-capture/config.el
Normal file
61
modules/org/org-capture/config.el
Normal file
|
@ -0,0 +1,61 @@
|
|||
;;; org/org-capture/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(add-hook 'org-load-hook #'+org-capture|init t)
|
||||
|
||||
;; Sets up two `org-capture' workflows that I like:
|
||||
;;
|
||||
;; 1. The traditional way: invoking `org-capture' directly (or through a
|
||||
;; command, like :org).
|
||||
;;
|
||||
;; 2. Through a org-capture popup frame that is invoked from outside Emacs (the
|
||||
;; script is in ~/.emacs.d/bin). This lets me open an org-capture box
|
||||
;; anywhere I can call org-capture (whether or not Emacs is open/running),
|
||||
;; like, say, from qutebrowser, vimperator, dmenu or a global keybinding.
|
||||
|
||||
(defun +org-capture|init ()
|
||||
"Set up a sane `org-capture' workflow."
|
||||
(setq org-default-notes-file (concat +org-dir "notes.org")
|
||||
;; FIXME This is incomplete!
|
||||
org-capture-templates
|
||||
'(;; TODO: New Task (todo)
|
||||
;; TODO: New vocabulary word
|
||||
|
||||
("c" "Changelog" entry
|
||||
(file+headline (expand-file-name "CHANGELOG.org" (doom/project-root)) "Unreleased")
|
||||
"* %?")
|
||||
|
||||
;; ("p" "Project Notes" entry
|
||||
;; (file+headline org-default-notes-file "Inbox")
|
||||
;; "* %u %?\n%i" :prepend t)
|
||||
|
||||
;; ("m" "Major-mode Notes" entry
|
||||
;; (file+headline org-default-notes-file "Inbox")
|
||||
;; "* %u %?\n%i" :prepend t)
|
||||
|
||||
("n" "Notes" entry
|
||||
(file+headline (concat +org-dir "notes.org") "Inbox")
|
||||
"* %u %?\n%i" :prepend t)
|
||||
|
||||
;; ("v" "Vocab" entry
|
||||
;; (file+headline (concat org-directory "topics/vocab.org") "Unsorted")
|
||||
;; "** %i%?\n")
|
||||
))
|
||||
|
||||
;; Allows the Emacs mini-frame (opened from an external shell script to run
|
||||
;; and clean up properly) if the frame is named "org-capture".
|
||||
(require 'org-capture)
|
||||
(require 'org-protocol)
|
||||
(defun +org-capture*init (&rest _)
|
||||
"Makes sure the org-capture window is the only window in the frame."
|
||||
(when (equal "org-capture" (frame-parameter nil 'name))
|
||||
(setq mode-line-format nil)
|
||||
(delete-other-windows)))
|
||||
(advice-add #'org-capture :after #'+org-capture*init)
|
||||
|
||||
(defun +org-capture|finalize ()
|
||||
"Closes the frame once org-capture is done."
|
||||
(when (equal "org-capture" (frame-parameter nil 'name))
|
||||
(when (and (featurep 'persp-mode) persp-mode)
|
||||
(+workspace/delete (+workspace-current-name)))
|
||||
(delete-frame)))
|
||||
(add-hook 'org-capture-after-finalize-hook #'+org-capture|finalize))
|
Loading…
Add table
Add a link
Reference in a new issue