Adding tfc posts capture template and some other tweaks

This commit is contained in:
Chris Cochrun 2021-02-23 05:49:33 -06:00
parent 4787fccfa9
commit cfd47f6ede
3 changed files with 123 additions and 55 deletions

View file

@ -108,6 +108,10 @@ Also, real quick let's make sure that ~<escape>~ works as the same as ~<C-g>~
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
#+end_src #+end_src
Let's also turn on =recentf-mode=.
#+begin_src emacs-lisp
(recentf-mode +1)
#+end_src
** Let's bootstrap straight.el ** Let's bootstrap straight.el
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar bootstrap-version) (defvar bootstrap-version)
@ -166,6 +170,13 @@ Also, real quick let's make sure that ~<escape>~ works as the same as ~<C-g>~
(smartparens-global-mode +1)) (smartparens-global-mode +1))
#+end_src #+end_src
#+begin_src emacs-lisp
(use-package aggressive-indent
:defer 1
:config
(global-aggressive-indent-mode +1))
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package adaptive-wrap (use-package adaptive-wrap
:defer t) :defer t)
@ -255,6 +266,7 @@ This evil-collection package includes a lot of other evil based things.
"bi" '(ibuffer :which-key "ibuffer") "bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme") "tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file") "ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file") "fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save") "fs" '(save-buffer :which-key "save")
"hf" '(helpful-function :which-key "describe-function") "hf" '(helpful-function :which-key "describe-function")
@ -316,8 +328,10 @@ I prefer selectrum over Ivy or Helm for completions. It is using the basic compl
:init :init
(selectrum-mode +1) (selectrum-mode +1)
:config :config
(general-define-key (setq selectrum-max-window-height 10)
:keymaps 'selectrum-minibuffer-map (add-hook 'selectrum-mode-hook 'selectrum-exhibit)
:general
('selectrum-minibuffer-map
"C-j" 'selectrum-next-candidate "C-j" 'selectrum-next-candidate
"C-k" 'selectrum-previous-candidate "C-k" 'selectrum-previous-candidate
"C-S-j" 'selectrum-goto-end "C-S-j" 'selectrum-goto-end
@ -460,7 +474,6 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded.
#+end_src #+end_src
** File Management ** File Management
*** Dired *** Dired
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package dired (use-package dired
@ -473,6 +486,15 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded.
"q" 'kill-this-buffer)) "q" 'kill-this-buffer))
#+end_src #+end_src
We need a function to copy the full filename to kill-ring
#+begin_src emacs-lisp
(defun chris/dired-yank-filename ()
"Get the full filename from file at point and put into kill-ring"
(interactive)
(let* ((file (dired-get-filename)))
(clipboard-kill-ring-save nil nil file)))
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package all-the-icons-dired (use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode)) :hook (dired-mode . all-the-icons-dired-mode))
@ -501,6 +523,7 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded.
Let's start by creating a self contained function of what I'd like started on every org buffer. Let's start by creating a self contained function of what I'd like started on every org buffer.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun chris/org-mode-setup () (defun chris/org-mode-setup ()
(interactive)
(org-indent-mode +1) (org-indent-mode +1)
(toc-org-mode +1) (toc-org-mode +1)
(olivetti-mode +1) (olivetti-mode +1)
@ -514,16 +537,15 @@ Part of this config includes some special capture templates for my work as a you
(use-package org (use-package org
:config :config
(setq org-startup-indented t (setq org-startup-indented t
org-edit-src-content-indentation 0 org-edit-src-content-indentation 0
org-agenda-sticky t) org-agenda-sticky t)
(add-hook 'org-mode-hook 'chris/org-mode-setup) (add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages (org-babel-do-load-languages 'org-babel-load-languages
'org-babel-load-languages '((emacs-lisp . t)
'((emacs-lisp . t) (python . t)
(python . t) (shell . t)))
(shell . t)))
(require 'org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
@ -547,6 +569,11 @@ Part of this config includes some special capture templates for my work as a you
:prepend nil :prepend nil
:jump-to-captured t :jump-to-captured t
:empty-lines 1) :empty-lines 1)
("P" "TFC Posts" entry
(file+headline "/home/chris/org/nvtfc_social_media.org" "Posts")
(file ".templates/posts.org")
:prepend t
:jump-to-captured t)
("r" "Templates for projects") ("r" "Templates for projects")
("rt" "Project-local todo" entry ("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox") (file+headline +org-capture-project-todo-file "Inbox")
@ -555,7 +582,7 @@ Part of this config includes some special capture templates for my work as a you
(file+headline +org-capture-project-notes-file "Inbox") (file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry ("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased") (file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects") ("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file ("ot" "Project todo" entry #'+org-capture-central-project-todo-file
@ -564,7 +591,7 @@ Part of this config includes some special capture templates for my work as a you
"* %U %?\n %i\n %a" :heading "Notes" :prepend t) "* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t)) "* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t) org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4) (setq org-imenu-depth 4)
@ -579,12 +606,24 @@ Part of this config includes some special capture templates for my work as a you
(setq org-agenda-files (setq org-agenda-files
'("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) '("/home/chris/org/DMPREADME.org"
"/home/chris/org/DMPTODO.org"
"/home/chris/org/inbox.org"
"/home/chris/org/notes.org"
"/home/chris/org/repetition.org"
"/home/chris/org/tasks.org"
"/home/chris/org/tfc_plans.org"
"/home/chris/org/ministry_team.org"
"/home/chris/org/todo.org"
"/home/chris/org/newsletter.org"))
(setq org-id-method 'ts) (setq org-id-method 'ts)
(defun chris/org-columns-view () (defun chris/org-columns-view ()
"Turn on org-columns overlay and turn off olivetti-mode" "Turn on org-columns overlay and turn off olivetti-mode"
(interactive) (interactive)
(goto-char (point-min))
(org-content)
(org-columns) (org-columns)
(olivetti-mode -1)) (olivetti-mode -1))
@ -592,30 +631,25 @@ Part of this config includes some special capture templates for my work as a you
"Remove the org-columns overlay and turn on olivetti-mode" "Remove the org-columns overlay and turn on olivetti-mode"
(interactive) (interactive)
(org-columns-quit) (org-columns-quit)
(visual-line-mode +1)
(olivetti-mode +1)) (olivetti-mode +1))
(defun chris/org-toggle-todo-and-mark-time () (add-hook 'org-agenda-finalize-hook 'evil-normal-state)
"Mark the time of finishing task and mark it as done."
(interactive)
(save-excursion
(org-back-to-heading t) ;; Make sure command works even if point is
;; below target heading
(cond ((looking-at "\*+ TODO")
(org-todo "DONE"))
((looking-at "\*+ DONE")
(org-todo "TODO"))
(t (message "Can only toggle between TODO and DONE.")))))
:general :general
(chris/leader-keys "o a" 'org-agenda (chris/leader-keys
"o a" 'org-agenda
"c" 'org-capture "c" 'org-capture
"so" 'consult-imenu) "so" 'consult-imenu)
('normal org-agenda-mode-map ('normal org-agenda-mode-map
"q" 'org-agenda-quit) "q" 'org-agenda-quit
"r" 'org-agenda-redo)
('normal org-columns-map ('normal org-columns-map
"j" 'outline-next-heading "j" 'outline-next-heading
"h" 'outline-previous-heading) "h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
('normal org-mode-map ('normal org-mode-map
"RET" 'chris/org-dwim-at-point)) "RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
#+end_src #+end_src
We need to create a lesson capture function to find our lesson files differently each time we run our TFC plan capture. This is the most unique part of my capture template. This function uses =org-roam-find-file= to pick the lesson file that I need to add my lesson plan to. This way the lesson itself is created before the plan. We need to create a lesson capture function to find our lesson files differently each time we run our TFC plan capture. This is the most unique part of my capture template. This function uses =org-roam-find-file= to pick the lesson file that I need to add my lesson plan to. This way the lesson itself is created before the plan.
@ -650,6 +684,7 @@ We also need to add =evil-org= to make better keybindings.
(use-package evil-org (use-package evil-org
:after org) :after org)
#+end_src #+end_src
*** Org-Super-Agenda *** Org-Super-Agenda
Super Agenda gives me a really nice way of making the agenda view look a lot better with some better information included. Super Agenda gives me a really nice way of making the agenda view look a lot better with some better information included.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -672,6 +707,7 @@ Super Agenda gives me a really nice way of making the agenda view look a lot bet
(org-super-agenda-mode) (org-super-agenda-mode)
(setq org-super-agenda-header-map nil)) (setq org-super-agenda-header-map nil))
#+end_src #+end_src
*** Org-Roam *** Org-Roam
Here we are going to add org-roam. This is a note-takers paradise by adding an automatic backlinking function. Here we are going to add org-roam. This is a note-takers paradise by adding an automatic backlinking function.
@ -736,12 +772,14 @@ In order to use it, I need to go to http://localhost:8080
(add-hook 'org-roam-mode-hook org-roam-server-mode t) (add-hook 'org-roam-mode-hook org-roam-server-mode t)
#+END_SRC #+END_SRC
*** Org-Superstar *** Org-Superstar
Org-Superstar makes the stars at the beginning of the line in =org-mode= a lot prettier.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-superstar (use-package org-superstar
:after org :after org
:config :config
(org-superstar-mode +1) (org-superstar-mode +1)
(setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))) (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))
(add-hook 'org-mode-hook 'org-superstar-mode))
#+end_src #+end_src
*** Org DWIM *** Org DWIM
I've stolen most of this code from Doom Emacs but we want to create a dwim-at-point function for Org-Mode that will fit under the =RET= key. This allows us to do a bunch of different functions depending on the context of point. I've stolen most of this code from Doom Emacs but we want to create a dwim-at-point function for Org-Mode that will fit under the =RET= key. This allows us to do a bunch of different functions depending on the context of point.

View file

@ -10,3 +10,4 @@ message hello
32 32
12 12
2 2
ls

83
init.el
View file

@ -38,6 +38,8 @@
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(recentf-mode +1)
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
@ -81,6 +83,11 @@
:config :config
(smartparens-global-mode +1)) (smartparens-global-mode +1))
(use-package aggressive-indent
:defer 1
:config
(global-aggressive-indent-mode +1))
(use-package adaptive-wrap (use-package adaptive-wrap
:defer t) :defer t)
@ -154,6 +161,7 @@
"bi" '(ibuffer :which-key "ibuffer") "bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme") "tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file") "ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file") "fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save") "fs" '(save-buffer :which-key "save")
"hf" '(helpful-function :which-key "describe-function") "hf" '(helpful-function :which-key "describe-function")
@ -196,8 +204,10 @@
:init :init
(selectrum-mode +1) (selectrum-mode +1)
:config :config
(general-define-key (setq selectrum-max-window-height 10)
:keymaps 'selectrum-minibuffer-map (add-hook 'selectrum-mode-hook 'selectrum-exhibit)
:general
('selectrum-minibuffer-map
"C-j" 'selectrum-next-candidate "C-j" 'selectrum-next-candidate
"C-k" 'selectrum-previous-candidate "C-k" 'selectrum-previous-candidate
"C-S-j" 'selectrum-goto-end "C-S-j" 'selectrum-goto-end
@ -261,6 +271,12 @@
(general-def 'normal dired-mode-map (general-def 'normal dired-mode-map
"q" 'kill-this-buffer)) "q" 'kill-this-buffer))
(defun chris/dired-yank-filename ()
"Get the full filename from file at point and put into kill-ring"
(interactive)
(let* ((file (dired-get-filename)))
(clipboard-kill-ring-save nil nil file)))
(use-package all-the-icons-dired (use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode)) :hook (dired-mode . all-the-icons-dired-mode))
@ -276,6 +292,7 @@
:config (diredfl-global-mode +1)) :config (diredfl-global-mode +1))
(defun chris/org-mode-setup () (defun chris/org-mode-setup ()
(interactive)
(org-indent-mode +1) (org-indent-mode +1)
(toc-org-mode +1) (toc-org-mode +1)
(olivetti-mode +1) (olivetti-mode +1)
@ -284,16 +301,15 @@
(use-package org (use-package org
:config :config
(setq org-startup-indented t (setq org-startup-indented t
org-edit-src-content-indentation 0 org-edit-src-content-indentation 0
org-agenda-sticky t) org-agenda-sticky t)
(add-hook 'org-mode-hook 'chris/org-mode-setup) (add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages (org-babel-do-load-languages 'org-babel-load-languages
'org-babel-load-languages '((emacs-lisp . t)
'((emacs-lisp . t) (python . t)
(python . t) (shell . t)))
(shell . t)))
(require 'org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
@ -317,6 +333,11 @@
:prepend nil :prepend nil
:jump-to-captured t :jump-to-captured t
:empty-lines 1) :empty-lines 1)
("P" "TFC Posts" entry
(file+headline "/home/chris/org/nvtfc_social_media.org" "Posts")
(file ".templates/posts.org")
:prepend t
:jump-to-captured t)
("r" "Templates for projects") ("r" "Templates for projects")
("rt" "Project-local todo" entry ("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox") (file+headline +org-capture-project-todo-file "Inbox")
@ -325,7 +346,7 @@
(file+headline +org-capture-project-notes-file "Inbox") (file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry ("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased") (file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects") ("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file ("ot" "Project todo" entry #'+org-capture-central-project-todo-file
@ -334,7 +355,7 @@
"* %U %?\n %i\n %a" :heading "Notes" :prepend t) "* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t)) "* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t) org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4) (setq org-imenu-depth 4)
@ -349,12 +370,24 @@
(setq org-agenda-files (setq org-agenda-files
'("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) '("/home/chris/org/DMPREADME.org"
"/home/chris/org/DMPTODO.org"
"/home/chris/org/inbox.org"
"/home/chris/org/notes.org"
"/home/chris/org/repetition.org"
"/home/chris/org/tasks.org"
"/home/chris/org/tfc_plans.org"
"/home/chris/org/ministry_team.org"
"/home/chris/org/todo.org"
"/home/chris/org/newsletter.org"))
(setq org-id-method 'ts) (setq org-id-method 'ts)
(defun chris/org-columns-view () (defun chris/org-columns-view ()
"Turn on org-columns overlay and turn off olivetti-mode" "Turn on org-columns overlay and turn off olivetti-mode"
(interactive) (interactive)
(goto-char (point-min))
(org-content)
(org-columns) (org-columns)
(olivetti-mode -1)) (olivetti-mode -1))
@ -362,30 +395,25 @@
"Remove the org-columns overlay and turn on olivetti-mode" "Remove the org-columns overlay and turn on olivetti-mode"
(interactive) (interactive)
(org-columns-quit) (org-columns-quit)
(visual-line-mode +1)
(olivetti-mode +1)) (olivetti-mode +1))
(defun chris/org-toggle-todo-and-mark-time () (add-hook 'org-agenda-finalize-hook 'evil-normal-state)
"Mark the time of finishing task and mark it as done."
(interactive)
(save-excursion
(org-back-to-heading t) ;; Make sure command works even if point is
;; below target heading
(cond ((looking-at "\*+ TODO")
(org-todo "DONE"))
((looking-at "\*+ DONE")
(org-todo "TODO"))
(t (message "Can only toggle between TODO and DONE.")))))
:general :general
(chris/leader-keys "o a" 'org-agenda (chris/leader-keys
"o a" 'org-agenda
"c" 'org-capture "c" 'org-capture
"so" 'consult-imenu) "so" 'consult-imenu)
('normal org-agenda-mode-map ('normal org-agenda-mode-map
"q" 'org-agenda-quit) "q" 'org-agenda-quit
"r" 'org-agenda-redo)
('normal org-columns-map ('normal org-columns-map
"j" 'outline-next-heading "j" 'outline-next-heading
"h" 'outline-previous-heading) "h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
('normal org-mode-map ('normal org-mode-map
"RET" 'chris/org-dwim-at-point)) "RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
(defun chris/org-roam-capture-lesson-file () (defun chris/org-roam-capture-lesson-file ()
"Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion" "Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion"
@ -484,7 +512,8 @@
:after org :after org
:config :config
(org-superstar-mode +1) (org-superstar-mode +1)
(setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))) (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))
(add-hook 'org-mode-hook 'org-superstar-mode))
(defun chris/org-dwim-at-point (&optional arg) (defun chris/org-dwim-at-point (&optional arg)
"Do-what-I-mean at point. "Do-what-I-mean at point.