From 20304a1406eeaa26949d4e7351e6fbdf26856a4c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 20 Apr 2021 09:51:20 -0500 Subject: [PATCH 1/2] Wayland changes not perfect --- README.org | 57 ++++++++++++++++++++++++++++++++++++++++-------------- init.el | 52 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 80 insertions(+), 29 deletions(-) diff --git a/README.org b/README.org index c89a9204..eeb8da4c 100644 --- a/README.org +++ b/README.org @@ -52,7 +52,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) #+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 (setq gc-cons-threshold 50000000) #+end_src @@ -87,12 +87,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" :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) (add-hook 'after-make-frame-functions (lambda (frame) (with-selected-frame frame - (chris/set-font-faces)))) + (chris/set-font-faces) + (chris/set-transparency)))) (chris/set-font-faces)) + ;; (chris/set-transparency)) #+end_src Then let's make sure line-numbers are relative and on. And let's turn on visual-line-mode globally. @@ -117,6 +125,11 @@ Let's also turn on =recentf-mode=. #+begin_src emacs-lisp (recentf-mode +1) #+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 ** Let's bootstrap straight.el #+begin_src emacs-lisp (setq straight-fix-org t) @@ -310,7 +323,8 @@ This evil-collection package includes a lot of other evil based things. (general-def 'minibuffer-local-map "C-v" 'evil-paste-after) (general-def 'normal - "gcc" 'comment-line)) + "gcc" 'comment-line + "K" 'helpful-at-point)) #+end_src #+begin_src emacs-lisp @@ -756,7 +770,7 @@ Part of this config includes some special capture templates for my work as a you (setq org-capture-templates '(("t" "Personal todo" entry (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 (file+headline "notes.org" "Inbox") "* %u %?\n%i\n%a" :prepend t) @@ -791,7 +805,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) ("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) + org-capture-use-agenda-date t + org-agenda-timegrid-use-ampm t) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) (setq org-imenu-depth 4) @@ -814,7 +829,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/todo.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" ;; "/home/chris/org/notes.org" ;; "/home/chris/org/repetition.org" @@ -967,7 +983,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* ") ("l" "TFC Lesson" plain (function org-roam--capture-get-point) (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"))) (setq org-roam-dailies-capture-templates @@ -1648,14 +1664,25 @@ I use transmission on a server to manage my torrents (use-package transmission :commands (transmission) :config - (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)) + + (if (string-equal (system-name) "syl") + (setq transmission-host "home.cochrun.xyz" + transmission-rpc-path "/transmission/rpc" + transmission-refresh-modes '(transmission-mode + transmission-files-mode + transmission-info-mode + 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 ** Garbage Collection diff --git a/init.el b/init.el index 6314b909..940c2796 100644 --- a/init.el +++ b/init.el @@ -32,12 +32,20 @@ (set-face-attribute 'variable-pitch nil :font "Cantarell" :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) (add-hook 'after-make-frame-functions (lambda (frame) (with-selected-frame frame - (chris/set-font-faces)))) + (chris/set-font-faces) + (chris/set-transparency)))) (chris/set-font-faces)) + ;; (chris/set-transparency)) (setq display-line-numbers-type 'relative) (global-display-line-numbers-mode +1) @@ -50,6 +58,8 @@ (recentf-mode +1) +(server-start) + (setq straight-fix-org t) (defvar bootstrap-version) (let ((bootstrap-file @@ -205,7 +215,8 @@ (general-def 'minibuffer-local-map "C-v" 'evil-paste-after) (general-def 'normal - "gcc" 'comment-line)) + "gcc" 'comment-line + "K" 'helpful-at-point)) (use-package evil-escape :after evil @@ -462,7 +473,7 @@ vertically." (setq org-capture-templates '(("t" "Personal todo" entry (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 (file+headline "notes.org" "Inbox") "* %u %?\n%i\n%a" :prepend t) @@ -497,7 +508,8 @@ vertically." "* %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) + org-capture-use-agenda-date t + org-agenda-timegrid-use-ampm t) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) (setq org-imenu-depth 4) @@ -520,7 +532,8 @@ vertically." "/home/chris/org/ministry_team.org" "/home/chris/org/todo.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" ;; "/home/chris/org/notes.org" ;; "/home/chris/org/repetition.org" @@ -650,7 +663,7 @@ vertically." :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) (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"))) (setq org-roam-dailies-capture-templates @@ -1265,14 +1278,25 @@ interfere with the default `bongo-playlist-buffer'." (use-package transmission :commands (transmission) :config - (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)) + + (if (string-equal (system-name) "syl") + (setq transmission-host "home.cochrun.xyz" + transmission-rpc-path "/transmission/rpc" + transmission-refresh-modes '(transmission-mode + transmission-files-mode + transmission-info-mode + 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)) (setq gc-cons-threshold 2000000) (setq garbage-collection-messages nil) From 91cfedd2690c416981ff8f236a36f10ac613f21b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sat, 24 Apr 2021 05:34:12 -0500 Subject: [PATCH 2/2] Making dired better --- README.org | 57 ++++++++++++++++++++++++++++++++++++++++++------------ init.el | 49 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 84 insertions(+), 22 deletions(-) diff --git a/README.org b/README.org index 2159a620..cce390ed 100644 --- a/README.org +++ b/README.org @@ -87,20 +87,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" :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)))))) +(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) (add-hook 'after-make-frame-functions (lambda (frame) (with-selected-frame frame (chris/set-font-faces) - (chris/set-transparency)))) + (chris/set-transparency))) (chris/set-font-faces)) - ;; (chris/set-transparency)) + (chris/set-transparency)) #+end_src Then let's make sure line-numbers are relative and on. And let's turn on visual-line-mode globally. @@ -147,6 +147,12 @@ Finally this is not part of the UI but let's do this early and start the server #+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 #+begin_src emacs-lisp (setq straight-fix-org t) @@ -587,6 +593,7 @@ These are some evil bindings to avy. (general-def 'normal "gl" 'avy-goto-line)) #+end_src + *** Ace-Link Ace link provides an avy like search for links. Upon using the keybindings presented it opens the url. #+begin_src emacs-lisp @@ -692,8 +699,10 @@ I'm making a small function in here to open files in the appropriate program usi (defun chris/dired-open-xdg () "Open the file-at-point in the appropriate program" (interactive) - (let ((file (ignore-errors (dired-get-file-for-visit)))) - (browse-url-xdg-open (file-truename file)))) + (let ((file (file-truename (ignore-errors (dired-get-file-for-visit))))) + (message file) + (call-process "xdg-open" nil 0 nil file))) + :general (chris/leader-keys :states 'normal @@ -727,9 +736,23 @@ We need a function to copy the full filename to kill-ring "l" 'dired-single-buffer)) #+end_src -#+begin_src emacs-lisp :tangle no +#+begin_src emacs-lisp (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 #+begin_src emacs-lisp @@ -738,6 +761,14 @@ We need a function to copy the full filename to kill-ring :config (diredfl-global-mode +1)) #+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 #+begin_src emacs-lisp (require 'tramp) @@ -1509,6 +1540,8 @@ Let's add our own eshell prompt. and set the password cache to a significantly h (rename-buffer "*eshell-pop*") (display-buffer-in-side-window pop-eshell '((side . bottom)))))) + (setq eshell-banner-message "") + :general (chris/leader-keys :states 'normal @@ -1542,7 +1575,7 @@ Let's use pdf-tools for a lot better interaction with pdfs. (use-package nov :mode ("\\.epub\\'" . nov-mode) :config - (add-hook 'nov-mode-hook 'olivetti-mode)) + (add-hook 'nov-mode-hook 'visual-fill-column-mode)) #+end_src ** Window Management diff --git a/init.el b/init.el index 8d358074..b7173c7f 100644 --- a/init.el +++ b/init.el @@ -32,20 +32,20 @@ (set-face-attribute 'variable-pitch nil :font "Cantarell" :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)))))) +(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) (add-hook 'after-make-frame-functions (lambda (frame) (with-selected-frame frame (chris/set-font-faces) - (chris/set-transparency)))) + (chris/set-transparency))) (chris/set-font-faces)) - ;; (chris/set-transparency)) + (chris/set-transparency)) (setq display-line-numbers-type 'relative) (global-display-line-numbers-mode +1) @@ -73,6 +73,8 @@ (server-start) +(add-to-list 'exec-path "/home/chris/scripts") + (setq straight-fix-org t) (setq straight-check-for-modifications '(check-on-save find-when-checking)) (defvar bootstrap-version) @@ -417,8 +419,10 @@ vertically." (defun chris/dired-open-xdg () "Open the file-at-point in the appropriate program" (interactive) - (let ((file (ignore-errors (dired-get-file-for-visit)))) - (browse-url-xdg-open (file-truename file)))) + (let ((file (file-truename (ignore-errors (dired-get-file-for-visit))))) + (message file) + (call-process "xdg-open" nil 0 nil file))) + :general (chris/leader-keys :states 'normal @@ -444,10 +448,33 @@ vertically." "h" 'dired-single-up-directory "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 :after dired :config (diredfl-global-mode +1)) +(use-package dired-rsync + :after dired + :general + (general-def 'normal dired-mode-map + "C" 'dired-rsync)) + (require 'tramp) (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) @@ -1145,6 +1172,8 @@ If on a: (rename-buffer "*eshell-pop*") (display-buffer-in-side-window pop-eshell '((side . bottom)))))) + (setq eshell-banner-message "") + :general (chris/leader-keys :states 'normal @@ -1167,7 +1196,7 @@ If on a: (use-package nov :mode ("\\.epub\\'" . nov-mode) :config - (add-hook 'nov-mode-hook 'olivetti-mode)) + (add-hook 'nov-mode-hook 'visual-fill-column-mode)) (setq display-buffer-alist '(("\\*e?shell\\*"