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 120))
(set-face-attribute 'default nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(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)
(defun chris/set-font-faces ()
"Set the faces for our fonts"
(message "Setting faces!")
(set-face-attribute 'default nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(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
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)
(setq doom-modeline-height 35
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
#+begin_src emacs-lisp
@ -328,8 +343,24 @@ I prefer selectrum over Ivy or Helm for completions. It is using the basic compl
:init
(selectrum-mode +1)
:config
(setq selectrum-max-window-height 10)
(setq selectrum-max-window-height 8)
(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
('selectrum-minibuffer-map
"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.
#+begin_src emacs-lisp
(use-package org
:straight (:type built-in)
:config
(setq org-startup-indented t
org-edit-src-content-indentation 0
org-agenda-sticky t)
org-edit-src-content-indentation 0
org-agenda-sticky t)
(add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages 'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(shell . t)))
'((emacs-lisp . t)
(python . t)
(shell . t)))
(require 'org-tempo)
(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"))
(setq org-capture-templates
'(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org")
:prepend nil
:jump-to-captured t
: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")
("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t)
'(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org")
:prepend nil
:jump-to-captured t
: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")
("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4)
@ -599,23 +631,23 @@ Part of this config includes some special capture templates for my work as a you
(setq org-export-with-toc nil)
(setq org-export-with-author nil)
(setq org-todo-keywords
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(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)
@ -641,15 +673,15 @@ Part of this config includes some special capture templates for my work as a you
"c" 'org-capture
"so" 'consult-imenu)
('normal org-agenda-mode-map
"q" 'org-agenda-quit
"r" 'org-agenda-redo)
"q" 'org-agenda-quit
"r" 'org-agenda-redo)
('normal org-columns-map
"j" 'outline-next-heading
"h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
"j" 'outline-next-heading
"h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
('normal org-mode-map
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
#+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.
@ -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.
#+BEGIN_SRC emacs-lisp
(use-package org-roam
:after org
:hook (org-load . org-roam-mode)
:commands (org-roam org-roam-find-file)
:config

175
init.el
View file

@ -22,12 +22,22 @@
(defvar chris/default-font-size 240)
(defvar chris/default-font-size 120))
(set-face-attribute 'default nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(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)
(defun chris/set-font-faces ()
"Set the faces for our fonts"
(message "Setting faces!")
(set-face-attribute 'default nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(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)
(global-display-line-numbers-mode +1)
@ -69,7 +79,12 @@
(doom-modeline-mode 1)
(setq doom-modeline-height 35
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
:ensure t
@ -204,8 +219,24 @@
:init
(selectrum-mode +1)
:config
(setq selectrum-max-window-height 10)
(setq selectrum-max-window-height 8)
(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
('selectrum-minibuffer-map
"C-j" 'selectrum-next-candidate
@ -299,17 +330,18 @@
(display-line-numbers-mode -1))
(use-package org
:straight (:type built-in)
:config
(setq org-startup-indented t
org-edit-src-content-indentation 0
org-agenda-sticky t)
org-edit-src-content-indentation 0
org-agenda-sticky t)
(add-hook 'org-mode-hook 'chris/org-mode-setup)
(org-babel-do-load-languages 'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(shell . t)))
'((emacs-lisp . t)
(python . t)
(shell . t)))
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
@ -318,44 +350,44 @@
(add-to-list 'org-structure-template-alist '("q" . "quote"))
(setq org-capture-templates
'(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org")
:prepend nil
:jump-to-captured t
: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")
("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t)
'(("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t)
("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry
(file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t)
("p" "TFC Plan" entry
(function chris/org-roam-capture-lesson-file)
(file ".templates/tfcplantemplate.org")
:prepend nil
:jump-to-captured t
: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")
("rt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("rn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox")
"* %U %?\n%i\n%a" :prepend t)
("rc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
org-capture-use-agenda-date t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4)
@ -363,23 +395,23 @@
(setq org-export-with-toc nil)
(setq org-export-with-author nil)
(setq org-todo-keywords
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
'((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "CNCL(c)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")))
(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)
@ -405,15 +437,15 @@
"c" 'org-capture
"so" 'consult-imenu)
('normal org-agenda-mode-map
"q" 'org-agenda-quit
"r" 'org-agenda-redo)
"q" 'org-agenda-quit
"r" 'org-agenda-redo)
('normal org-columns-map
"j" 'outline-next-heading
"h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
"j" 'outline-next-heading
"h" 'outline-previous-heading
"q" 'chris/org-columns-quit)
('normal org-mode-map
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view))
(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"
@ -459,6 +491,7 @@
(setq org-super-agenda-header-map nil))
(use-package org-roam
:after org
:hook (org-load . org-roam-mode)
:commands (org-roam org-roam-find-file)
:config