Bunch of Fixes & Org-Mode Simplification

- Add font names as configuration variables
- Add org mode quick access keybindings to leader key prefix
- Disable auto fill mode and evil auto indent when in org-mode
- Add more comments and whitespace fixes
- Comment out unused org mode configuration options
- Fix some filepaths
- Add config as org structure template
This commit is contained in:
Sravan Balaji
2021-05-11 22:14:35 -04:00
parent 2816aff602
commit 40b296f765
2 changed files with 159 additions and 103 deletions

126
init.el
View File

@@ -1,7 +1,12 @@
;; Font Sizes
(defvar sb/default-font-size 110)
(defvar sb/default-variable-font-size 110)
(defvar sb/modeline-height 10)
;; Font Names
(defvar sb/source-code-font "FiraCode Nerd Font")
(defvar sb/document-font "Cantarell")
;; Initialize package sources
(require 'package)
@@ -42,13 +47,14 @@
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
(set-face-attribute 'default nil :font "FiraCode Nerd Font" :height sb/default-font-size)
;; Set the default font
(set-face-attribute 'default nil :font sb/source-code-font :height sb/default-font-size)
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "FiraCode Nerd Font" :height sb/default-font-size)
;; Set the fixed pitch font
(set-face-attribute 'fixed-pitch nil :font sb/source-code-font :height sb/default-font-size)
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height sb/default-font-size :weight 'regular)
;; Set the variable pitch font
(set-face-attribute 'variable-pitch nil :font sb/document-font :height sb/default-font-size :weight 'regular)
(use-package ligature
:load-path "./packages/ligature.el"
@@ -85,9 +91,14 @@
:global-prefix "C-SPC")
(sb/leader-keys
"o" '(:ignore t :which-key "org-mode quick access")
"oa" '(org-agenda :which-key "org agenda")
"oc" '(org-capture :which-key "org capture")
;; "t" '(:ignore t :which-key "toggles")
;; "tc" '(comment-line :which-key "toggle comment")
"s" '(:ignore s :which-key "settings")))
"s" '(:ignore s :which-key "settings")
)
)
(general-define-key
"C-M-j" 'counsel-switch-buffer
@@ -207,10 +218,10 @@
"ss" '(hydra-text-scale/body :which-key "scale text"))
(defun sb/org-font-setup ()
;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))
;; ;; Replace list hyphen with dot
;; (font-lock-add-keywords 'org-mode
;; '(("^ *\\([-]\\) "
;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
@@ -235,50 +246,62 @@
(defun sb/org-mode-setup ()
(org-indent-mode)
(variable-pitch-mode 1)
(visual-line-mode 1))
(auto-fill-mode 0)
(visual-line-mode 1)
(setq evil-auto-indent nil))
(use-package org
:hook (org-mode . sb/org-mode-setup)
:config
;; Change elipsis to down arrow
(setq org-ellipsis "")
;; Org Agenda Settings
(setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
;; Org Agenda Files
(setq org-agenda-files
'("~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org"
"~/Projects/Code/emacs-from-scratch/OrgFiles/Habits.org"
"~/Projects/Code/emacs-from-scratch/OrgFiles/Birthdays.org"))
'(
"~/OrgFiles/Tasks.org"
;; "~/OrgFiles/Habits.org"
;; "~/OrgFiles/Birthdays.org"
)
)
;; Org Habit Tracker
(require 'org-habit)
(add-to-list 'org-modules 'org-habit)
(setq org-habit-graph-column 60)
;; Org TODO Keywords
(setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
(sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
(setq org-refile-targets
'(("Archive.org" :maxlevel . 1)
("Tasks.org" :maxlevel . 1)))
;; ;; Move tasks between documents
;; (setq org-refile-targets
;; '(("Archive.org" :maxlevel . 1)
;; ("Tasks.org" :maxlevel . 1)))
;; Save Org buffers after refiling!
(advice-add 'org-refile :after 'org-save-all-org-buffers)
;; ;; Save Org buffers after refiling!
;; (advice-add 'org-refile :after 'org-save-all-org-buffers)
(setq org-tag-alist
'((:startgroup)
; Put mutually exclusive tags here
(:endgroup)
("@errand" . ?E)
("@home" . ?H)
("@work" . ?W)
("agenda" . ?a)
("planning" . ?p)
("publish" . ?P)
("batch" . ?b)
("note" . ?n)
("idea" . ?i)))
;; ;; Org Tags
;; (setq org-tag-alist
;; '((:startgroup)
;; ; Put mutually exclusive tags here
;; (:endgroup)
;; ("@errand" . ?E)
;; ("@home" . ?H)
;; ("@work" . ?W)
;; ("agenda" . ?a)
;; ("planning" . ?p)
;; ("publish" . ?P)
;; ("batch" . ?b)
;; ("note" . ?n)
;; ("idea" . ?i)))
;; Configure custom agenda views
(setq org-agenda-custom-commands
@@ -292,13 +315,13 @@
((todo "NEXT"
((org-agenda-overriding-header "Next Tasks")))))
("W" "Work Tasks" tags-todo "+work-email")
;; ("W" "Work Tasks" tags-todo "+work-email")
;; Low-effort next actions
("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0"
((org-agenda-overriding-header "Low Effort Tasks")
(org-agenda-max-todos 20)
(org-agenda-files org-agenda-files)))
;; ;; Low-effort next actions
;; ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0"
;; ((org-agenda-overriding-header "Low Effort Tasks")
;; (org-agenda-max-todos 20)
;; (org-agenda-files org-agenda-files)))
("w" "Workflow Status"
((todo "WAIT"
@@ -328,34 +351,38 @@
((org-agenda-overriding-header "Cancelled Projects")
(org-agenda-files org-agenda-files)))))))
;; Org Capture Templates
(setq org-capture-templates
`(("t" "Tasks / Projects")
("tt" "Task" entry (file+olp "~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org" "Inbox")
("tt" "Task" entry (file+olp "~/OrgFiles/Tasks.org" "Inbox")
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
("j" "Journal Entries")
("jj" "Journal" entry
(file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
(file+olp+datetree "~/OrgFiles/Journal.org")
"\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
:clock-in :clock-resume
:empty-lines 1)
("jm" "Meeting" entry
(file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
(file+olp+datetree "~/OrgFiles/Journal.org")
"* %<%I:%M %p> - %a :meetings:\n\n%?\n\n"
:clock-in :clock-resume
:empty-lines 1)
("w" "Workflows")
("we" "Checking Email" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
"* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1)
;; ("w" "Workflows")
;; ("we" "Checking Email" entry (file+olp+datetree "~/OrgFiles/Journal.org")
;; "* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1)
("m" "Metrics Capture")
("mw" "Weight" table-line (file+headline "~/Projects/Code/emacs-from-scratch/OrgFiles/Metrics.org" "Weight")
"| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)))
;; ("m" "Metrics Capture")
;; ("mw" "Weight" table-line (file+headline "~/OrgFiles/Metrics.org" "Weight")
;; "| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)
)
)
(define-key global-map (kbd "C-c j")
(lambda () (interactive) (org-capture nil "jj")))
;; ;; Keybinding for going directly to journal entry
;; (define-key global-map (kbd "C-c j")
;; (lambda () (interactive) (org-capture nil "jj")))
(sb/org-font-setup))
@@ -379,6 +406,7 @@
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
(add-to-list 'org-structure-template-alist '("cf" . "src config"))
(use-package org-auto-tangle
:defer t