Added fennel, window management, dired, and org enhancements

This commit is contained in:
Chris Cochrun 2021-02-22 06:52:51 -06:00
parent ab3b1e014c
commit 5cec642a0b
2 changed files with 168 additions and 23 deletions

View file

@ -14,12 +14,14 @@
- [[#completion][Completion]] - [[#completion][Completion]]
- [[#help][Help]] - [[#help][Help]]
- [[#format][Format]] - [[#format][Format]]
- [[#fennel][Fennel]]
- [[#file-management][File Management]] - [[#file-management][File Management]]
- [[#org-mode][Org Mode]] - [[#org-mode][Org Mode]]
- [[#calendar][Calendar]] - [[#calendar][Calendar]]
- [[#magit][Magit]] - [[#magit][Magit]]
- [[#eshell][Eshell]] - [[#eshell][Eshell]]
- [[#pdf-tools][PDF-Tools]] - [[#pdf-tools][PDF-Tools]]
- [[#window-management][Window Management]]
- [[#garbage-collection][Garbage Collection]] - [[#garbage-collection][Garbage Collection]]
- [[#early-init][Early Init]] - [[#early-init][Early Init]]
@ -91,7 +93,8 @@ In order to have this config work on both my desktop with regular joe-schmoe mon
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.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(display-line-numbers-mode +1) (global-display-line-numbers-mode +1)
(add-hook 'prog-mode-hook (display-line-numbers-mode +1))
(global-visual-line-mode +1) (global-visual-line-mode +1)
#+end_src #+end_src
@ -447,6 +450,13 @@ Marginalia makes for some great decoration to our minibuffer completion items. W
:defer 1) :defer 1)
#+end_src #+end_src
** Fennel
I use fennel to build my awesomewm config. So, we'll need that downloaded.
#+begin_src emacs-lisp
(use-package fennel-mode
:mode ("\\.fnl\\'" . fennel-mode))
#+end_src
** File Management ** File Management
*** Dired *** Dired
@ -458,21 +468,46 @@ Marginalia makes for some great decoration to our minibuffer completion items. W
(chris/leader-keys (chris/leader-keys
"od" '(dired-jump :which-key "open dired here")) "od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map (general-def 'normal dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file
"q" 'kill-this-buffer)) "q" 'kill-this-buffer))
#+end_src #+end_src
#+begin_src emacs-lisp
(use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode))
#+end_src
#+begin_src emacs-lisp
(use-package dired-single
:after dired
:general
(general-def 'normal dired-mode-map
"h" 'dired-single-up-directory
"l" 'dired-single-buffer))
#+end_src
#+begin_src emacs-lisp :tangle no
(use-package dired-rainbow
:after dired)
#+end_src
#+begin_src emacs-lisp
(use-package diredfl
:after dired
:config (diredfl-global-mode +1))
#+end_src
** Org Mode ** Org Mode
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 ()
(org-indent-mode +1) (org-indent-mode +1)
(toc-org-mode +1) (toc-org-mode +1)
(olivetti-mode +1)) (olivetti-mode +1)
(display-line-numbers-mode -1))
#+end_src #+end_src
This is the use-package definition with a lot of customization. Need to setup auto tangle and make sure I have some structure templates for org-mode. This is the use-package definition with a lot of customization. Need to setup auto tangle and make sure I have some structure templates for 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
:config :config
@ -545,10 +580,11 @@ This is the use-package definition with a lot of customization. Need to setup au
(setq org-id-method 'ts) (setq org-id-method 'ts)
: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))
#+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. 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.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(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"
@ -574,15 +610,44 @@ We are also going to make our config auto-tangle. This is so helpful on saving t
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config
:append :local))) :append :local)))
#+end_src #+end_src
We also need to add =evil-org= to make better keybindings.
#+begin_src emacs-lisp
(use-package evil-org
:after org)
#+end_src
*** 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.
#+begin_src emacs-lisp
(use-package org-super-agenda
:after org-agenda
:init
(setq org-super-agenda-groups '((:name "Today"
:time-grid t
:scheduled today)
(:name "Due Today"
:deadline today)
(:name "Important"
:priority "A")
(:name "Overdue"
:time-grid t
:scheduled today)
(:name "Due soon"
:deadline future)))
:config
(org-super-agenda-mode)
(setq org-super-agenda-header-map nil))
#+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.
Basic Org-Roam setup. We select the directory and the basic width of the Org-Roam buffer so that it fits right. We also want to exclude certain files from Org-Roam. All files are synced between machines using syncthing and kept in a version history. I'd like to exclude the version history from Org-Roam using =org-roam-file-exclude-regexp=. Basic Org-Roam setup. We select the directory and the basic width of the Org-Roam buffer so that it doesn't take too much space on my laptop. We also want to exclude certain files from Org-Roam. All files are synced between machines using syncthing and kept in a version history. I'd like to exclude the version history from Org-Roam using =org-roam-file-exclude-regexp=.
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)
:commands (org-roam org-roam-find-file)
:config :config
(setq org-roam-directory "~/org") (setq org-roam-directory "~/org")
(setq org-roam-buffer-width 0.25) (setq org-roam-buffer-width 0.25)
@ -636,6 +701,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
#+begin_src emacs-lisp
(use-package org-superstar
:after org
:config
(org-superstar-mode +1)
(setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756")))
#+end_src
** Calendar ** Calendar
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -647,9 +720,12 @@ In order to use it, I need to go to http://localhost:8080
(cfw:open-calendar-buffer (cfw:open-calendar-buffer
:contents-sources :contents-sources
(list (list
(cfw:org-create-source "Cyan") ; org-agenda source (cfw:org-create-source
(cfw:ical-create-source "NV" "https://www.nvhuskies.org/vnews/display.v?ical" "Green") ; School Calendar "Cyan") ; org-agenda source
(cfw:ical-create-source "Outlook" "https://outlook.office365.com/owa/calendar/62a0d491bec4430e825822afd2fd1c01@tfcconnection.org/9acc5bc27ca24ce7a900c57284959f9d8242340735661296952/S-1-8-2197686000-2519837503-3687200543-3873966527/reachcalendar.ics" "Yellow") ; Outlook Calendar (cfw:ical-create-source
"NV" "https://www.nvhuskies.org/vnews/display.v?ical" "Green") ; School Calendar
(cfw:ical-create-source
"Outlook" "https://outlook.office365.com/owa/calendar/62a0d491bec4430e825822afd2fd1c01@tfcconnection.org/9acc5bc27ca24ce7a900c57284959f9d8242340735661296952/S-1-8-2197686000-2519837503-3687200543-3873966527/reachcalendar.ics" "Yellow") ; Outlook Calendar
))) )))
:general :general
(chris/leader-keys (chris/leader-keys
@ -657,7 +733,7 @@ In order to use it, I need to go to http://localhost:8080
(general-def cfw:calendar-mode-map (general-def cfw:calendar-mode-map
"q" 'kill-this-buffer "q" 'kill-this-buffer
"RET" 'cfw:show-details-command) "RET" 'cfw:show-details-command)
(general-def cfw:details-mode-map (general-def 'normal cfw:details-mode-map
"q" 'cfw:details-kill-buffer-command)) "q" 'cfw:details-kill-buffer-command))
#+end_src #+end_src
@ -686,7 +762,7 @@ Use magit, because why wouldn't you? duh!
#+end_src #+end_src
** Eshell ** Eshell
Let's add our own eshell prompt. Let's add our own eshell prompt. and set the password cache to a significantly higher time in order to not need to constantly reuse my password.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eshell (use-package eshell
:ensure nil :ensure nil
@ -756,6 +832,7 @@ Let's add our own eshell prompt.
;;; If the prompt spans over multiple lines, the regexp should match ;;; If the prompt spans over multiple lines, the regexp should match
;;; last line only. ;;; last line only.
(setq-default eshell-prompt-regexp "^ ") (setq-default eshell-prompt-regexp "^ ")
(setq eshell-destroy-buffer-when-process-dies t)
:general :general
(chris/leader-keys (chris/leader-keys
"oe" 'eshell) "oe" 'eshell)
@ -775,6 +852,16 @@ Let's use pdf-tools for a lot better interaction with pdfs.
(pdf-tools-install)) (pdf-tools-install))
#+end_src #+end_src
** Window Management
#+begin_src emacs-lisp
(setq display-buffer-alist
'(("\\*e?shell\\*"
(display-buffer-in-side-window)
(window-width . 0.3)
(side . right))))
(setq display-buffer-alist nil)
#+end_src
** Garbage Collection ** Garbage Collection
We set the =gc-cons-threshold= variable to really high, now lets set it back low to make sure emacs performs properly. We set the =gc-cons-threshold= variable to really high, now lets set it back low to make sure emacs performs properly.

78
init.el
View file

@ -30,7 +30,8 @@
:height chris/default-font-size :weight 'regular) :height chris/default-font-size :weight 'regular)
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(display-line-numbers-mode +1) (global-display-line-numbers-mode +1)
(add-hook 'prog-mode-hook (display-line-numbers-mode +1))
(global-visual-line-mode +1) (global-visual-line-mode +1)
(setq doc-view-resolution 192) (setq doc-view-resolution 192)
@ -246,6 +247,9 @@
(setq format-all-formatters '("Emacs Lisp" emacs-lisp)) (setq format-all-formatters '("Emacs Lisp" emacs-lisp))
:defer 1) :defer 1)
(use-package fennel-mode
:mode ("\\.fnl\\'" . fennel-mode))
(use-package dired (use-package dired
:ensure nil :ensure nil
:straight nil :straight nil
@ -253,14 +257,27 @@
(chris/leader-keys (chris/leader-keys
"od" '(dired-jump :which-key "open dired here")) "od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map (general-def 'normal dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file
"q" 'kill-this-buffer)) "q" 'kill-this-buffer))
(use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode))
(use-package dired-single
:after dired
:general
(general-def 'normal dired-mode-map
"h" 'dired-single-up-directory
"l" 'dired-single-buffer))
(use-package diredfl
:after dired
:config (diredfl-global-mode +1))
(defun chris/org-mode-setup () (defun chris/org-mode-setup ()
(org-indent-mode +1) (org-indent-mode +1)
(toc-org-mode +1) (toc-org-mode +1)
(olivetti-mode +1)) (olivetti-mode +1)
(display-line-numbers-mode -1))
(use-package org (use-package org
:config :config
@ -333,7 +350,8 @@
(setq org-id-method 'ts) (setq org-id-method 'ts)
: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))
(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"
@ -356,8 +374,31 @@
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'chris/org-babel-tangle-config
:append :local))) :append :local)))
(use-package evil-org
:after org)
(use-package org-super-agenda
:after org-agenda
:init
(setq org-super-agenda-groups '((:name "Today"
:time-grid t
:scheduled today)
(:name "Due Today"
:deadline today)
(:name "Important"
:priority "A")
(:name "Overdue"
:time-grid t
:scheduled today)
(:name "Due soon"
:deadline future)))
:config
(org-super-agenda-mode)
(setq org-super-agenda-header-map nil))
(use-package org-roam (use-package org-roam
:after org :hook (org-load . org-roam-mode)
:commands (org-roam org-roam-find-file)
:config :config
(setq org-roam-directory "~/org") (setq org-roam-directory "~/org")
(setq org-roam-buffer-width 0.25) (setq org-roam-buffer-width 0.25)
@ -405,6 +446,12 @@
(add-hook 'org-roam-mode-hook org-roam-server-mode t) (add-hook 'org-roam-mode-hook org-roam-server-mode t)
(use-package org-superstar
:after org
:config
(org-superstar-mode +1)
(setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756")))
(use-package calfw (use-package calfw
:commands chris/calfw-calendar-open :commands chris/calfw-calendar-open
:config :config
@ -413,9 +460,12 @@
(cfw:open-calendar-buffer (cfw:open-calendar-buffer
:contents-sources :contents-sources
(list (list
(cfw:org-create-source "Cyan") ; org-agenda source (cfw:org-create-source
(cfw:ical-create-source "NV" "https://www.nvhuskies.org/vnews/display.v?ical" "Green") ; School Calendar "Cyan") ; org-agenda source
(cfw:ical-create-source "Outlook" "https://outlook.office365.com/owa/calendar/62a0d491bec4430e825822afd2fd1c01@tfcconnection.org/9acc5bc27ca24ce7a900c57284959f9d8242340735661296952/S-1-8-2197686000-2519837503-3687200543-3873966527/reachcalendar.ics" "Yellow") ; Outlook Calendar (cfw:ical-create-source
"NV" "https://www.nvhuskies.org/vnews/display.v?ical" "Green") ; School Calendar
(cfw:ical-create-source
"Outlook" "https://outlook.office365.com/owa/calendar/62a0d491bec4430e825822afd2fd1c01@tfcconnection.org/9acc5bc27ca24ce7a900c57284959f9d8242340735661296952/S-1-8-2197686000-2519837503-3687200543-3873966527/reachcalendar.ics" "Yellow") ; Outlook Calendar
))) )))
:general :general
(chris/leader-keys (chris/leader-keys
@ -423,7 +473,7 @@
(general-def cfw:calendar-mode-map (general-def cfw:calendar-mode-map
"q" 'kill-this-buffer "q" 'kill-this-buffer
"RET" 'cfw:show-details-command) "RET" 'cfw:show-details-command)
(general-def cfw:details-mode-map (general-def 'normal cfw:details-mode-map
"q" 'cfw:details-kill-buffer-command)) "q" 'cfw:details-kill-buffer-command))
(use-package calfw-org (use-package calfw-org
@ -507,6 +557,7 @@
;;; If the prompt spans over multiple lines, the regexp should match ;;; If the prompt spans over multiple lines, the regexp should match
;;; last line only. ;;; last line only.
(setq-default eshell-prompt-regexp "^ ") (setq-default eshell-prompt-regexp "^ ")
(setq eshell-destroy-buffer-when-process-dies t)
:general :general
(chris/leader-keys (chris/leader-keys
"oe" 'eshell) "oe" 'eshell)
@ -521,4 +572,11 @@
:config :config
(pdf-tools-install)) (pdf-tools-install))
(setq display-buffer-alist
'(("\\*e?shell\\*"
(display-buffer-in-side-window)
(window-width . 0.3)
(side . right))))
(setq display-buffer-alist nil)
(setq gc-cons-threshold 2000000) (setq gc-cons-threshold 2000000)