Merge branch 'master' of gitlab.com:chriscochrun/dotemacs

This commit is contained in:
Chris Cochrun 2021-04-24 05:42:22 -05:00
commit c0046dabc4
2 changed files with 150 additions and 37 deletions

View file

@ -55,7 +55,7 @@ Let's create a message that will tell us how long it takes emacs to load in orde
(add-hook 'emacs-startup-hook #'chris/display-startup-time) (add-hook 'emacs-startup-hook #'chris/display-startup-time)
#+end_src #+end_src
Let's also set the =gc-cons-threshold= variable to a high setting for the remainder of our setup process to speed things up. Let's also set the =gc-cons-threshold= variable to a high setting for the remainder of our setup process to speed things up. This is no long done here but instead is done in the =early-init.el= file.
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(setq gc-cons-threshold 50000000) (setq gc-cons-threshold 50000000)
#+end_src #+end_src
@ -90,12 +90,20 @@ In order to have this config work on both my desktop with regular joe-schmoe mon
(set-face-attribute 'variable-pitch nil :font "Cantarell" (set-face-attribute 'variable-pitch nil :font "Cantarell"
:height (+ chris/default-font-size (/ chris/default-font-size 8)) :weight 'regular)) :height (+ chris/default-font-size (/ chris/default-font-size 8)) :weight 'regular))
(defun chris/set-transparency ()
"Set the frame to be transparent on Wayland compositors"
(if (string= x-display-name "wayland-0")
((set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(add-to-list 'default-frame-alist '(alpha . (90 . 90))))))
(if (daemonp) (if (daemonp)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
(lambda (frame) (lambda (frame)
(with-selected-frame frame (with-selected-frame frame
(chris/set-font-faces)))) (chris/set-font-faces)
(chris/set-transparency)))
(chris/set-font-faces)) (chris/set-font-faces))
(chris/set-transparency))
#+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.
@ -137,6 +145,17 @@ Let's also turn on =recentf-mode=.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(recentf-mode +1) (recentf-mode +1)
#+end_src #+end_src
Finally this is not part of the UI but let's do this early and start the server so I can use emacsclient from my WM.
#+begin_src emacs-lisp
(server-start)
#+end_src
I will also add my personal scripts to emacs' PATH
#+begin_src emacs-lisp
(add-to-list 'exec-path "/home/chris/scripts")
#+end_src
** Let's bootstrap straight.el ** Let's bootstrap straight.el
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq straight-fix-org t) (setq straight-fix-org t)
@ -331,7 +350,8 @@ This evil-collection package includes a lot of other evil based things.
(general-def 'minibuffer-local-map (general-def 'minibuffer-local-map
"C-v" 'evil-paste-after) "C-v" 'evil-paste-after)
(general-def 'normal (general-def 'normal
"gcc" 'comment-line)) "gcc" 'comment-line
"K" 'helpful-at-point))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -612,6 +632,7 @@ These are some evil bindings to avy.
(general-def 'normal (general-def 'normal
"gl" 'avy-goto-line)) "gl" 'avy-goto-line))
#+end_src #+end_src
*** Ace-Link *** Ace-Link
Ace link provides an avy like search for links. Upon using the keybindings presented it opens the url. Ace link provides an avy like search for links. Upon using the keybindings presented it opens the url.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -740,8 +761,10 @@ I'm making a small function in here to open files in the appropriate program usi
(defun chris/dired-open-xdg () (defun chris/dired-open-xdg ()
"Open the file-at-point in the appropriate program" "Open the file-at-point in the appropriate program"
(interactive) (interactive)
(let ((file (ignore-errors (dired-get-file-for-visit)))) (let ((file (file-truename (ignore-errors (dired-get-file-for-visit)))))
(browse-url-xdg-open (file-truename file)))) (message file)
(call-process "xdg-open" nil 0 nil file)))
:general :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -775,9 +798,23 @@ We need a function to copy the full filename to kill-ring
"l" 'dired-single-buffer)) "l" 'dired-single-buffer))
#+end_src #+end_src
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp
(use-package dired-rainbow (use-package dired-rainbow
:after dired) :after dired
:config
(defconst chris/dired-media-files-extensions
'("mp3" "mp4" "MP3" "MP4" "avi" "mpg" "flv" "ogg" "opus")
"Media files.")
(defconst chris/dired-image-files-extensions
'("png" "jpg" "PNG" "JPG" "jpeg" "JPEG" "gif" "GIF")
"image files")
(dired-rainbow-define html "#4e9a06" ("htm" "html" "xhtml"))
(dired-rainbow-define media "#f3f99d" chris/dired-media-files-extensions)
(dired-rainbow-define image "#5af78e" chris/dired-image-files-extensions)
(dired-rainbow-define log (:inherit default :italic t) ".*\\.log"))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -786,6 +823,14 @@ We need a function to copy the full filename to kill-ring
:config (diredfl-global-mode +1)) :config (diredfl-global-mode +1))
#+end_src #+end_src
#+begin_src emacs-lisp
(use-package dired-rsync
:after dired
:general
(general-def 'normal dired-mode-map
"C" 'dired-rsync))
#+end_src
*** Tramp *** Tramp
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'tramp) (require 'tramp)
@ -842,7 +887,7 @@ Part of this config includes some special capture templates for my work as a you
(setq org-capture-templates (setq org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
(file+headline "todo.org" "Inbox") (file+headline "todo.org" "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t) (file ".templates/tasks.org") :prepend t)
("n" "Personal notes" entry ("n" "Personal notes" entry
(file+headline "notes.org" "Inbox") (file+headline "notes.org" "Inbox")
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
@ -877,7 +922,8 @@ 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
org-agenda-timegrid-use-ampm t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4) (setq org-imenu-depth 4)
@ -900,7 +946,8 @@ Part of this config includes some special capture templates for my work as a you
"/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"
"/home/chris/org/nvtfc_social_media.org")) "/home/chris/org/nvtfc_social_media.org"
"/home/chris/org/lessons/"))
;; (add-to-list '("/home/chris/org/inbox.org" ;; (add-to-list '("/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"
@ -1056,7 +1103,7 @@ We also need to setup some capture templates to use some specific setups with my
:head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n- tags %^G\n\n* ") :head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n- tags %^G\n\n* ")
("l" "TFC Lesson" plain (function org-roam--capture-get-point) ("l" "TFC Lesson" plain (function org-roam--capture-get-point)
(file ".templates/lessontemplate.org") (file ".templates/lessontemplate.org")
:file-name "${slug}" :file-name "lessons/${slug}"
:head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n"))) :head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n")))
(setq org-roam-dailies-capture-templates (setq org-roam-dailies-capture-templates
@ -1561,6 +1608,8 @@ Let's add our own eshell prompt. and set the password cache to a significantly h
(rename-buffer "*eshell-pop*") (rename-buffer "*eshell-pop*")
(display-buffer-in-side-window pop-eshell '((side . bottom)))))) (display-buffer-in-side-window pop-eshell '((side . bottom))))))
(setq eshell-banner-message "")
:general :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -1612,7 +1661,7 @@ Let's use pdf-tools for a lot better interaction with pdfs.
(use-package nov (use-package nov
:mode ("\\.epub\\'" . nov-mode) :mode ("\\.epub\\'" . nov-mode)
:config :config
(add-hook 'nov-mode-hook 'olivetti-mode)) (add-hook 'nov-mode-hook 'visual-fill-column-mode))
#+end_src #+end_src
** Elfeed ** Elfeed
@ -1742,14 +1791,25 @@ I use transmission on a server to manage my torrents
(use-package transmission (use-package transmission
:commands (transmission) :commands (transmission)
:config :config
(setq transmission-host "192.168.1.7"
transmission-rpc-path "/transmission/rpc" (if (string-equal (system-name) "syl")
transmission-refresh-modes '(transmission-mode transmission-files-mode transmission-info-mode transmission-peers-mode)) (setq transmission-host "home.cochrun.xyz"
:general transmission-rpc-path "/transmission/rpc"
(chris/leader-keys transmission-refresh-modes '(transmission-mode
:states 'normal transmission-files-mode
:keymaps 'override transmission-info-mode
"ot" 'transmission)) transmission-peers-mode))
(setq transmission-host "192.168.1.7"
transmission-rpc-path "/transmission/rpc"
transmission-refresh-modes '(transmission-mode
transmission-files-mode
transmission-info-mode
transmission-peers-mode)))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ot" 'transmission))
#+end_src #+end_src
** Performance ** Performance

87
init.el
View file

@ -32,12 +32,20 @@
(set-face-attribute 'variable-pitch nil :font "Cantarell" (set-face-attribute 'variable-pitch nil :font "Cantarell"
:height (+ chris/default-font-size (/ chris/default-font-size 8)) :weight 'regular)) :height (+ chris/default-font-size (/ chris/default-font-size 8)) :weight 'regular))
(defun chris/set-transparency ()
"Set the frame to be transparent on Wayland compositors"
(if (string= x-display-name "wayland-0")
((set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(add-to-list 'default-frame-alist '(alpha . (90 . 90))))))
(if (daemonp) (if (daemonp)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
(lambda (frame) (lambda (frame)
(with-selected-frame frame (with-selected-frame frame
(chris/set-font-faces)))) (chris/set-font-faces)
(chris/set-transparency)))
(chris/set-font-faces)) (chris/set-font-faces))
(chris/set-transparency))
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode +1) (global-display-line-numbers-mode +1)
@ -63,6 +71,10 @@
(recentf-mode +1) (recentf-mode +1)
(server-start)
(add-to-list 'exec-path "/home/chris/scripts")
(setq straight-fix-org t) (setq straight-fix-org t)
(setq straight-check-for-modifications '(check-on-save find-when-checking)) (setq straight-check-for-modifications '(check-on-save find-when-checking))
(defvar bootstrap-version) (defvar bootstrap-version)
@ -219,7 +231,8 @@
(general-def 'minibuffer-local-map (general-def 'minibuffer-local-map
"C-v" 'evil-paste-after) "C-v" 'evil-paste-after)
(general-def 'normal (general-def 'normal
"gcc" 'comment-line)) "gcc" 'comment-line
"K" 'helpful-at-point))
(use-package evil-escape (use-package evil-escape
:after evil :after evil
@ -431,8 +444,10 @@ vertically."
(defun chris/dired-open-xdg () (defun chris/dired-open-xdg ()
"Open the file-at-point in the appropriate program" "Open the file-at-point in the appropriate program"
(interactive) (interactive)
(let ((file (ignore-errors (dired-get-file-for-visit)))) (let ((file (file-truename (ignore-errors (dired-get-file-for-visit)))))
(browse-url-xdg-open (file-truename file)))) (message file)
(call-process "xdg-open" nil 0 nil file)))
:general :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -458,10 +473,33 @@ vertically."
"h" 'dired-single-up-directory "h" 'dired-single-up-directory
"l" 'dired-single-buffer)) "l" 'dired-single-buffer))
(use-package dired-rainbow
:after dired
:config
(defconst chris/dired-media-files-extensions
'("mp3" "mp4" "MP3" "MP4" "avi" "mpg" "flv" "ogg" "opus")
"Media files.")
(defconst chris/dired-image-files-extensions
'("png" "jpg" "PNG" "JPG" "jpeg" "JPEG" "gif" "GIF")
"image files")
(dired-rainbow-define html "#4e9a06" ("htm" "html" "xhtml"))
(dired-rainbow-define media "#f3f99d" chris/dired-media-files-extensions)
(dired-rainbow-define image "#5af78e" chris/dired-image-files-extensions)
(dired-rainbow-define log (:inherit default :italic t) ".*\\.log"))
(use-package diredfl (use-package diredfl
:after dired :after dired
:config (diredfl-global-mode +1)) :config (diredfl-global-mode +1))
(use-package dired-rsync
:after dired
:general
(general-def 'normal dired-mode-map
"C" 'dired-rsync))
(require 'tramp) (require 'tramp)
(add-to-list 'tramp-default-proxies-alist (add-to-list 'tramp-default-proxies-alist
'(nil "\\`root\\'" "/ssh:%h:")) '(nil "\\`root\\'" "/ssh:%h:"))
@ -507,7 +545,7 @@ vertically."
(setq org-capture-templates (setq org-capture-templates
'(("t" "Personal todo" entry '(("t" "Personal todo" entry
(file+headline "todo.org" "Inbox") (file+headline "todo.org" "Inbox")
"* TODO %^{TODO name}\nSCHEDULED: %T\n%a\n%i%?" :prepend t) (file ".templates/tasks.org") :prepend t)
("n" "Personal notes" entry ("n" "Personal notes" entry
(file+headline "notes.org" "Inbox") (file+headline "notes.org" "Inbox")
"* %u %?\n%i\n%a" :prepend t) "* %u %?\n%i\n%a" :prepend t)
@ -542,7 +580,8 @@ vertically."
"* %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
org-agenda-timegrid-use-ampm t)
;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖"))
(setq org-imenu-depth 4) (setq org-imenu-depth 4)
@ -565,7 +604,8 @@ vertically."
"/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"
"/home/chris/org/nvtfc_social_media.org")) "/home/chris/org/nvtfc_social_media.org"
"/home/chris/org/lessons/"))
;; (add-to-list '("/home/chris/org/inbox.org" ;; (add-to-list '("/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"
@ -698,7 +738,7 @@ vertically."
:head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n- tags %^G\n\n* ") :head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n- tags %^G\n\n* ")
("l" "TFC Lesson" plain (function org-roam--capture-get-point) ("l" "TFC Lesson" plain (function org-roam--capture-get-point)
(file ".templates/lessontemplate.org") (file ".templates/lessontemplate.org")
:file-name "${slug}" :file-name "lessons/${slug}"
:head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n"))) :head "#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n")))
(setq org-roam-dailies-capture-templates (setq org-roam-dailies-capture-templates
@ -1163,6 +1203,8 @@ If on a:
(rename-buffer "*eshell-pop*") (rename-buffer "*eshell-pop*")
(display-buffer-in-side-window pop-eshell '((side . bottom)))))) (display-buffer-in-side-window pop-eshell '((side . bottom))))))
(setq eshell-banner-message "")
:general :general
(chris/leader-keys (chris/leader-keys
:states 'normal :states 'normal
@ -1199,7 +1241,7 @@ If on a:
(use-package nov (use-package nov
:mode ("\\.epub\\'" . nov-mode) :mode ("\\.epub\\'" . nov-mode)
:config :config
(add-hook 'nov-mode-hook 'olivetti-mode)) (add-hook 'nov-mode-hook 'visual-fill-column-mode))
(use-package elfeed (use-package elfeed
:commands (elfeed) :commands (elfeed)
@ -1317,14 +1359,25 @@ interfere with the default `bongo-playlist-buffer'."
(use-package transmission (use-package transmission
:commands (transmission) :commands (transmission)
:config :config
(setq transmission-host "192.168.1.7"
transmission-rpc-path "/transmission/rpc" (if (string-equal (system-name) "syl")
transmission-refresh-modes '(transmission-mode transmission-files-mode transmission-info-mode transmission-peers-mode)) (setq transmission-host "home.cochrun.xyz"
:general transmission-rpc-path "/transmission/rpc"
(chris/leader-keys transmission-refresh-modes '(transmission-mode
:states 'normal transmission-files-mode
:keymaps 'override transmission-info-mode
"ot" 'transmission)) transmission-peers-mode))
(setq transmission-host "192.168.1.7"
transmission-rpc-path "/transmission/rpc"
transmission-refresh-modes '(transmission-mode
transmission-files-mode
transmission-info-mode
transmission-peers-mode)))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ot" 'transmission))
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions ;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
;; in non-focused windows. ;; in non-focused windows.