From da9a14331f0eed6b1cfc596566691f575691f4ff Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 12 Apr 2024 18:21:12 +0630 Subject: (Emacs/app)+ERC (irc client for Emacs) --- Emacs/.config/emacs/app.org | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index c96d2e8..61ca240 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -830,3 +830,11 @@ and integrates slickly into image-dired. Of course, "k" #'image-previous-line "l" #'image-forward-hscroll)) #+end_src +* ERC +#+begin_src emacs-lisp +(use-package erc + :init + (setq erc-server "irc.libera.chat" + erc-nick "oreodave" + erc-buffer-display "current")) +#+end_src -- cgit v1.2.3-13-gbd6f From e07c2c145722c3fd29d2eec6e5c665b1f3ac8acd Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 16 Apr 2024 21:52:07 +0630 Subject: (Emacs/app)~Made eshell prompt a bit cooler Now it shows if the worktree is unclean and how many commits ahead or behind we are from the remote (if one is set). --- Emacs/.config/emacs/app.org | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 61ca240..ce47e23 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -455,17 +455,39 @@ much faster than ~cd ..; ls -l~). #+begin_src emacs-lisp (use-package eshell :config + (defun +eshell/--git-get-remote-status () + (let* ((branch-status (split-string + (shell-command-to-string "git status | grep 'Your branch is'"))) + (status (nth 3 branch-status)) + (diff (cl-position "by" branch-status :test #'string=))) + (if (null diff) + (propertize "=" 'font-lock-face '(:foreground "green")) + (let ((n (nth (+ 1 diff) branch-status))) + (concat + (cond + ((string= status "ahead") + (propertize "→ " 'font-lock-face '(:foreground "dodger blue"))) + ((string= status "behind") + (propertize "← " 'font-lock-face '(:foreground "orange red")))) + n))))) + + (defun +eshell/--git-get-change-status () + (let ((changed-files (- (length (split-string (shell-command-to-string "git status -s" ) "\n")) 1))) + (if (= changed-files 0) + (propertize "✓" 'font-lock-face '(:foreground "green")) + (propertize (number-to-string changed-files) 'font-lock-face '(:foreground "red"))))) + (defun +eshell/get-git-properties () (let ((git-branch (shell-command-to-string "git branch"))) (if (or (string= git-branch "") (not (string= "*" (substring git-branch 0 1)))) "" (format - "(%s<%s>)" + "(%s<%s>[%s])" (nth 2 (split-string git-branch "\n\\|\\*\\| ")) - (if (string= "" (shell-command-to-string "git status | grep 'up to date'")) - (propertize "×" 'font-lock-face '(:foreground "red")) - (propertize "✓" 'font-lock-face '(:foreground "green"))))))) + (+eshell/--git-get-change-status) + (+eshell/--git-get-remote-status))))) + (defun +eshell/prompt-function () (let ((git (+eshell/get-git-properties))) (mapconcat -- cgit v1.2.3-13-gbd6f From 55862a521696b9e36b43d719587a9f266b21749b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 16 Apr 2024 21:58:44 +0630 Subject: (Emacs/app)+eshell command that goes to `projectile-project-root` if it exists --- Emacs/.config/emacs/app.org | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index ce47e23..8fcecbb 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -520,7 +520,14 @@ much faster than ~cd ..; ls -l~). (defun eshell/goto (&rest args) "Use `read-directory-name' to change directories." - (eshell/cd (list (read-directory-name "Enter directory to go to:"))))) + (eshell/cd (list (read-directory-name "Enter directory to go to:")))) + + (with-eval-after-load "projectile" + (defun eshell/goto-project-root (&rest args) + "Change to directory `projectile-project-root'" + (if (projectile-project-root) + (eshell/cd (list (projectile-project-root))) + (eshell/echo "Projectile not active here..."))))) #+end_src ** Eshell change directory quickly ~eshell/goto~ is a better ~cd~ for eshell. However it is really just -- cgit v1.2.3-13-gbd6f From c3518cb39c2039e0cd434dabcac268920b45da58 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 16 Apr 2024 22:10:39 +0630 Subject: (Emacs/config|app)~disabled a few unused packages --- Emacs/.config/emacs/app.org | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 8fcecbb..347c25f 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -556,7 +556,10 @@ using. (eshell-send-input)) (message "Could not switch eshell: buffer is not real file"))))) #+end_src -* Elfeed +* WIP Elfeed +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: Elfeed is the perfect RSS feed reader, integrated into Emacs perfectly. I've got a set of feeds that I use for a large variety of stuff, mostly media and entertainment. I've also bound " ar" @@ -670,6 +673,8 @@ don't need to write everything myself. (evil-collection-magit-setup))) #+end_src * IBuffer +IBuffer is the dired of buffers: providing the ability to mark +buffers, mass rename/delete and just observe stuff. #+begin_src emacs-lisp (use-package ibuffer :general @@ -679,14 +684,13 @@ don't need to write everything myself. (with-eval-after-load "evil-collection" (evil-collection-ibuffer-setup))) #+end_src -* Processes +* Proced Emacs has two systems for process management: + proced: a general 'top' like interface which allows general management of linux processes + list-processes: a specific Emacs based system that lists processes spawned by Emacs (similar to a top for Emacs specifically) -** Proced Core proced config, just a few bindings and evil collection setup. #+begin_src emacs-lisp (use-package proced @@ -707,7 +711,7 @@ Core proced config, just a few bindings and evil collection setup. (with-eval-after-load "evil-collection" (evil-collection-proced-setup))) #+end_src - +** Proced narrow Along with that I setup the package ~proced-narrow~ which allows further filtering of the process list. #+begin_src emacs-lisp @@ -773,7 +777,10 @@ work for me given the various TeX utilities installed via Arch. :straight (calctex :type git :host github :repo "johnbcoughlin/calctex") :hook (calc-mode-hook . calctex-mode)) #+end_src -* Ledger +* WIP Ledger +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: #+begin_src emacs-lisp (use-package ledger-mode :defer t) @@ -829,7 +836,10 @@ or something, but very annoying as it's a break from standards! :keymaps 'Man-mode-map "RET" #'man-follow)) #+end_src -* gif-screencast +* WIP gif-screencast +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: Little application that uses =gifsicle= to make essentially videos of Emacs. Useful for demonstrating features. #+begin_src emacs-lisp -- cgit v1.2.3-13-gbd6f From 40dab72e6cd8c2b4ba99bccdd9e40bd22cb9eef5 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 18 Apr 2024 14:49:22 +0630 Subject: (Emacs|^)~Some general cleanup --- Emacs/.config/emacs/app.org | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 347c25f..d108e8d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -546,9 +546,7 @@ using. (interactive) (let ((dir (if buffer-file-name (file-name-directory buffer-file-name) - (if default-directory - default-directory - nil))) + default-directory)) (buf (eshell))) (if dir (with-current-buffer buf -- cgit v1.2.3-13-gbd6f From 2b0397b3bcfd915fde2d2823ec1cffcebde19917 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 18 Apr 2024 15:21:27 +0630 Subject: (Emacs/*)~WIP -> WAIT for subtrees that aren't used --- Emacs/.config/emacs/app.org | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index d108e8d..4fda55d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -10,7 +10,7 @@ Applications are greater than packages; they provide a set of functionality to create an interface in Emacs. Emacs comes with applications and others may be installed. -* WIP Dashboard +* WAIT Dashboard :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -260,7 +260,7 @@ Uses fd for finding file results in a directory: ~find-dired~ -> (dir-leader "g" #'fd-dired)) #+end_src -* WIP Xwidget +* WAIT Xwidget :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -554,7 +554,7 @@ using. (eshell-send-input)) (message "Could not switch eshell: buffer is not real file"))))) #+end_src -* WIP Elfeed +* WAIT Elfeed :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -758,7 +758,7 @@ without invoking calc directly: $1 + 2\rightarrow_{\text{calc-embed}} 3$. (with-eval-after-load "evil-collection" (evil-collection-calc-setup))) #+end_src -** WIP Calctex +** WAIT Calctex :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -775,7 +775,7 @@ work for me given the various TeX utilities installed via Arch. :straight (calctex :type git :host github :repo "johnbcoughlin/calctex") :hook (calc-mode-hook . calctex-mode)) #+end_src -* WIP Ledger +* WAIT Ledger :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -786,7 +786,7 @@ work for me given the various TeX utilities installed via Arch. (use-package evil-ledger :after ledger-mode) #+end_src -* WIP Zone +* WAIT Zone :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: @@ -834,7 +834,7 @@ or something, but very annoying as it's a break from standards! :keymaps 'Man-mode-map "RET" #'man-follow)) #+end_src -* WIP gif-screencast +* WAIT gif-screencast :PROPERTIES: :header-args:emacs-lisp: :tangle no :END: -- cgit v1.2.3-13-gbd6f From c76475e427c788ae24e12e283cb07607f89c6526 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 19 Apr 2024 04:39:42 +0530 Subject: (Emacs/*)~cleaning up --- Emacs/.config/emacs/app.org | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 4fda55d..4e413f7 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -213,8 +213,8 @@ are some corners I'd like to adjust). "d" #'dired "D" #'dired-other-frame "i" #'image-dired - "p" `((proc (interactive) - (dired "~/Text/PDFs/")) + "p" `(,(proc (interactive) + (dired "~/Text/PDFs/")) :which-key "Open PDFs")) :config (defun +dired/insert-all-subdirectories () @@ -786,29 +786,23 @@ work for me given the various TeX utilities installed via Arch. (use-package evil-ledger :after ledger-mode) #+end_src -* WAIT Zone -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: +* Zone Of course Emacs has a cool screensaver software. #+begin_src emacs-lisp (use-package zone-matrix :straight t - :after dashboard + :commands (zone) + :general + (leader + "z" #'zone) :init (setq zone-programs - [zone-pgm-jitter - zone-pgm-putz-with-case - zone-pgm-dissolve - zone-pgm-whack-chars - zone-pgm-drip - zone-pgm-rat-race - zone-pgm-random-life - zone-matrix - ]) - :config - (zone-when-idle 15)) + [zone-pgm-drip + zone-pgm-drip-fretfully + zone-pgm-martini-swan-dive + zone-pgm-stress + zone-pgm-random-life])) #+end_src * (Wo)man Man pages are the user manuals for most software on Linux. Really -- cgit v1.2.3-13-gbd6f From 6782fce8899a98929fa34920e72d1325124a5ad6 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 01:46:57 +0530 Subject: (Emacs/app)~move eshell/goto to subheading --- Emacs/.config/emacs/app.org | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 4e413f7..30f845a 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -447,11 +447,6 @@ a git repo in the current directory and provides some extra information in that case (in particular, branch name and if there any changes that haven't been committed). -Also add ~eshell/goto~, which is actually a command accessible from -within eshell (this is because ~eshell/*~ creates an accessible -function within eshell with name ~*~). ~eshell/goto~ makes it easier -to change directories by using Emacs' find-file interface (which is -much faster than ~cd ..; ls -l~). #+begin_src emacs-lisp (use-package eshell :config @@ -480,7 +475,7 @@ much faster than ~cd ..; ls -l~). (defun +eshell/get-git-properties () (let ((git-branch (shell-command-to-string "git branch"))) (if (or (string= git-branch "") - (not (string= "*" (substring git-branch 0 1)))) + (not (string= "*" (substring git-branch 0 1)))) "" (format "(%s<%s>[%s])" @@ -516,25 +511,20 @@ much faster than ~cd ..; ls -l~). eshell-banner-message (concat (shell-command-to-string "fortune | cowsay") "\n") eshell-highlight-prompt nil eshell-prompt-function #'+eshell/prompt-function - eshell-prompt-regexp "^𝜆> ") - - (defun eshell/goto (&rest args) - "Use `read-directory-name' to change directories." - (eshell/cd (list (read-directory-name "Enter directory to go to:")))) - - (with-eval-after-load "projectile" - (defun eshell/goto-project-root (&rest args) - "Change to directory `projectile-project-root'" - (if (projectile-project-root) - (eshell/cd (list (projectile-project-root))) - (eshell/echo "Projectile not active here..."))))) + eshell-prompt-regexp "^𝜆> ")) #+end_src ** Eshell change directory quickly +Add ~eshell/goto~, which is actually a command accessible from within +eshell (this is because ~eshell/*~ creates an accessible function +within eshell with name ~*~). ~eshell/goto~ makes it easier to change +directories by using Emacs' find-file interface (which is much faster +than ~cd ..; ls -l~). + ~eshell/goto~ is a better ~cd~ for eshell. However it is really just a plaster over a bigger issue for my workflow; many times I want eshell to be present in the current directory of the buffer I am -using. - +using. So here's also a command for opening eshell with the current +directory. #+begin_src emacs-lisp (use-package eshell :straight nil @@ -542,6 +532,17 @@ using. (shell-leader "T" #'+eshell/current-buffer) :config + (defun eshell/goto (&rest args) + "Use `read-directory-name' to change directories." + (eshell/cd (list (read-directory-name "Directory?: ")))) + + (with-eval-after-load "projectile" + (defun eshell/goto-project-root (&rest args) + "Change to directory `projectile-project-root'" + (if (projectile-project-root) + (eshell/cd (list (projectile-project-root))) + (eshell/echo "Projectile not active here...")))) + (defun +eshell/current-buffer () (interactive) (let ((dir (if buffer-file-name -- cgit v1.2.3-13-gbd6f From 253f2f5ef9eb0d95639d259a48875d76d3ecab75 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 01:47:17 +0530 Subject: (Emacs/app)+randomise banner-message's cowsay --- Emacs/.config/emacs/app.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 30f845a..bfea843 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -506,9 +506,17 @@ changes that haven't been committed). "\n" '("𝜆> " :foreground "DeepSkyBlue"))))) + (defun +eshell/banner-message () + (concat (shell-command-to-string + (let ((possible-cows '("default" "cower" "moofasa" "moose" + "mutilated" "satanic" "sheep" + "small" "tux" "vader"))) + (format "fortune | cowsay -f %s" (nth (random (length possible-cows)) possible-cows)))) + "\n")) + (setq eshell-cmpl-ignore-case t eshell-cd-on-directory t - eshell-banner-message (concat (shell-command-to-string "fortune | cowsay") "\n") + eshell-banner-message '(+eshell/banner-message) eshell-highlight-prompt nil eshell-prompt-function #'+eshell/prompt-function eshell-prompt-regexp "^𝜆> ")) -- cgit v1.2.3-13-gbd6f From 2baf2fca03a6d0201939a4b4201b8b6e5a9bda3f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 16:58:33 +0530 Subject: (Emacs/app|lang)~pdf-tools is disabled, dired-guess-shell pdf zathura I find pdf-tools really slow in comparison to zathura, with very little benefit to it being integrated into Emacs. Zathura is faster, leaner and more fit for purpose. PDFs, if a shell command may be invoked on them in dired, now show zathura as a default argument. --- Emacs/.config/emacs/app.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index bfea843..669b1c5 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -217,6 +217,7 @@ are some corners I'd like to adjust). (dired "~/Text/PDFs/")) :which-key "Open PDFs")) :config + (add-to-list 'dired-guess-shell-alist-user '("\\.pdf\\'" "zathura")) (defun +dired/insert-all-subdirectories () "Insert all subdirectories currently viewable." (interactive) @@ -247,7 +248,6 @@ are some corners I'd like to adjust). "m" #'dired-mark-files-regexp "u" #'dired-undo)) #+end_src - ** fd-dired Uses fd for finding file results in a directory: ~find-dired~ -> ~fd-dired~. -- cgit v1.2.3-13-gbd6f From 92310685d1056fdf549905cbddd1625951fd34d8 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 16:59:31 +0530 Subject: (Emacs/app)-magit-file-dispatch (vf) and magit-blame (vb) --- Emacs/.config/emacs/app.org | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 669b1c5..38f94a1 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -659,9 +659,7 @@ don't need to write everything myself. (display-buffer-same-window)) :general (leader - "g" '(magit-dispatch :which-key "Magit") - "vf" '(magit-file-dispatch :which-key "Magit file") - "vb" '(magit-blame :which-key "Magit blame")) + "g" '(magit-dispatch :which-key "Magit")) (code-leader "b" #'magit-blame) :auto-insert -- cgit v1.2.3-13-gbd6f From c3ecf07798d5a32b959e54f60429b9fbcb95af5c Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 17:00:11 +0530 Subject: (Emacs/app)+wdired binding --- Emacs/.config/emacs/app.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 38f94a1..c75e8f1 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -260,6 +260,21 @@ Uses fd for finding file results in a directory: ~find-dired~ -> (dir-leader "g" #'fd-dired)) #+end_src +** wdired +Similar to [[file:config.org::*(Rip)grep][wgrep]] =wdired= provides +the ability to use Emacs motions and editing on file names. This +makes stuff like mass renaming and other file management tasks way +easier than even using the mark based system. +#+begin_src emacs-lisp +(use-package wdired + :after dired + :straight t + :general + (nmmap + :keymaps 'dired-mode-map + "." #'browse-url-of-dired-file + "W" #'wdired-change-to-wdired-mode)) +#+end_src * WAIT Xwidget :PROPERTIES: :header-args:emacs-lisp: :tangle no -- cgit v1.2.3-13-gbd6f From a01cba5589368b6b2c3946d1286e8b295ab3403d Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 23 Apr 2024 18:18:05 +0530 Subject: (Emacs/*)~stop using create-toggle-function --- Emacs/.config/emacs/app.org | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index c75e8f1..5b94a9d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -96,7 +96,7 @@ to the kill ring and bind it to "Y". :keymaps 'calendar-mode-map "Y" #'+calendar/copy-date) (app-leader - "d" #'+calendar/toggle-calendar) + "d" #'calendar) :config (defun +calendar/copy-date () "Copy date under cursor into kill ring." @@ -106,12 +106,7 @@ to the kill ring and bind it to "Y". (let ((date (calendar-cursor-to-date))) (when date (setq date (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))) - (kill-new (format-time-string "%Y-%m-%d" date)))))) - (+oreo/create-toggle-function - +calendar/toggle-calendar - "*Calendar*" - calendar - nil)) + (kill-new (format-time-string "%Y-%m-%d" date))))))) #+end_src * Mail Mail is a funny thing; most people use it just for business or @@ -417,7 +412,7 @@ function to pull up the eshell quickly. :commands +shell/toggle-eshell :general (shell-leader - "t" #'+shell/toggle-eshell) + "t" #'eshell) :init (add-hook 'eshell-mode-hook @@ -432,13 +427,7 @@ function to pull up the eshell quickly. :keymaps 'eshell-mode-map "c" (proc (interactive) (eshell/clear) (recenter)) - "k" #'eshell-kill-process))) - :config - (+oreo/create-toggle-function - +shell/toggle-eshell - "*eshell*" - eshell - t)) + "k" #'eshell-kill-process)))) #+end_src ** Eshell pretty symbols and display Pretty symbols and a display record. -- cgit v1.2.3-13-gbd6f From 617b849be18420eeb32e599acbfd63ca0bdee020 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 24 Apr 2024 03:41:32 +0530 Subject: (Emacs/app)+some defer statements to make bootup quicker Cuts a second off the time to bootup. --- Emacs/.config/emacs/app.org | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 5b94a9d..1cda909 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -409,7 +409,7 @@ Bind some evil-like movements for easy shell usage, and a toggle function to pull up the eshell quickly. #+begin_src emacs-lisp (use-package eshell - :commands +shell/toggle-eshell + :defer t :general (shell-leader "t" #'eshell) @@ -453,6 +453,7 @@ changes that haven't been committed). #+begin_src emacs-lisp (use-package eshell + :defer t :config (defun +eshell/--git-get-remote-status () (let* ((branch-status (split-string @@ -539,7 +540,7 @@ using. So here's also a command for opening eshell with the current directory. #+begin_src emacs-lisp (use-package eshell - :straight nil + :defer t :general (shell-leader "T" #'+eshell/current-buffer) @@ -875,6 +876,7 @@ and integrates slickly into image-dired. Of course, * ERC #+begin_src emacs-lisp (use-package erc + :defer t :init (setq erc-server "irc.libera.chat" erc-nick "oreodave" -- cgit v1.2.3-13-gbd6f From aedab997d32d162ac18b34cf0f540c2b785a686d Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 24 Apr 2024 03:42:11 +0530 Subject: (Emacs/app)+mpv package Only really useful for integration in org-mode --- Emacs/.config/emacs/app.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 1cda909..415019c 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -882,3 +882,19 @@ and integrates slickly into image-dired. Of course, erc-nick "oreodave" erc-buffer-display "current")) #+end_src +* MPV +Basically a porcelain over mpv via the IPC interface. +#+begin_src emacs-lisp +(use-package mpv + :defer t + :straight t + :config + (with-eval-after-load "org" + (defun org-mpv-complete-link (&optional arg) + (replace-regexp-in-string + "file:" "mpv:" + (org-link-complete-file arg) + t t)) + (org-link-set-parameters "mpv" + :follow #'mpv-play :complete #'org-mpv-complete-link))) +#+end_src -- cgit v1.2.3-13-gbd6f From a08ebf097a90429d080acd1b62e9179894538e1e Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 27 Apr 2024 15:42:54 +0530 Subject: (Emacs/app|config)~change some window heights in :display --- Emacs/.config/emacs/app.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 415019c..5145d4a 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -443,7 +443,7 @@ Pretty symbols and a display record. :display ("\\*e?shell\\*" ; for general shells as well (display-buffer-at-bottom) - (window-height . 0.40))) + (window-height . 0.30))) #+end_src ** Eshell variables and aliases Set some sane defaults, a banner and a prompt. The prompt checks for -- cgit v1.2.3-13-gbd6f From ce066bd6b2a89d0b3d0e9f8677c5772cfbd3cd01 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 27 Apr 2024 15:43:18 +0530 Subject: (Emacs/app)~enabled elfeed and added changed feeds --- Emacs/.config/emacs/app.org | 47 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 5145d4a..485c891 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -568,10 +568,7 @@ directory. (eshell-send-input)) (message "Could not switch eshell: buffer is not real file"))))) #+end_src -* WAIT Elfeed -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: +* Elfeed Elfeed is the perfect RSS feed reader, integrated into Emacs perfectly. I've got a set of feeds that I use for a large variety of stuff, mostly media and entertainment. I've also bound " ar" @@ -587,31 +584,26 @@ to elfeed for loading the system. "" #'elfeed-search-show-entry) :init (setq elfeed-db-directory (no-littering-expand-var-file-name "elfeed/")) + (setq +rss/feed-urls '(("Arch Linux" "https://www.archlinux.org/feeds/news/" - Linux) - ("LEMMiNO" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCRcgy6GzDeccI7dkbbBna3Q" - YouTube Stories) + News Technology) ("The Onion" "https://www.theonion.com/rss" Social) - ("Stack exchange" - "http://morss.aryadevchavali.com/stackexchange.com/feeds/questions" - Social) - ("Dark Sominium" - "https://www.youtube.com/feeds/videos.xml?channel_id=UC_e39rWdkQqo5-LbiLiU10g" - YouTube Stories) - ("Dark Sominium Music" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCkLiZ_zLynyNd5fd62hg1Kw" - YouTube Music) + ("Protesilaos Stavrou" + "https://www.youtube.com/@protesilaos" + YouTube Technology) + ("Tsoding Daily" + "https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg" + YouTube Technology) + ("Tsoding" + "https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg" + YouTube Technology) ("Nexpo" "https://www.youtube.com/feeds/videos.xml?channel_id=UCpFFItkfZz1qz5PpHpqzYBw" - YouTube) - ("Techquickie" - "https://www.youtube.com/feeds/videos.xml?channel_id=UC0vBXGSyV14uvJ4hECDOl0Q" - YouTube) + YouTube Stories) ("3B1B" "https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw" YouTube) @@ -625,20 +617,15 @@ to elfeed for loading the system. "https://www.youtube.com/feeds/videos.xml?channel_id=UCn8OYopT9e8tng-CGEWzfmw" YouTube Stories) ("Hacker News" - "http://morss.aryadevchavali.com/news.ycombinator.com/rss" - Social) + "https://news.ycombinator.com/rss" + Social News Technology) ("Hacker Factor" "https://www.hackerfactor.com/blog/index.php?/feeds/index.rss2" - Social) - ("BBC Top News" - "http://morss.aryadevchavali.com/feeds.bbci.co.uk/news/rss.xml" - News) - ("BBC Tech News" - "http://morss.aryadevchavali.com/feeds.bbci.co.uk/news/technology/rss.xml" - News))) + Social))) :config (with-eval-after-load "evil-collection" (evil-collection-elfeed-setup)) + (setq elfeed-feeds (cl-map 'list #'(lambda (item) (append (list (nth 1 item)) (cdr (cdr item)))) +rss/feed-urls))) -- cgit v1.2.3-13-gbd6f From c08bf7e1b835dab5273980ec89fec4c2a3441329 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 27 Apr 2024 15:43:31 +0530 Subject: (Emacs/app)+elfeed advice to open articles in different applications --- Emacs/.config/emacs/app.org | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 485c891..a173269 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -628,7 +628,18 @@ to elfeed for loading the system. (setq elfeed-feeds (cl-map 'list #'(lambda (item) (append (list (nth 1 item)) (cdr (cdr item)))) - +rss/feed-urls))) + +rss/feed-urls)) + + (advice-add 'elfeed-search-show-entry :after #'+elfeed/dispatch-entry) + + (defun +elfeed/dispatch-entry (entry) + "Process each type of entry differently. + e.g., you may want to open HN entries in eww." + (let ((url (elfeed-entry-link entry))) + (pcase url + ((pred (string-match-p "https\\:\\/\\/www.youtube.com\\/watch")) + (mpv-play-url url)) + (_ (eww url)))))) #+end_src * Magit Magit is *the* git porcelain for Emacs, which perfectly encapsulates -- cgit v1.2.3-13-gbd6f From 2986c04c2fcad44eb80ce01336ade33a7429cf7a Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 6 May 2024 02:23:38 +0530 Subject: (Emacs|Shell|SystemD)~Small changes --- Emacs/.config/emacs/app.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index a173269..4791444 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -158,8 +158,7 @@ integrate it into my workflow just a bit better. (notmuch-tag-change-list '("-inbox" "+flagged") unflag) beg end) (when (eq beg end) (notmuch-search-next-thread))) - (advice-add #'notmuch-poll-and-refresh-this-buffer :before - #'+mail/sync-mail) + (advice-add #'notmuch-poll-and-refresh-this-buffer :after #'+mail/trash-junk) (with-eval-after-load "evil-collection" @@ -194,7 +193,8 @@ are some corners I'd like to adjust). :init (setq-default dired-listing-switches "-AFBlu --group-directories-first" dired-omit-files "^\\." - dired-dwim-target t) + dired-dwim-target t + image-dired-external-viewer "nsxiv") (with-eval-after-load "evil-collection" (evil-collection-dired-setup)) :general @@ -443,7 +443,7 @@ Pretty symbols and a display record. :display ("\\*e?shell\\*" ; for general shells as well (display-buffer-at-bottom) - (window-height . 0.30))) + (window-height . 0.33))) #+end_src ** Eshell variables and aliases Set some sane defaults, a banner and a prompt. The prompt checks for -- cgit v1.2.3-13-gbd6f From 2450e47882750f1a46911f99503a068df84c2181 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 8 May 2024 01:17:29 +0530 Subject: (Scripts|Emacs/app)~ported eshell banner to a script Instead of doing it all in Emacs lisp (which while pretty fun to write, is not fun to execute outside of Emacs), I wrote a shell script which generates the same banners, then just linked +eshell/banner-message to it. --- Emacs/.config/emacs/app.org | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 4791444..590bd4d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -512,11 +512,7 @@ changes that haven't been committed). '("𝜆> " :foreground "DeepSkyBlue"))))) (defun +eshell/banner-message () - (concat (shell-command-to-string - (let ((possible-cows '("default" "cower" "moofasa" "moose" - "mutilated" "satanic" "sheep" - "small" "tux" "vader"))) - (format "fortune | cowsay -f %s" (nth (random (length possible-cows)) possible-cows)))) + (concat (shell-command-to-string "~/.local/scripts/cowfortune") "\n")) (setq eshell-cmpl-ignore-case t -- cgit v1.2.3-13-gbd6f From d998ae45cfbf71601061c052848a3e3c5aa0c9b7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 8 May 2024 01:30:04 +0530 Subject: (Emacs/*)~disable a lot of packages Don't use them most of the time so what's the need? If I'm ever in the situation where I need to use these I hope I have internet connection. --- Emacs/.config/emacs/app.org | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 590bd4d..d5201a6 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -564,7 +564,10 @@ directory. (eshell-send-input)) (message "Could not switch eshell: buffer is not real file"))))) #+end_src -* Elfeed +* WAIT Elfeed +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: Elfeed is the perfect RSS feed reader, integrated into Emacs perfectly. I've got a set of feeds that I use for a large variety of stuff, mostly media and entertainment. I've also bound " ar" @@ -715,18 +718,6 @@ Core proced config, just a few bindings and evil collection setup. (with-eval-after-load "evil-collection" (evil-collection-proced-setup))) #+end_src -** Proced narrow -Along with that I setup the package ~proced-narrow~ which allows -further filtering of the process list. -#+begin_src emacs-lisp -(use-package proced-narrow - :straight t - :after proced - :general - (nmap - :keymaps 'proced-mode-map - "%" #'proced-narrow)) -#+end_src * Calculator Surprise, surprise Emacs comes with a calculator. @@ -867,7 +858,10 @@ and integrates slickly into image-dired. Of course, "k" #'image-previous-line "l" #'image-forward-hscroll)) #+end_src -* ERC +* WAIT ERC +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: #+begin_src emacs-lisp (use-package erc :defer t -- cgit v1.2.3-13-gbd6f From a6fffa384c0e383e3ea6d5daab3c61f60478c871 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 8 May 2024 01:30:48 +0530 Subject: (Emacs/app|config)~w(grep|dired) have the same finish/abort binds ZZ and ZQ. --- Emacs/.config/emacs/app.org | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index d5201a6..089a3d4 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -267,8 +267,11 @@ easier than even using the mark based system. :general (nmmap :keymaps 'dired-mode-map - "." #'browse-url-of-dired-file - "W" #'wdired-change-to-wdired-mode)) + "W" #'wdired-change-to-wdired-mode) + (nmmap + :keymaps 'wdired-mode-map + "ZZ" #'wdired-finish-edit + "ZQ" #'wdired-abort-changes)) #+end_src * WAIT Xwidget :PROPERTIES: -- cgit v1.2.3-13-gbd6f From d4f4169b9c6fca694094df1443adb787b9894e4a Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 8 May 2024 01:34:31 +0530 Subject: (Emacs/app)~rearranged dired config Put more stuff in :general and it seems to work?! --- Emacs/.config/emacs/app.org | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 089a3d4..6357b93 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -200,9 +200,11 @@ are some corners I'd like to adjust). :general (nmmap :keymaps 'dired-mode-map - "T" #'dired-create-empty-file - "H" #'dired-up-directory - "L" #'dired-find-file) + "SPC" nil + "SPC ," nil + "T" #'dired-create-empty-file + "H" #'dired-up-directory + "L" #'dired-find-file) (dir-leader "f" #'find-dired "d" #'dired @@ -211,20 +213,6 @@ are some corners I'd like to adjust). "p" `(,(proc (interactive) (dired "~/Text/PDFs/")) :which-key "Open PDFs")) - :config - (add-to-list 'dired-guess-shell-alist-user '("\\.pdf\\'" "zathura")) - (defun +dired/insert-all-subdirectories () - "Insert all subdirectories currently viewable." - (interactive) - (dired-mark-directories nil) - (dolist #'dired-insert-subdir (dired-get-marked-files)) - (dired-unmark-all-marks)) - - (nmmap - :keymaps 'dired-mode-map - "SPC" nil - "SPC ," nil) - (nmmap :keymaps 'image-dired-thumbnail-mode-map "h" #'image-dired-backward-image @@ -242,6 +230,14 @@ are some corners I'd like to adjust). "l" #'dired-maybe-insert-subdir "m" #'dired-mark-files-regexp "u" #'dired-undo)) + :config + (add-to-list 'dired-guess-shell-alist-user '("\\.pdf\\'" "zathura")) + (defun +dired/insert-all-subdirectories () + "Insert all subdirectories currently viewable." + (interactive) + (dired-mark-directories nil) + (mapc #'dired-insert-subdir (dired-get-marked-files)) + (dired-unmark-all-marks))) #+end_src ** fd-dired Uses fd for finding file results in a directory: ~find-dired~ -> -- cgit v1.2.3-13-gbd6f From 89ce0a30121e5b3aab71d3b9977a940c4b658fb5 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 8 May 2024 01:35:25 +0530 Subject: (Emacs/app)~dired-other(frame->window) and added dired-subdir binds --- Emacs/.config/emacs/app.org | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 6357b93..63434ab 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -208,11 +208,20 @@ are some corners I'd like to adjust). (dir-leader "f" #'find-dired "d" #'dired - "D" #'dired-other-frame + "D" #'dired-other-window "i" #'image-dired "p" `(,(proc (interactive) (dired "~/Text/PDFs/")) :which-key "Open PDFs")) + (local-leader + :keymaps 'dired-mode-map + "i" #'dired-maybe-insert-subdir + "I" #'+dired/insert-all-subdirectories + "k" #'dired-prev-subdir + "j" #'dired-next-subdir + "K" #'dired-kill-subdir + "m" #'dired-mark-files-regexp + "u" #'dired-undo) (nmmap :keymaps 'image-dired-thumbnail-mode-map "h" #'image-dired-backward-image @@ -224,12 +233,6 @@ are some corners I'd like to adjust). "RET" #'image-dired-display-this "m" #'image-dired-mark-thumb-original-file "q" #'quit-window) - - (local-leader - :keymaps 'dired-mode-map - "l" #'dired-maybe-insert-subdir - "m" #'dired-mark-files-regexp - "u" #'dired-undo)) :config (add-to-list 'dired-guess-shell-alist-user '("\\.pdf\\'" "zathura")) (defun +dired/insert-all-subdirectories () -- cgit v1.2.3-13-gbd6f From 31329c3dab4e794ac3b3b801db57a2e9d745c771 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 10 May 2024 01:05:35 +0530 Subject: (Emacs/app)~+eshell/current-buffer command now uses T --- Emacs/.config/emacs/app.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 63434ab..d4ac94d 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -540,7 +540,7 @@ directory. (use-package eshell :defer t :general - (shell-leader + (leader "T" #'+eshell/current-buffer) :config (defun eshell/goto (&rest args) -- cgit v1.2.3-13-gbd6f From 40240bbfd7d508570856fdaa43274baa31a30e53 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 11 May 2024 13:04:45 +0530 Subject: (Emacs/app)~changed project-root function and added aliases project-root now uses project.el. aliases for goto and project-root. --- Emacs/.config/emacs/app.org | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index d4ac94d..6448ea5 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -547,12 +547,12 @@ directory. "Use `read-directory-name' to change directories." (eshell/cd (list (read-directory-name "Directory?: ")))) - (with-eval-after-load "projectile" - (defun eshell/goto-project-root (&rest args) - "Change to directory `projectile-project-root'" - (if (projectile-project-root) - (eshell/cd (list (projectile-project-root))) - (eshell/echo "Projectile not active here...")))) + (defun eshell/project-root (&rest args) + "Change to directory `project-root'" + (if (project-current) + (eshell/cd (list (project-root (project-current)))) + (eshell/echo (format "[%s]: No project in current directory" + (propertize "Error" 'font-lock-face '(:foreground "red")))))) (defun +eshell/current-buffer () (interactive) -- cgit v1.2.3-13-gbd6f From ebf18a5209aaf6f79baa536a0686441b60930d5f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 11 May 2024 13:06:08 +0530 Subject: (Emacs/app)+eww bookmark functionality Search and edit bookmarks very quickly. --- Emacs/.config/emacs/app.org | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org index 6448ea5..e5e8cb8 100644 --- a/Emacs/.config/emacs/app.org +++ b/Emacs/.config/emacs/app.org @@ -67,7 +67,9 @@ engine, which makes sense as it's primarily a text interface. :defer t :general (app-leader - "w" #'eww) + "ww" #'eww + "wb" #'+eww/bookmarks-search + "we" #'+eww/bookmarks-edit) (nmmap :keymaps 'eww-mode-map "w" #'evil-forward-word-begin @@ -75,7 +77,22 @@ engine, which makes sense as it's primarily a text interface. :straight nil :config (with-eval-after-load "evil-collection" - (evil-collection-eww-setup))) + (evil-collection-eww-setup)) + (defun bookmark->alist (bookmark) + (cons (plist-get bookmark :title) + (plist-get bookmark :url))) + (defun +eww/bookmarks-edit nil + (interactive) + (find-file (concat eww-bookmarks-directory "eww-bookmarks"))) + (defun +eww/bookmarks-search nil + (interactive) + (let ((bookmarks (mapcar #'bookmark->alist eww-bookmarks))) + (eww + (alist-get (completing-read "Bookmark: " (mapcar #'car bookmarks) nil t) + bookmarks + nil + nil + #'string=))))) #+end_src * Calendar Calendar is a simple inbuilt application that helps with date -- cgit v1.2.3-13-gbd6f From 8fcdfac6614e1ea84f2bfd100b5713ce7dce2db0 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 13 May 2024 16:58:28 +0530 Subject: (Emacs)~Merged app.org, lang.org and core.org back into config.org Just makes it easier to profile and deal with compilation --- Emacs/.config/emacs/app.org | 907 -------------------------------------------- 1 file changed, 907 deletions(-) delete mode 100644 Emacs/.config/emacs/app.org (limited to 'Emacs/.config/emacs/app.org') diff --git a/Emacs/.config/emacs/app.org b/Emacs/.config/emacs/app.org deleted file mode 100644 index e5e8cb8..0000000 --- a/Emacs/.config/emacs/app.org +++ /dev/null @@ -1,907 +0,0 @@ -#+title: Applications for Emacs -#+author: Aryadev Chavali -#+description: Applications for my Emacs OS™ -#+date: 2023-09-29 -#+property: header-args:emacs-lisp :tangle app.el :comments link :results none -#+options: toc:nil -#+startup: noindent - -Applications are greater than packages; they provide a set of -functionality to create an interface in Emacs. Emacs comes with -applications and others may be installed. - -* WAIT Dashboard -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -Dashboard creates a custom dashboard for Emacs that replaces the -initial startup screen in default Emacs. It has a lot of customising -options. - -Unfortunately not that useful, many things are easier to invoke -directly such as recent files or project changing. -#+begin_src emacs-lisp -(use-package dashboard - :straight t - :demand t - :general - (app-leader - "b" #'dashboard-refresh-buffer) - (:states '(normal motion emacs) - :keymaps 'dashboard-mode-map - "q" (proc (interactive) (kill-this-buffer))) - (nmmap - :keymaps 'dashboard-mode-map - "r" #'dashboard-jump-to-recent-files - "p" #'dashboard-jump-to-projects - "}" #'dashboard-next-section - "{" #'dashboard-previous-section) - :init - (setq initial-buffer-choice nil - dashboard-banner-logo-title "Oreomacs" - dashboard-center-content t - dashboard-set-init-info t - dashboard-startup-banner (no-littering-expand-etc-file-name "dashboard/logo.png") - dashboard-set-footer t - dashboard-set-navigator t - dashboard-items '((projects . 5) - (recents . 5)) - dashboard-footer-messages (list - "Collecting parentheses..." - "Linking 'coffee_machine.o'..." - "Uploading ip to hacker named 4chan..." - "Dividing by zero..." - "Solving 3-sat..." - "Obtaining your health record..." - (format "Recompiling Emacs for the %dth time..." (random 1000)) - "Escaping the cycle of samsara...")) - :config - (dashboard-setup-startup-hook)) -#+end_src -* EWW -Emacs Web Wowser is the inbuilt text based web browser for Emacs. It -can render images and basic CSS styles but doesn't have a JavaScript -engine, which makes sense as it's primarily a text interface. -#+begin_src emacs-lisp -(use-package eww - :defer t - :general - (app-leader - "ww" #'eww - "wb" #'+eww/bookmarks-search - "we" #'+eww/bookmarks-edit) - (nmmap - :keymaps 'eww-mode-map - "w" #'evil-forward-word-begin - "Y" #'shr-probe-and-copy-url) - :straight nil - :config - (with-eval-after-load "evil-collection" - (evil-collection-eww-setup)) - (defun bookmark->alist (bookmark) - (cons (plist-get bookmark :title) - (plist-get bookmark :url))) - (defun +eww/bookmarks-edit nil - (interactive) - (find-file (concat eww-bookmarks-directory "eww-bookmarks"))) - (defun +eww/bookmarks-search nil - (interactive) - (let ((bookmarks (mapcar #'bookmark->alist eww-bookmarks))) - (eww - (alist-get (completing-read "Bookmark: " (mapcar #'car bookmarks) nil t) - bookmarks - nil - nil - #'string=))))) -#+end_src -* Calendar -Calendar is a simple inbuilt application that helps with date -functionalities. I add functionality to copy dates from the calendar -to the kill ring and bind it to "Y". -#+begin_src emacs-lisp -(use-package calendar - :straight nil - :defer t - :commands (+calendar/copy-date +calendar/toggle-calendar) - :display - ("\\*Calendar\\*" - (display-buffer-at-bottom) - (inhibit-duplicate-buffer . t) - (window-height . 0.17)) - :general - (nmmap - :keymaps 'calendar-mode-map - "Y" #'+calendar/copy-date) - (app-leader - "d" #'calendar) - :config - (defun +calendar/copy-date () - "Copy date under cursor into kill ring." - (interactive) - (if (use-region-p) - (call-interactively #'kill-ring-save) - (let ((date (calendar-cursor-to-date))) - (when date - (setq date (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))) - (kill-new (format-time-string "%Y-%m-%d" date))))))) -#+end_src -* Mail -Mail is a funny thing; most people use it just for business or -advertising and it's come out of use in terms of personal -communication in the west for the most part (largely due to "social" -media applications). However, this isn't true for the open source and -free software movement who heavily use mail for communication. - -Integrating mail into Emacs helps as I can send source code and -integrate it into my workflow just a bit better. -** Notmuch -#+begin_src emacs-lisp -(use-package notmuch - :defer t - :commands (notmuch +mail/flag-thread) - :general - (app-leader "m" #'notmuch) - (nmap - :keymaps 'notmuch-search-mode-map - "f" #'+mail/flag-thread) - :init - (defconst +mail/signature "---------------\nAryadev Chavali") - (defconst +mail/local-dir (no-littering-expand-var-file-name "mail/")) - (setq notmuch-show-logo nil - notmuch-search-oldest-first nil - notmuch-hello-sections '(notmuch-hello-insert-saved-searches - notmuch-hello-insert-alltags - notmuch-hello-insert-recent-searches) - notmuch-archive-tags '("-inbox" "-unread" "+archive") - mail-signature +mail/signature - mail-default-directory +mail/local-dir - mail-source-directory +mail/local-dir - message-signature +mail/signature - message-auto-save-directory +mail/local-dir - message-directory +mail/local-dir) - - (defun +mail/sync-mail () - "Sync mail via mbsync." - (interactive) - (start-process-shell-command "" nil "mbsync -a")) - (defun +mail/trash-junk () - "Delete any mail in junk" - (interactive) - (start-process-shell-command "" nil "notmuch search --output=files --format=text0 tag:deleted tag:spam tag:trash tag:junk | xargs -r0 rm")) - :config - (defun +mail/flag-thread (&optional unflag beg end) - (interactive (cons current-prefix-arg (notmuch-interactive-region))) - (notmuch-search-tag - (notmuch-tag-change-list '("-inbox" "+flagged") unflag) beg end) - (when (eq beg end) - (notmuch-search-next-thread))) - - (advice-add #'notmuch-poll-and-refresh-this-buffer :after - #'+mail/trash-junk) - (with-eval-after-load "evil-collection" - (evil-collection-notmuch-setup))) -#+end_src -** Smtpmail -#+begin_src emacs-lisp -(use-package smtpmail - :straight nil - :commands mail-send - :init - (setq-default - smtpmail-smtp-server "mail.aryadevchavali.com" - smtpmail-smtp-user "aryadev" - smtpmail-smtp-service 587 - smtpmail-stream-type 'starttls - send-mail-function #'smtpmail-send-it - message-send-mail-function #'smtpmail-send-it)) -#+end_src -* Dired -Setup for dired. Make dired-hide-details-mode the default mode when -using dired-mode, as it removes the clutter. Setup evil collection -for dired (even though dired doesn't really conflict with evil, there -are some corners I'd like to adjust). -#+begin_src emacs-lisp -(use-package dired - :straight nil - :commands (dired find-dired) - :hook - (dired-mode-hook . auto-revert-mode) - (dired-mode-hook . dired-hide-details-mode) - :init - (setq-default dired-listing-switches "-AFBlu --group-directories-first" - dired-omit-files "^\\." - dired-dwim-target t - image-dired-external-viewer "nsxiv") - (with-eval-after-load "evil-collection" - (evil-collection-dired-setup)) - :general - (nmmap - :keymaps 'dired-mode-map - "SPC" nil - "SPC ," nil - "T" #'dired-create-empty-file - "H" #'dired-up-directory - "L" #'dired-find-file) - (dir-leader - "f" #'find-dired - "d" #'dired - "D" #'dired-other-window - "i" #'image-dired - "p" `(,(proc (interactive) - (dired "~/Text/PDFs/")) - :which-key "Open PDFs")) - (local-leader - :keymaps 'dired-mode-map - "i" #'dired-maybe-insert-subdir - "I" #'+dired/insert-all-subdirectories - "k" #'dired-prev-subdir - "j" #'dired-next-subdir - "K" #'dired-kill-subdir - "m" #'dired-mark-files-regexp - "u" #'dired-undo) - (nmmap - :keymaps 'image-dired-thumbnail-mode-map - "h" #'image-dired-backward-image - "l" #'image-dired-forward-image - "j" #'image-dired-next-line - "k" #'image-dired-previous-line - "H" #'image-dired-display-previous - "L" #'image-dired-display-next - "RET" #'image-dired-display-this - "m" #'image-dired-mark-thumb-original-file - "q" #'quit-window) - :config - (add-to-list 'dired-guess-shell-alist-user '("\\.pdf\\'" "zathura")) - (defun +dired/insert-all-subdirectories () - "Insert all subdirectories currently viewable." - (interactive) - (dired-mark-directories nil) - (mapc #'dired-insert-subdir (dired-get-marked-files)) - (dired-unmark-all-marks))) -#+end_src -** fd-dired -Uses fd for finding file results in a directory: ~find-dired~ -> -~fd-dired~. - -#+begin_src emacs-lisp -(use-package fd-dired - :after dired - :straight t - :general - (dir-leader - "g" #'fd-dired)) -#+end_src -** wdired -Similar to [[file:config.org::*(Rip)grep][wgrep]] =wdired= provides -the ability to use Emacs motions and editing on file names. This -makes stuff like mass renaming and other file management tasks way -easier than even using the mark based system. -#+begin_src emacs-lisp -(use-package wdired - :after dired - :straight t - :general - (nmmap - :keymaps 'dired-mode-map - "W" #'wdired-change-to-wdired-mode) - (nmmap - :keymaps 'wdired-mode-map - "ZZ" #'wdired-finish-edit - "ZQ" #'wdired-abort-changes)) -#+end_src -* WAIT Xwidget -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -Xwidget is a package which allows for the insertion of arbitrary -xwidgets into Emacs through buffers. It must be compiled into Emacs -so you might need to customise your install. One of its premier uses -is in navigating the web which it provides through the function -~xwidget-webkit-browse-url~. This renders a fully functional web -browser within Emacs. - -Though I am not to keen on using Emacs to browse the web /via/ xwidget -(EWW does a good job on its own), I am very interested in its -capability to render pages with JavaScript, as it may come of use when -doing web development. I can see the results of work very quickly -without switching windows all within Emacs. - -2023-10-20: Disabled as it didn't seem to work, and honestly wasn't -that useful. -** Xwidget Core -#+begin_src emacs-lisp -(use-package xwidget - :straight nil - :general - (app-leader - "u" #'xwidget-webkit-browse-url) - (nmmap - :keymaps 'xwidget-webkit-mode-map - "q" #'quit-window - "h" #'xwidget-webkit-scroll-backward - "j" #'xwidget-webkit-scroll-up - "k" #'xwidget-webkit-scroll-down - "l" #'xwidget-webkit-scroll-forward - "+" #'xwidget-webkit-zoom-in - "-" #'xwidget-webkit-zoom-out - (kbd "C-f") #'xwidget-webkit-scroll-up - (kbd "C-b") #'xwidget-webkit-scroll-down - "H" #'xwidget-webkit-back - "L" #'xwidget-webkit-forward - "gu" #'xwidget-webkit-browse-url - "gr" #'xwidget-webkit-reload - "gg" #'xwidget-webkit-scroll-top - "G" #'xwidget-webkit-scroll-bottom)) -#+end_src -** Xwidget Extensions -Define a function ~+xwidget/render-file~ that reads a file name and -presents it in an xwidget. If the current file is an HTML file, ask -if user wants to open current file. Bind it to ~aU~ in the leader. - -Also define a function ~+xwidget/search-query~ that first asks the -user what search engine they want to use ([[https://duckduckgo.com][Duck Duck Go]] and [[https://devdocs.io][DevDocs]] -currently) then asks for a query, which it parses then presents in an -xwidget window. Bind to ~as~ in the leader. -#+begin_src emacs-lisp -(use-package xwidget - :straight nil - :commands (+xwidget/render-file +xwidget/search) - :general - (app-leader - "U" #'+xwidget/render-file - "s" #'+xwidget/search) - :config - (setenv "WEBKIT_FORCE_SANDBOX" "0") - (defun +xwidget/render-file (&optional FORCE) - "Find file (or use current file) and render in xwidget." - (interactive) - (cond - ((and (not FORCE) (or (string= (replace-regexp-in-string ".*.html" - "html" (buffer-name)) "html") - (eq major-mode 'web-mode) - (eq major-mode 'html-mode))) ; If in html file - (if (y-or-n-p "Open current file?: ") ; Maybe they want to open a separate file - (xwidget-webkit-browse-url (format "file://%s" (buffer-file-name))) - (+xwidget/render-file t))) ; recurse and open file via prompt - (t - (xwidget-webkit-browse-url - (format "file://%s" (read-file-name "Enter file to open: ")))))) - - (defun +xwidget/search () - "Run a search query on some search engine and display in -xwidget." - (interactive) - (let* ((engine (completing-read "Engine: " '("duckduckgo.com" "devdocs.io") nil t)) - (query-raw (read-string "Enter query: ")) - (query - (cond - ((string= engine "duckduckgo.com") query-raw) - ((string= engine "devdocs.io") (concat "_ " query-raw))))) - (xwidget-webkit-browse-url (concat "https://" engine "/?q=" query))))) -#+end_src -* Eshell -** Why Eshell? -Eshell is an integrated shell environment for Emacs, written in Emacs -Lisp. I argue that it is the best shell/command interpreter to use in -Emacs. - -Eshell is unlike the alternatives in Emacs as it's a /shell/ first, -not a terminal emulator. It has the ability to spoof some aspects of a -terminal emulator (through the shell parser), but it is NOT a terminal -emulator. - -The killer benefits of eshell (which would appeal to Emacs users) are -a direct result of eshell being written in Emacs lisp: -- incredible integration with Emacs utilities (such as ~dired~, - ~find-file~, any read functions, etc) -- very extensible, easy to write new commands which leverage Emacs - commands as well as external utilities -- agnostic of platform: "eshell/cd" will call the underlying change - directory function for you, so commands will (usually) mean the same - thing regardless of platform - - this means as long as Emacs can run on an operating system, one - may run eshell - -However, my favourite feature of eshell is the set of evaluators that -run on command input. Some of the benefits listed above come as a -result of this powerful feature. These evaluators are described below. - -Lisp evaluator: works on braced expressions, evaluating them as Lisp -expressions (e.g. ~(message "Hello, World!\n")~). Any returned -objects are printed. This makes eshell a LISP REPL! - -External evaluator: works within curly braces, evaluating them via -some external shell process (like sh) (e.g. ~{echo "Hello, -world!\n"}~). This makes eshell a (kinda dumb) terminal emulator! - -The alias evaluator is the top level evaluator. It is the main -evaluator for each expression given to eshell. When given an -expression it tries to evaluate it by testing against these conditions: -- it's an alias defined by the user or in the ~eshell/~ namespace of - functions (simplest evaluator) -- it's some form of lisp expression (lisp evaluator) -- it's an external command (bash evaluator) -Essentially, you get the best of both Emacs and external shell -programs *ALL WITHIN* Emacs for free. -** Eshell functionality -Bind some evil-like movements for easy shell usage, and a toggle -function to pull up the eshell quickly. -#+begin_src emacs-lisp -(use-package eshell - :defer t - :general - (shell-leader - "t" #'eshell) - :init - (add-hook - 'eshell-mode-hook - (proc - (interactive) - (general-def - :states '(normal insert) - :keymaps 'eshell-mode-map - "M-j" #'eshell-next-matching-input-from-input - "M-k" #'eshell-previous-matching-input-from-input) - (local-leader - :keymaps 'eshell-mode-map - "c" (proc (interactive) (eshell/clear) - (recenter)) - "k" #'eshell-kill-process)))) -#+end_src -** Eshell pretty symbols and display -Pretty symbols and a display record. -#+begin_src emacs-lisp -(use-package eshell - :defer t - :pretty - (eshell-mode-hook - ("lambda" . "λ") - ("numberp" . "ℤ") - ("t" . "⊨") - ("nil" . "Ø")) - :display - ("\\*e?shell\\*" ; for general shells as well - (display-buffer-at-bottom) - (window-height . 0.33))) -#+end_src -** Eshell variables and aliases -Set some sane defaults, a banner and a prompt. The prompt checks for -a git repo in the current directory and provides some extra -information in that case (in particular, branch name and if there any -changes that haven't been committed). - -#+begin_src emacs-lisp -(use-package eshell - :defer t - :config - (defun +eshell/--git-get-remote-status () - (let* ((branch-status (split-string - (shell-command-to-string "git status | grep 'Your branch is'"))) - (status (nth 3 branch-status)) - (diff (cl-position "by" branch-status :test #'string=))) - (if (null diff) - (propertize "=" 'font-lock-face '(:foreground "green")) - (let ((n (nth (+ 1 diff) branch-status))) - (concat - (cond - ((string= status "ahead") - (propertize "→ " 'font-lock-face '(:foreground "dodger blue"))) - ((string= status "behind") - (propertize "← " 'font-lock-face '(:foreground "orange red")))) - n))))) - - (defun +eshell/--git-get-change-status () - (let ((changed-files (- (length (split-string (shell-command-to-string "git status -s" ) "\n")) 1))) - (if (= changed-files 0) - (propertize "✓" 'font-lock-face '(:foreground "green")) - (propertize (number-to-string changed-files) 'font-lock-face '(:foreground "red"))))) - - (defun +eshell/get-git-properties () - (let ((git-branch (shell-command-to-string "git branch"))) - (if (or (string= git-branch "") - (not (string= "*" (substring git-branch 0 1)))) - "" - (format - "(%s<%s>[%s])" - (nth 2 (split-string git-branch "\n\\|\\*\\| ")) - (+eshell/--git-get-change-status) - (+eshell/--git-get-remote-status))))) - - (defun +eshell/prompt-function () - (let ((git (+eshell/get-git-properties))) - (mapconcat - (lambda (item) - (if (listp item) - (propertize (car item) - 'read-only t - 'font-lock-face (cdr item) - 'front-sticky '(font-lock-face read-only) - 'rear-nonsticky '(font-lock-face read-only)) - item)) - (list - '("[") - `(,(abbreviate-file-name (eshell/pwd)) :foreground "LimeGreen") - '("]") - (if (string= git "") - "" - (concat "-" git "")) - "\n" - `(,(format-time-string "[%H:%M:%S]") :foreground "purple") - "\n" - '("𝜆> " :foreground "DeepSkyBlue"))))) - - (defun +eshell/banner-message () - (concat (shell-command-to-string "~/.local/scripts/cowfortune") - "\n")) - - (setq eshell-cmpl-ignore-case t - eshell-cd-on-directory t - eshell-banner-message '(+eshell/banner-message) - eshell-highlight-prompt nil - eshell-prompt-function #'+eshell/prompt-function - eshell-prompt-regexp "^𝜆> ")) -#+end_src -** Eshell change directory quickly -Add ~eshell/goto~, which is actually a command accessible from within -eshell (this is because ~eshell/*~ creates an accessible function -within eshell with name ~*~). ~eshell/goto~ makes it easier to change -directories by using Emacs' find-file interface (which is much faster -than ~cd ..; ls -l~). - -~eshell/goto~ is a better ~cd~ for eshell. However it is really just -a plaster over a bigger issue for my workflow; many times I want -eshell to be present in the current directory of the buffer I am -using. So here's also a command for opening eshell with the current -directory. -#+begin_src emacs-lisp -(use-package eshell - :defer t - :general - (leader - "T" #'+eshell/current-buffer) - :config - (defun eshell/goto (&rest args) - "Use `read-directory-name' to change directories." - (eshell/cd (list (read-directory-name "Directory?: ")))) - - (defun eshell/project-root (&rest args) - "Change to directory `project-root'" - (if (project-current) - (eshell/cd (list (project-root (project-current)))) - (eshell/echo (format "[%s]: No project in current directory" - (propertize "Error" 'font-lock-face '(:foreground "red")))))) - - (defun +eshell/current-buffer () - (interactive) - (let ((dir (if buffer-file-name - (file-name-directory buffer-file-name) - default-directory)) - (buf (eshell))) - (if dir - (with-current-buffer buf - (eshell/cd dir) - (eshell-send-input)) - (message "Could not switch eshell: buffer is not real file"))))) -#+end_src -* WAIT Elfeed -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -Elfeed is the perfect RSS feed reader, integrated into Emacs -perfectly. I've got a set of feeds that I use for a large variety of -stuff, mostly media and entertainment. I've also bound " ar" -to elfeed for loading the system. -#+begin_src emacs-lisp -(use-package elfeed - :general - (app-leader "r" #'elfeed) - (nmmap - :keymaps 'elfeed-search-mode-map - "gr" #'elfeed-update - "s" #'elfeed-search-live-filter - "" #'elfeed-search-show-entry) - :init - (setq elfeed-db-directory (no-littering-expand-var-file-name "elfeed/")) - - (setq +rss/feed-urls - '(("Arch Linux" - "https://www.archlinux.org/feeds/news/" - News Technology) - ("The Onion" - "https://www.theonion.com/rss" - Social) - ("Protesilaos Stavrou" - "https://www.youtube.com/@protesilaos" - YouTube Technology) - ("Tsoding Daily" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg" - YouTube Technology) - ("Tsoding" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg" - YouTube Technology) - ("Nexpo" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCpFFItkfZz1qz5PpHpqzYBw" - YouTube Stories) - ("3B1B" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw" - YouTube) - ("Fredrik Knusden" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCbWcXB0PoqOsAvAdfzWMf0w" - YouTube Stories) - ("Barely Sociable" - "https://www.youtube.com/feeds/videos.xml?channel_id=UC9PIn6-XuRKZ5HmYeu46AIw" - YouTube Stories) - ("Atrocity Guide" - "https://www.youtube.com/feeds/videos.xml?channel_id=UCn8OYopT9e8tng-CGEWzfmw" - YouTube Stories) - ("Hacker News" - "https://news.ycombinator.com/rss" - Social News Technology) - ("Hacker Factor" - "https://www.hackerfactor.com/blog/index.php?/feeds/index.rss2" - Social))) - :config - (with-eval-after-load "evil-collection" - (evil-collection-elfeed-setup)) - - (setq elfeed-feeds (cl-map 'list #'(lambda (item) - (append (list (nth 1 item)) (cdr (cdr item)))) - +rss/feed-urls)) - - (advice-add 'elfeed-search-show-entry :after #'+elfeed/dispatch-entry) - - (defun +elfeed/dispatch-entry (entry) - "Process each type of entry differently. - e.g., you may want to open HN entries in eww." - (let ((url (elfeed-entry-link entry))) - (pcase url - ((pred (string-match-p "https\\:\\/\\/www.youtube.com\\/watch")) - (mpv-play-url url)) - (_ (eww url)))))) -#+end_src -* Magit -Magit is *the* git porcelain for Emacs, which perfectly encapsulates -the git cli. In this case I just need to setup the bindings for it. -As magit will definitely load after evil (as it must be run by a -binding, and evil will load after init), I can use evil-collection -freely. Also, define an auto insert for commit messages so that I -don't need to write everything myself. - -#+begin_src emacs-lisp -(use-package magit - :defer t - :display - ("magit:.*" - (display-buffer-same-window) - (inhibit-duplicate-buffer . t)) - ("magit-diff:.*" - (display-buffer-below-selected)) - ("magit-log:.*" - (display-buffer-same-window)) - :general - (leader - "g" '(magit-dispatch :which-key "Magit")) - (code-leader - "b" #'magit-blame) - :auto-insert - (("COMMIT_EDITMSG" . "Commit skeleton") - "" - "(" (read-string "Enter feature/module: ") ")" - (read-string "Enter simple description: ") "\n\n") - :init - (setq vc-follow-symlinks t - magit-blame-echo-style 'lines - magit-copy-revision-abbreviated t) - :config - (with-eval-after-load "evil" - (evil-set-initial-state 'magit-status-mode 'motion)) - (with-eval-after-load "evil-collection" - (evil-collection-magit-setup))) -#+end_src -* IBuffer -IBuffer is the dired of buffers: providing the ability to mark -buffers, mass rename/delete and just observe stuff. -#+begin_src emacs-lisp -(use-package ibuffer - :general - (buffer-leader - "i" #'ibuffer) - :config - (with-eval-after-load "evil-collection" - (evil-collection-ibuffer-setup))) -#+end_src -* Proced -Emacs has two systems for process management: -+ proced: a general 'top' like interface which allows general - management of linux processes -+ list-processes: a specific Emacs based system that lists processes - spawned by Emacs (similar to a top for Emacs specifically) - -Core proced config, just a few bindings and evil collection setup. -#+begin_src emacs-lisp -(use-package proced - :straight nil - :general - (app-leader - "p" #'proced) - (nmap - :keymaps 'proced-mode-map - "za" #'proced-toggle-auto-update) - :display - ("\\*Proced\\*" - (display-buffer-at-bottom) - (window-height . 0.25)) - :init - (setq proced-auto-update-interval 0.5) - :config - (with-eval-after-load "evil-collection" - (evil-collection-proced-setup))) -#+end_src -* Calculator -Surprise, surprise Emacs comes with a calculator. - -Greater surprise, this thing is over powered. It can perform the -following (and more): -- Matrix calculations -- Generalised calculus operations -- Equation solvers for n-degree multi-variable polynomials -- Embedded mode (check below)! - -~calc-mode~ is a calculator system within Emacs that provides a -diverse array of mathematical operations. It uses reverse polish -notation to do calculations (though there is a standard infix -algebraic notation mode). - -Embedded mode allows computation with the current buffer as the echo -area. This basically means I can compute stuff within a buffer -without invoking calc directly: $1 + 2\rightarrow_{\text{calc-embed}} 3$. - -#+begin_src emacs-lisp -(use-package calc - :straight nil - :display - ("*Calculator*" - (display-buffer-at-bottom) - (window-height . 0.18)) - :general - (app-leader - "c" #'calc-dispatch) - (mode-leader - "c" #'calc-embedded) - :init - (setq calc-algebraic-mode t) - :config - (with-eval-after-load "evil-collection" - (evil-collection-calc-setup))) -#+end_src -** WAIT Calctex -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -~calc-mode~ also has a 3rd party package called ~calctex~. It renders -mathematical expressions within calc as if they were rendered in TeX. -You can also copy the expressions in their TeX forms, which is pretty -useful when writing a paper. I've set a very specific lock on this -repository as it's got quite a messy work-tree and this commit seems to -work for me given the various TeX utilities installed via Arch. - -#+begin_src emacs-lisp -(use-package calctex - :after calc - :straight (calctex :type git :host github :repo "johnbcoughlin/calctex") - :hook (calc-mode-hook . calctex-mode)) -#+end_src -* WAIT Ledger -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -#+begin_src emacs-lisp -(use-package ledger-mode - :defer t) - -(use-package evil-ledger - :after ledger-mode) -#+end_src -* Zone -Of course Emacs has a cool screensaver software. - -#+begin_src emacs-lisp -(use-package zone-matrix - :straight t - :commands (zone) - :general - (leader - "z" #'zone) - :init - (setq zone-programs - [zone-pgm-drip - zone-pgm-drip-fretfully - zone-pgm-martini-swan-dive - zone-pgm-stress - zone-pgm-random-life])) -#+end_src -* (Wo)man -Man pages are the user manuals for most software on Linux. Really -useful when writing code for Un*x systems, though they can be very -verbose. - -2023-08-17: `Man-notify-method' is the reason the `:display' record -doesn't work here. I think it's to do with how Man pages are rendered -or something, but very annoying as it's a break from standards! -#+begin_src emacs-lisp -(use-package man - :demand t - :straight nil - :init - (setq Man-notify-method 'pushy) - :display - ("^\\*Man.*" - (display-buffer-reuse-mode-window display-buffer-same-window)) - :general - (file-leader - "m" #'man) ;; kinda like "find man page" - (nmmap - :keymaps 'Man-mode-map - "RET" #'man-follow)) -#+end_src -* WAIT gif-screencast -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -Little application that uses =gifsicle= to make essentially videos of -Emacs. Useful for demonstrating features. -#+begin_src emacs-lisp -(use-package gif-screencast - :straight t - :general - (app-leader - "x" #'gif-screencast-start-or-stop) - :init - (setq gif-screencast-output-directory (expand-file-name "~/Media/emacs/"))) -#+end_src -* Image-mode -Image mode, for viewing images. Supports tons of formats, easy to use -and integrates slickly into image-dired. Of course, -#+begin_src emacs-lisp -(use-package image-mode - :straight nil - :general - (nmmap - :keymaps 'image-mode-map - "+" #'image-increase-size - "-" #'image-decrease-size - "p" #'image-animate - "P" #'image-animate-set-speed - "h" #'image-backward-hscroll - "j" #'image-next-line - "k" #'image-previous-line - "l" #'image-forward-hscroll)) -#+end_src -* WAIT ERC -:PROPERTIES: -:header-args:emacs-lisp: :tangle no -:END: -#+begin_src emacs-lisp -(use-package erc - :defer t - :init - (setq erc-server "irc.libera.chat" - erc-nick "oreodave" - erc-buffer-display "current")) -#+end_src -* MPV -Basically a porcelain over mpv via the IPC interface. -#+begin_src emacs-lisp -(use-package mpv - :defer t - :straight t - :config - (with-eval-after-load "org" - (defun org-mpv-complete-link (&optional arg) - (replace-regexp-in-string - "file:" "mpv:" - (org-link-complete-file arg) - t t)) - (org-link-set-parameters "mpv" - :follow #'mpv-play :complete #'org-mpv-complete-link))) -#+end_src -- cgit v1.2.3-13-gbd6f