Fixing org not loading and making daemon work properly

This commit is contained in:
Chris Cochrun 2021-02-23 14:15:17 -06:00
parent cfd47f6ede
commit 68dd87f068
2 changed files with 208 additions and 142 deletions

View file

@ -82,12 +82,22 @@ In order to have this config work on both my desktop with regular joe-schmoe mon
(defvar chris/default-font-size 240) (defvar chris/default-font-size 240)
(defvar chris/default-font-size 120)) (defvar chris/default-font-size 120))
(set-face-attribute 'default nil :font "VictorMono Nerd Font" (defun chris/set-font-faces ()
:height chris/default-font-size) "Set the faces for our fonts"
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font" (message "Setting faces!")
:height chris/default-font-size) (set-face-attribute 'default nil :font "VictorMono Nerd Font"
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height chris/default-font-size)
:height chris/default-font-size :weight 'regular) (set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(set-face-attribute 'variable-pitch nil :font "Cantarell"
:height chris/default-font-size :weight 'regular))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(chris/set-font-faces))))
(chris/set-font-faces))
#+end_src #+end_src
Then let's make sure line-numbers are relative and on. And let's turn on visual-line-mode globally. Then let's make sure line-numbers are relative and on. And let's turn on visual-line-mode globally.
@ -149,7 +159,12 @@ Let's also turn on =recentf-mode=.
(doom-modeline-mode 1) (doom-modeline-mode 1)
(setq doom-modeline-height 35 (setq doom-modeline-height 35
doom-modeline-bar-width 3 doom-modeline-bar-width 3
all-the-icons-scale-factor 0.9)) all-the-icons-scale-factor 0.9)
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(setq doom-modeline-icon t))))))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -328,8 +343,24 @@ 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
(setq selectrum-max-window-height 10) (setq selectrum-max-window-height 8)
(add-hook 'selectrum-mode-hook 'selectrum-exhibit) (add-hook 'selectrum-mode-hook 'selectrum-exhibit)
;; We need to fix selectrums minibuffer handling for Emacs 28
(defun selectrum--set-window-height (window &optional height)
"Set window height of WINDOW to HEIGHT pixel.
If HEIGHT is not given WINDOW will be updated to fit its content
vertically."
(let* ((lines (length
(split-string
(overlay-get selectrum--candidates-overlay 'after-string)
"\n" t)))
(dheight (or height
(* lines selectrum--line-height)))
(wheight (window-pixel-height window))
(window-resize-pixelwise t))
(window-resize
window (- dheight wheight) nil nil 'pixelwise)))
:general :general
('selectrum-minibuffer-map ('selectrum-minibuffer-map
"C-j" 'selectrum-next-candidate "C-j" 'selectrum-next-candidate
@ -535,17 +566,18 @@ This is the use-package definition with a lot of customization. Need to setup au
Part of this config includes some special capture templates for my work as a youth minister. I create lessons through both org-mode and org-roam capture templates. The first part comes from org-roam, then the next is org-mode. Part of this config includes some special capture templates for my work as a youth minister. I create lessons through both org-mode and org-roam capture templates. The first part comes from org-roam, then the next is org-mode.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org (use-package org
:straight (:type built-in)
: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-load-languages (org-babel-do-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"))
@ -554,44 +586,44 @@ Part of this config includes some special capture templates for my work as a you
(add-to-list 'org-structure-template-alist '("q" . "quote")) (add-to-list 'org-structure-template-alist '("q" . "quote"))
(setq org-capture-templates (setq org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox") (file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t) "* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry ("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox") (file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry ("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file) (file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry ("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file) (function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org") (file ".templates/tfcplantemplate.org")
:prepend nil :prepend nil
:jump-to-captured t :jump-to-captured t
:empty-lines 1) :empty-lines 1)
("P" "TFC Posts" entry ("P" "TFC Posts" entry
(file+headline "/home/chris/org/nvtfc_social_media.org" "Posts") (file+headline "/home/chris/org/nvtfc_social_media.org" "Posts")
(file ".templates/posts.org") (file ".templates/posts.org")
:prepend t :prepend t
:jump-to-captured 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")
"* TODO %?\n%i\n%a" :prepend t) "* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry ("rn" "Project-local notes" entry
(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
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil) "* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file ("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %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)
@ -601,21 +633,21 @@ Part of this config includes some special capture templates for my work as a you
(setq org-export-with-author nil) (setq org-export-with-author nil)
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)") '((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)"))) (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(setq org-agenda-files (setq org-agenda-files
'("/home/chris/org/DMPREADME.org" '("/home/chris/org/DMPREADME.org"
"/home/chris/org/DMPTODO.org" "/home/chris/org/DMPTODO.org"
"/home/chris/org/inbox.org" "/home/chris/org/inbox.org"
"/home/chris/org/notes.org" "/home/chris/org/notes.org"
"/home/chris/org/repetition.org" "/home/chris/org/repetition.org"
"/home/chris/org/tasks.org" "/home/chris/org/tasks.org"
"/home/chris/org/tfc_plans.org" "/home/chris/org/tfc_plans.org"
"/home/chris/org/ministry_team.org" "/home/chris/org/ministry_team.org"
"/home/chris/org/todo.org" "/home/chris/org/todo.org"
"/home/chris/org/newsletter.org")) "/home/chris/org/newsletter.org"))
(setq org-id-method 'ts) (setq org-id-method 'ts)
@ -641,15 +673,15 @@ Part of this config includes some special capture templates for my work as a you
"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) "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) "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)) "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.
@ -716,6 +748,7 @@ Basic Org-Roam setup. We select the directory and the basic width of the Org-Roa
We also need to setup some capture templates to use some specific setups with my journalling. These include a space for my [[file:../../org/homework_for_life.org][Homework For Life]], tasks for the day, and how I can love on my family. We also need to setup some capture templates to use some specific setups with my journalling. These include a space for my [[file:../../org/homework_for_life.org][Homework For Life]], tasks for the day, and how I can love on my family.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package org-roam (use-package org-roam
:after org
:hook (org-load . org-roam-mode) :hook (org-load . org-roam-mode)
:commands (org-roam org-roam-find-file) :commands (org-roam org-roam-find-file)
:config :config

173
init.el
View file

@ -22,12 +22,22 @@
(defvar chris/default-font-size 240) (defvar chris/default-font-size 240)
(defvar chris/default-font-size 120)) (defvar chris/default-font-size 120))
(set-face-attribute 'default nil :font "VictorMono Nerd Font" (defun chris/set-font-faces ()
:height chris/default-font-size) "Set the faces for our fonts"
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font" (message "Setting faces!")
:height chris/default-font-size) (set-face-attribute 'default nil :font "VictorMono Nerd Font"
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height chris/default-font-size)
:height chris/default-font-size :weight 'regular) (set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(set-face-attribute 'variable-pitch nil :font "Cantarell"
:height chris/default-font-size :weight 'regular))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(chris/set-font-faces))))
(chris/set-font-faces))
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode +1) (global-display-line-numbers-mode +1)
@ -69,7 +79,12 @@
(doom-modeline-mode 1) (doom-modeline-mode 1)
(setq doom-modeline-height 35 (setq doom-modeline-height 35
doom-modeline-bar-width 3 doom-modeline-bar-width 3
all-the-icons-scale-factor 0.9)) all-the-icons-scale-factor 0.9)
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(setq doom-modeline-icon t))))))
(use-package doom-themes (use-package doom-themes
:ensure t :ensure t
@ -204,8 +219,24 @@
:init :init
(selectrum-mode +1) (selectrum-mode +1)
:config :config
(setq selectrum-max-window-height 10) (setq selectrum-max-window-height 8)
(add-hook 'selectrum-mode-hook 'selectrum-exhibit) (add-hook 'selectrum-mode-hook 'selectrum-exhibit)
;; We need to fix selectrums minibuffer handling for Emacs 28
(defun selectrum--set-window-height (window &optional height)
"Set window height of WINDOW to HEIGHT pixel.
If HEIGHT is not given WINDOW will be updated to fit its content
vertically."
(let* ((lines (length
(split-string
(overlay-get selectrum--candidates-overlay 'after-string)
"\n" t)))
(dheight (or height
(* lines selectrum--line-height)))
(wheight (window-pixel-height window))
(window-resize-pixelwise t))
(window-resize
window (- dheight wheight) nil nil 'pixelwise)))
:general :general
('selectrum-minibuffer-map ('selectrum-minibuffer-map
"C-j" 'selectrum-next-candidate "C-j" 'selectrum-next-candidate
@ -299,17 +330,18 @@
(display-line-numbers-mode -1)) (display-line-numbers-mode -1))
(use-package org (use-package org
:straight (:type built-in)
: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-load-languages (org-babel-do-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"))
@ -318,44 +350,44 @@
(add-to-list 'org-structure-template-alist '("q" . "quote")) (add-to-list 'org-structure-template-alist '("q" . "quote"))
(setq org-capture-templates (setq org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox") (file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t) "* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry ("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox") (file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry ("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file) (file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t) "* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry ("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file) (function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org") (file ".templates/tfcplantemplate.org")
:prepend nil :prepend nil
:jump-to-captured t :jump-to-captured t
:empty-lines 1) :empty-lines 1)
("P" "TFC Posts" entry ("P" "TFC Posts" entry
(file+headline "/home/chris/org/nvtfc_social_media.org" "Posts") (file+headline "/home/chris/org/nvtfc_social_media.org" "Posts")
(file ".templates/posts.org") (file ".templates/posts.org")
:prepend t :prepend t
:jump-to-captured 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")
"* TODO %?\n%i\n%a" :prepend t) "* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry ("rn" "Project-local notes" entry
(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
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil) "* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file ("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %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)
@ -365,21 +397,21 @@
(setq org-export-with-author nil) (setq org-export-with-author nil)
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)") '((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)"))) (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(setq org-agenda-files (setq org-agenda-files
'("/home/chris/org/DMPREADME.org" '("/home/chris/org/DMPREADME.org"
"/home/chris/org/DMPTODO.org" "/home/chris/org/DMPTODO.org"
"/home/chris/org/inbox.org" "/home/chris/org/inbox.org"
"/home/chris/org/notes.org" "/home/chris/org/notes.org"
"/home/chris/org/repetition.org" "/home/chris/org/repetition.org"
"/home/chris/org/tasks.org" "/home/chris/org/tasks.org"
"/home/chris/org/tfc_plans.org" "/home/chris/org/tfc_plans.org"
"/home/chris/org/ministry_team.org" "/home/chris/org/ministry_team.org"
"/home/chris/org/todo.org" "/home/chris/org/todo.org"
"/home/chris/org/newsletter.org")) "/home/chris/org/newsletter.org"))
(setq org-id-method 'ts) (setq org-id-method 'ts)
@ -405,15 +437,15 @@
"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) "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) "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)) "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"
@ -459,6 +491,7 @@
(setq org-super-agenda-header-map nil)) (setq org-super-agenda-header-map nil))
(use-package org-roam (use-package org-roam
:after org
:hook (org-load . org-roam-mode) :hook (org-load . org-roam-mode)
:commands (org-roam org-roam-find-file) :commands (org-roam org-roam-find-file)
:config :config