diff options
-rwxr-xr-x | emacs.org | 212 |
1 files changed, 105 insertions, 107 deletions
@@ -185,7 +185,7 @@ Fonts and basic appearance settings for each device #+end_src ** Theme & modeline #+begin_src emacs-lisp - (load-theme 'doom-ayu-dark t) + (load-theme 'doom-henna t) (doom-modeline-mode 1) (setq doom-modeline-height 35) @@ -229,107 +229,103 @@ Fonts and basic appearance settings for each device * Dired ** All-the-icons.el #+begin_src emacs-lisp -;;; all-the-icons-dired.el --- Shows icons for each file in dired mode -*- lexical-binding: t; -*- - -;;; Code: - -(require 'cl-lib) -(require 'dired) -(require 'all-the-icons) - -(defface all-the-icons-dired-dir-face - '((((background dark)) :foreground "white") - (((background light)) :foreground "black")) - "Face for the directory icon" - :group 'all-the-icons-faces) - -(defcustom all-the-icons-dired-v-adjust 0.01 - "The default vertical adjustment of the icon in the dired buffer." - :group 'all-the-icons - :type 'number) - -(defvar all-the-icons-dired-mode) - -(defun all-the-icons-dired--add-overlay (pos string) - "Add overlay to display STRING at POS." - (let ((ov (make-overlay (1- pos) pos))) - (overlay-put ov 'all-the-icons-dired-overlay t) - (overlay-put ov 'after-string string))) - -(defun all-the-icons-dired--overlays-in (beg end) - "Get all all-the-icons-dired overlays between BEG to END." - (cl-remove-if-not - (lambda (ov) - (overlay-get ov 'all-the-icons-dired-overlay)) - (overlays-in beg end))) - -(defun all-the-icons-dired--overlays-at (pos) - "Get all-the-icons-dired overlays at POS." - (apply #'all-the-icons-dired--overlays-in `(,pos ,pos))) - -(defun all-the-icons-dired--remove-all-overlays () - "Remove all `all-the-icons-dired' overlays." - (save-restriction - (widen) - (mapc #'delete-overlay - (all-the-icons-dired--overlays-in (point-min) (point-max))))) - -(defun all-the-icons-dired--refresh () - "Display the icons of files in a dired buffer." - (all-the-icons-dired--remove-all-overlays) - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (when (dired-move-to-filename nil) - (let ((file (dired-get-filename 'relative 'noerror))) - (when file - (let ((icon (if (file-directory-p file) - (all-the-icons-icon-for-dir file - :face 'all-the-icons-dired-dir-face - :v-adjust all-the-icons-dired-v-adjust) - (all-the-icons-icon-for-file file :v-adjust all-the-icons-dired-v-adjust)))) - (if (member file '("." "..")) - (all-the-icons-dired--add-overlay (point) " \t") - (all-the-icons-dired--add-overlay (point) (concat icon "\t"))))))) - (forward-line 1)))) - -(defun all-the-icons-dired--refresh-advice (fn &rest args) - "Advice function for FN with ARGS." - (apply fn args) - (when all-the-icons-dired-mode - (all-the-icons-dired--refresh))) - -(defun all-the-icons-dired--setup () - "Setup `all-the-icons-dired'." - (when (derived-mode-p 'dired-mode) - (setq-local tab-width 1) - (advice-add 'dired-readin :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-revert :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-internal-do-deletions :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-insert-subdir :around #'all-the-icons-dired--refresh-advice) - (advice-add 'dired-do-kill-lines :around #'all-the-icons-dired--refresh-advice) - (with-eval-after-load 'dired-narrow - (advice-add 'dired-narrow--internal :around #'all-the-icons-dired--refresh-advice)) - (all-the-icons-dired--refresh))) - -(defun all-the-icons-dired--teardown () - "Functions used as advice when redisplaying buffer." - (advice-remove 'dired-readin #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-revert #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-internal-do-deletions #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-narrow--internal #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-insert-subdir #'all-the-icons-dired--refresh-advice) - (advice-remove 'dired-do-kill-lines #'all-the-icons-dired--refresh-advice) - (all-the-icons-dired--remove-all-overlays)) - -;;;###autoload -(define-minor-mode all-the-icons-dired-mode - "Display all-the-icons icon for each files in a dired buffer." - :lighter " all-the-icons-dired-mode" - (when (and (derived-mode-p 'dired-mode) (display-graphic-p)) - (if all-the-icons-dired-mode - (all-the-icons-dired--setup) - (all-the-icons-dired--teardown)))) + (require 'cl-lib) + (require 'dired) + (require 'all-the-icons) + + (defface all-the-icons-dired-dir-face + '((((background dark)) :foreground "white") + (((background light)) :foreground "black")) + "Face for the directory icon" + :group 'all-the-icons-faces) + + (defcustom all-the-icons-dired-v-adjust 0.01 + "The default vertical adjustment of the icon in the dired buffer." + :group 'all-the-icons + :type 'number) + + (defvar all-the-icons-dired-mode) + + (defun all-the-icons-dired--add-overlay (pos string) + "Add overlay to display STRING at POS." + (let ((ov (make-overlay (1- pos) pos))) + (overlay-put ov 'all-the-icons-dired-overlay t) + (overlay-put ov 'after-string string))) + + (defun all-the-icons-dired--overlays-in (beg end) + "Get all all-the-icons-dired overlays between BEG to END." + (cl-remove-if-not + (lambda (ov) + (overlay-get ov 'all-the-icons-dired-overlay)) + (overlays-in beg end))) + + (defun all-the-icons-dired--overlays-at (pos) + "Get all-the-icons-dired overlays at POS." + (apply #'all-the-icons-dired--overlays-in `(,pos ,pos))) + + (defun all-the-icons-dired--remove-all-overlays () + "Remove all `all-the-icons-dired' overlays." + (save-restriction + (widen) + (mapc #'delete-overlay + (all-the-icons-dired--overlays-in (point-min) (point-max))))) + + (defun all-the-icons-dired--refresh () + "Display the icons of files in a dired buffer." + (all-the-icons-dired--remove-all-overlays) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (dired-move-to-filename nil) + (let ((file (dired-get-filename 'relative 'noerror))) + (when file + (let ((icon (if (file-directory-p file) + (all-the-icons-icon-for-dir file + :face 'all-the-icons-dired-dir-face + :v-adjust all-the-icons-dired-v-adjust) + (all-the-icons-icon-for-file file :v-adjust all-the-icons-dired-v-adjust)))) + (if (member file '("." "..")) + (all-the-icons-dired--add-overlay (point) " \t") + (all-the-icons-dired--add-overlay (point) (concat icon "\t"))))))) + (forward-line 1)))) + + (defun all-the-icons-dired--refresh-advice (fn &rest args) + "Advice function for FN with ARGS." + (apply fn args) + (when all-the-icons-dired-mode + (all-the-icons-dired--refresh))) + + (defun all-the-icons-dired--setup () + "Setup `all-the-icons-dired'." + (when (derived-mode-p 'dired-mode) + (setq-local tab-width 1) + (advice-add 'dired-readin :around #'all-the-icons-dired--refresh-advice) + (advice-add 'dired-revert :around #'all-the-icons-dired--refresh-advice) + (advice-add 'dired-internal-do-deletions :around #'all-the-icons-dired--refresh-advice) + (advice-add 'dired-insert-subdir :around #'all-the-icons-dired--refresh-advice) + (advice-add 'dired-do-kill-lines :around #'all-the-icons-dired--refresh-advice) + (with-eval-after-load 'dired-narrow + (advice-add 'dired-narrow--internal :around #'all-the-icons-dired--refresh-advice)) + (all-the-icons-dired--refresh))) + + (defun all-the-icons-dired--teardown () + "Functions used as advice when redisplaying buffer." + (advice-remove 'dired-readin #'all-the-icons-dired--refresh-advice) + (advice-remove 'dired-revert #'all-the-icons-dired--refresh-advice) + (advice-remove 'dired-internal-do-deletions #'all-the-icons-dired--refresh-advice) + (advice-remove 'dired-narrow--internal #'all-the-icons-dired--refresh-advice) + (advice-remove 'dired-insert-subdir #'all-the-icons-dired--refresh-advice) + (advice-remove 'dired-do-kill-lines #'all-the-icons-dired--refresh-advice) + (all-the-icons-dired--remove-all-overlays)) + + ;;;###autoload + (define-minor-mode all-the-icons-dired-mode + "Display all-the-icons icon for each files in a dired buffer." + :lighter " all-the-icons-dired-mode" + (when (and (derived-mode-p 'dired-mode) (display-graphic-p)) + (if all-the-icons-dired-mode + (all-the-icons-dired--setup) + (all-the-icons-dired--teardown)))) #+end_src Hook with ~dired-mode~ @@ -734,7 +730,9 @@ Hook with ~dired-mode~ ("http://wikileaks.org/feed" wikileaks) ("https://hackernoon.com/feed" - hackernoon))) + hackernoon) + ("https://sachachua.com/blog/feed/" + sacha emacs))) #+end_src ** Watch Videos Create function to watch videos using ~mpv~ @@ -759,7 +757,7 @@ Create function to watch videos using ~mpv~ (define-key elfeed-search-mode-map (kbd "v") 'elfeed-view-mpv) (define-key elfeed-search-mode-map (kbd "U") 'elfeed-update) - (setq elfeed-goodies/entry-pane-size 0.65) + (setq elfeed-goodies/entry-pane-size 0.55) (elfeed-goodies/setup) #+end_src @@ -778,9 +776,8 @@ Create function to watch videos using ~mpv~ ;; Check if we have mu4e available ;; if t load mu4e settings (when (require 'mu4e nil 'noerror) - (setq mu4e-update-interval (* 10 60)) + (when is-zeus (setq mu4e-update-interval (* 10 60))) (setq mu4e-get-mail-command "mbsync -a") - (setq mu4e-maildir-list "~/Mail/Inbox") (defun set-mu4e-context (context-name full-name mail-address signature server) "Return a mu4e context named CONTEXT-NAME with :match-func matching @@ -908,7 +905,7 @@ First let's set ~eshell-visual-commands~ ** Aliases & Paths Set aliases for ~~/.emacs.d/eshell/alias~ similarly that I would for a ~~/.bashrc~ file #+begin_src fundamental :tangle ~/.emacs.d/eshell/alias - alias ls ls -la + alias ls ls -lah alias anki QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" anki alias b bluetoothctl alias ba bluetooth-autoconnect @@ -943,6 +940,7 @@ Set aliases for emacs functions and ~PATH~ #+begin_src emacs-lisp (defvar eshell-path-env (getenv "~/.local/bin")) (defalias 'o 'find-file) + (defalias 'oo 'find-file-other-window) #+end_src ** Prompt #+begin_src emacs-lisp |