diff --git a/.emacs.d/README.org b/.config/emacs/README.org similarity index 100% rename from .emacs.d/README.org rename to .config/emacs/README.org diff --git a/.emacs.d/config.org b/.config/emacs/config.org similarity index 90% rename from .emacs.d/config.org rename to .config/emacs/config.org index c679507..71d453f 100644 --- a/.emacs.d/config.org +++ b/.config/emacs/config.org @@ -41,6 +41,7 @@ - [[#php][PHP]] - [[#prettify][Prettify]] - [[#rss][RSS]] + - [[#email][Email]] - [[#general-1][General]] - [[#buffers][Buffers]] - [[#electric][Electric]] @@ -190,6 +191,11 @@ Install and configure packages. :load-path "~/code/elisp/emacs-hybrid-reverse" :config (load-theme 'hybrid-reverse t)) + ;; (use-package doom-themes + ;; :config + ;; (doom-themes-org-config) + ;; (load-theme 'doom-tomorrow-night t)) + (use-package all-the-icons :defer t) @@ -397,15 +403,36 @@ Setup =org-roam-server=. (setq org-roam-server-host "127.0.0.1") (setq org-roam-server-port 8080) (setq org-roam-server-network-arrows "from") - (setq org-roam-server-style - (concat - "button#toggle-preview { margin: 4px; }" - "div#view-menu { margin: 4px; }" - "div#controls { right: 4px; left: 4px; bottom: 4px; }" - "button#toggle-list-type-button { margin: 0 4px; }" - "label#colormode { transform: translate(-25%, 0); }" - "label.toggle-off.btn-sm { padding-left: 0px; }" - ))) + (setq org-roam-server-style (concat + "button#toggle-preview { margin: 4px; }" + "div#view-menu { margin: 4px; }" + "div#controls { right: 4px; left: 4px; bottom: 4px; }" + "button#toggle-list-type-button { margin: 0 4px; }" + "label#colormode { transform: translate(-25%, 0); }" + "label.toggle-off.btn-sm { padding-left: 0px; }" + ))) +#+END_SRC + +Easily searchable .org files via Deft. + +#+BEGIN_SRC emacs-lisp + (use-package deft + :hook (deft-mode . dot/hook-disable-line-numbers) + :config + (setq deft-auto-save-interval 0) + (setq deft-default-extension "org") + (setq deft-directory "~/documents/org/") + (setq deft-file-naming-rules '((noslash . "-") + (nospace . "-") + (case-fn . downcase))) + (setq deft-new-file-format "%Y%m%d%H%M%S-deft") + (setq deft-recursive t) + (setq deft-use-filename-as-title nil) + (setq deft-use-filter-string-for-filename t) + (add-to-list 'deft-extensions "tex") + + ;; Start filtering immediately + (evil-set-initial-state 'deft-mode 'insert)) #+END_SRC **** Org Exporters @@ -657,6 +684,58 @@ Completion for Org-roam files using its title. :hook (elfeed-show-mode . dot/hook-disable-line-numbers)) #+END_SRC +RSS info +https://boards.4channel.org/g/thread/76442363 + +*** Email + +mu4e + +#+BEGIN_SRC emacs-lisp + (use-package mu4e + :commands mu4e + :load-path "/usr/share/emacs/site-lisp/mu4e" + :custom + (auth-sources (concat dot-etc-dir "/authinfo.gpg")) + (user-full-name "Rick van Vonderen") + (user-mail-address "me@riyyi.com") + (mail-user-agent 'mu4e-user-agent) + (mu4e-headers-date-format "%d-%m-%Y") + (mu4e-headers-time-format "%I:%M %p") + (mu4e-headers-long-date-format "%d-%m-%Y %I:%M:%S %p") + (mu4e-maildir "~/mail/me@riyyi.com") + (mu4e-attachment-dir "~/downloads") + (mu4e-refile-folder "/Archive") + (mu4e-sent-folder "/Sent") + (mu4e-drafts-folder "/Drafts") + (mu4e-trash-folder "/Trash") + (mu4e-get-mail-command "mbsync -a -c ~/.config/isync/mbsyncrc") + (mu4e-change-filenames-when-moving t) + (mu4e-completing-read-function 'completing-read) + (mu4e-compose-signature-auto-include nil) + (mu4e-context-policy 'pick-first) + (mu4e-display-update-status-in-modeline t) + (mu4e-hide-index-messages t) + (mu4e-view-show-addresses t) + ) + + (use-package smtpmail ; built-in + :defer t + :init + (setq smtpmail-default-smtp-server "mail.riyyi.com") + :custom + (smtpmail-smtp-server "mail.riyyi.com") + (smtpmail-local-domain "riyyi.com") + (smtpmail-smtp-service 587) + (smtpmail-stream-type 'starttls) + (smtpmail-queue-mail nil) + (send-mail-function 'smtpmail-send-it) + (message-send-mail-function 'smtpmail-send-it) + ) + + ;; https://rakhim.org/fastmail-setup-with-emacs-mu4e-and-mbsync-on-macos/ +#+END_SRC + * General #+BEGIN_SRC emacs-lisp @@ -894,6 +973,11 @@ Set UTF-8 encoding as default. ;; Window rules (setq display-buffer-alist '( + ("\\*ansi-term\\*" + (display-buffer-in-side-window) + (window-height . 0.25) + (side . bottom) + (slot . -1)) ("^\\(\\*e?shell\\|vterm\\).*" (display-buffer-in-side-window) (window-height . 0.25) @@ -915,6 +999,12 @@ Set UTF-8 encoding as default. (side . bottom) (slot . 1)) )) + + ;; (add-hook 'mu4e-view-mode-hook 'centaur-tabs-local-mode) + ;; (add-hook 'occur-mode-hook (lambda () (progn + ;; (centaur-tabs-local-mode) + ;; (display-line-numbers-mode 0) + ;; (hl-line-mode 1)))) #+END_SRC * Functions @@ -1018,6 +1108,12 @@ Functions that only use built-in Emacs functionality. (let ((default-directory (find-project-root))) (call-interactively 'find-file))) + (defun compile-latex () + "Compile LaTeX project." + (interactive) + (let ((default-directory (find-project-root))) + (projectile-save-project-buffers) + (shell-command "make"))) ;; https://emacsredux.com/blog/2013/05/04/rename-file-and-buffer/ (defun rename-file-and-buffer () @@ -1032,6 +1128,12 @@ Functions that only use built-in Emacs functionality. (t (rename-file filename new-name t) (set-visited-file-name new-name t t))))))) + + (defun test-derived () + (interactive) + (unless (derived-mode-p 'prog-mode) (message "Derived from prog-mode.")) + (unless (derived-mode-p 'text-mode) (message "Derived from text-mode.")) + ) #+END_SRC Functions that are only used for hook calls. @@ -1238,7 +1340,9 @@ Evil command aliases. ;; LaTeX, set correct tab mode (add-hook 'latex-mode-hook (lambda () (setq indent-tabs-mode t))) - ;; Disable line numbers in terminal mode (breaks output otherwise) + ;; Disable line numbers + (add-hook 'custom-mode-hook 'dot/hook-disable-line-numbers) + (add-hook 'dired-mode-hook 'dot/hook-disable-line-numbers) (add-hook 'term-mode-hook 'dot/hook-disable-line-numbers) ;; Wrap lines in the middle of words, gives a \ indicator @@ -1380,6 +1484,41 @@ Set custom keybinds to functionality of custom packages. "r" #'dot/dashboard-goto-recent-files ) + ;; Deft + (general-def 'normal deft-mode-map + [down-mouse-1] 'widget-button-click + ) + + ;; https://github.com/jrblevin/deft/blob/master/deft.el#L887 + ;; https://github.com/hlissner/doom-emacs/blob/develop/modules/ui/deft/config.el#L22 + + ;; (map! :map deft-mode-map + ;; :n "gr" #'deft-refresh + ;; :n "C-s" #'deft-filter + ;; :i "C-n" #'deft-new-file + ;; :i "C-m" #'deft-new-file-named + ;; :i "C-d" #'deft-delete-file + ;; :i "C-r" #'deft-rename-file + ;; :n "r" #'deft-rename-file + ;; :n "a" #'deft-new-file + ;; :n "A" #'deft-new-file-named + ;; :n "d" #'deft-delete-file + ;; :n "D" #'deft-archive-file + ;; :n "q" #'kill-current-buffer + ;; :localleader + ;; "RET" #'deft-new-file-named + ;; "a" #'deft-archive-file + ;; "c" #'deft-filter-clear + ;; "d" #'deft-delete-file + ;; "f" #'deft-find-file + ;; "g" #'deft-refresh + ;; "l" #'deft-filter + ;; "n" #'deft-new-file + ;; "r" #'deft-rename-file + ;; "s" #'deft-toggle-sort-method + ;; "t" #'deft-toggle-incremental-search)) + + ;; Elfeed (general-def 'normal elfeed-search-mode-map "b" 'elfeed-search-browse-url @@ -1408,6 +1547,10 @@ Set custom keybinds to functionality of custom packages. "k" #'selectrum-previous-candidate ) + ;; Mu4e + (general-def 'normal mu4e-compose-mode-map + "q" 'mu4e-message-kill-buffer) + ;; Neotree (general-def 'normal neotree-mode-map "RET" 'neotree-enter @@ -1504,6 +1647,8 @@ General.el ~leader key binds. "i b" '(dot/indent-buffer :which-key "Indent buffer") "i r" '(indent-region :which-key "Indent region") "i s" '(yas-insert-snippet :which-key "Insert snippet") + ;; "i ?" '(fill-paragraph :which-key "") + ;; "i ?" '(fill-region :which-key "") ;; Notes "n" '(:ignore t :which-key "notes") @@ -1518,6 +1663,10 @@ General.el ~leader key binds. "n r C" '(org-roam-build-cache :which-key "Build cache") "n r I" '(org-roam-insert-immediate :which-key "Insert without org-capture") + ;; Open + "o" '(:ignore t :which-key "open") + "o d" '(deft :which-key "Open deft") + ;; Projectile "p" '(:keymap projectile-command-map :package projectile :which-key "projectile") @@ -1619,6 +1768,7 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el "s " '(org-move-subree-up :which-key "Org move subtree up") "s " '(org-move-subtree-down :which-key "Org move subtree down") ) + ;; org-move-subtree-up -> org-metaup (local-leader org-src-mode-map "'" '(org-edit-src-exit :which-key "Org exit edit") @@ -1659,3 +1809,6 @@ Org mode keybinds: | | Move subtree up | (org-metaup) | | | Cycle to next todo keyword | (org-shiftleft/org-shiftright) | | | Cycle todo priority | (org-shiftup/org-shiftdown) | + + ;; @Todo + ;; SPC f S => save all buffers (evil-write-all) diff --git a/.emacs.d/early-init.el b/.config/emacs/early-init.el similarity index 100% rename from .emacs.d/early-init.el rename to .config/emacs/early-init.el diff --git a/.emacs.d/init.el b/.config/emacs/init.el similarity index 79% rename from .emacs.d/init.el rename to .config/emacs/init.el index e5393ab..78d6157 100644 --- a/.emacs.d/init.el +++ b/.config/emacs/init.el @@ -16,6 +16,12 @@ (package-refresh-contents) (package-install 'use-package)) +(use-package benchmark-init + :ensure t + :config + ;; To disable collection of benchmark data after init is done + (add-hook 'after-init-hook 'benchmark-init/deactivate)) + ;; ------------------------------------- ;; Tangle and load configuration file diff --git a/.emacs.d/snippets/c++-mode/class b/.config/emacs/snippets/c++-mode/class similarity index 100% rename from .emacs.d/snippets/c++-mode/class rename to .config/emacs/snippets/c++-mode/class diff --git a/.emacs.d/snippets/c++-mode/constructor b/.config/emacs/snippets/c++-mode/constructor similarity index 100% rename from .emacs.d/snippets/c++-mode/constructor rename to .config/emacs/snippets/c++-mode/constructor diff --git a/.emacs.d/snippets/c++-mode/define b/.config/emacs/snippets/c++-mode/define similarity index 100% rename from .emacs.d/snippets/c++-mode/define rename to .config/emacs/snippets/c++-mode/define diff --git a/.emacs.d/snippets/c++-mode/destructor b/.config/emacs/snippets/c++-mode/destructor similarity index 100% rename from .emacs.d/snippets/c++-mode/destructor rename to .config/emacs/snippets/c++-mode/destructor diff --git a/.emacs.d/snippets/c++-mode/fun_declaration b/.config/emacs/snippets/c++-mode/fun_declaration similarity index 100% rename from .emacs.d/snippets/c++-mode/fun_declaration rename to .config/emacs/snippets/c++-mode/fun_declaration diff --git a/.emacs.d/snippets/c++-mode/fun_implementation b/.config/emacs/snippets/c++-mode/fun_implementation similarity index 100% rename from .emacs.d/snippets/c++-mode/fun_implementation rename to .config/emacs/snippets/c++-mode/fun_implementation diff --git a/.emacs.d/snippets/c++-mode/guard b/.config/emacs/snippets/c++-mode/guard similarity index 100% rename from .emacs.d/snippets/c++-mode/guard rename to .config/emacs/snippets/c++-mode/guard diff --git a/.emacs.d/snippets/c++-mode/include b/.config/emacs/snippets/c++-mode/include similarity index 100% rename from .emacs.d/snippets/c++-mode/include rename to .config/emacs/snippets/c++-mode/include diff --git a/.emacs.d/snippets/c++-mode/namespace b/.config/emacs/snippets/c++-mode/namespace similarity index 100% rename from .emacs.d/snippets/c++-mode/namespace rename to .config/emacs/snippets/c++-mode/namespace diff --git a/.emacs.d/snippets/c++-mode/separator b/.config/emacs/snippets/c++-mode/separator similarity index 100% rename from .emacs.d/snippets/c++-mode/separator rename to .config/emacs/snippets/c++-mode/separator diff --git a/.emacs.d/snippets/fundamental-mode/mode b/.config/emacs/snippets/fundamental-mode/mode similarity index 100% rename from .emacs.d/snippets/fundamental-mode/mode rename to .config/emacs/snippets/fundamental-mode/mode diff --git a/.emacs.d/snippets/latex-mode/begin b/.config/emacs/snippets/latex-mode/begin similarity index 100% rename from .emacs.d/snippets/latex-mode/begin rename to .config/emacs/snippets/latex-mode/begin diff --git a/.emacs.d/snippets/latex-mode/href b/.config/emacs/snippets/latex-mode/href similarity index 100% rename from .emacs.d/snippets/latex-mode/href rename to .config/emacs/snippets/latex-mode/href diff --git a/.emacs.d/snippets/latex-mode/hyperref b/.config/emacs/snippets/latex-mode/hyperref similarity index 100% rename from .emacs.d/snippets/latex-mode/hyperref rename to .config/emacs/snippets/latex-mode/hyperref diff --git a/.emacs.d/snippets/latex-mode/textit b/.config/emacs/snippets/latex-mode/textit similarity index 100% rename from .emacs.d/snippets/latex-mode/textit rename to .config/emacs/snippets/latex-mode/textit diff --git a/.emacs.d/snippets/latex-mode/underline b/.config/emacs/snippets/latex-mode/underline similarity index 100% rename from .emacs.d/snippets/latex-mode/underline rename to .config/emacs/snippets/latex-mode/underline diff --git a/.emacs.d/snippets/org-mode/el b/.config/emacs/snippets/org-mode/el similarity index 100% rename from .emacs.d/snippets/org-mode/el rename to .config/emacs/snippets/org-mode/el diff --git a/.emacs.d/snippets/org-mode/html b/.config/emacs/snippets/org-mode/html similarity index 100% rename from .emacs.d/snippets/org-mode/html rename to .config/emacs/snippets/org-mode/html diff --git a/.emacs.d/snippets/org-mode/source b/.config/emacs/snippets/org-mode/source similarity index 100% rename from .emacs.d/snippets/org-mode/source rename to .config/emacs/snippets/org-mode/source