From b7e72492836c1efd76035b7369aed2e67423708a Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 24 Mar 2022 13:51:32 -0500 Subject: [PATCH] adding devdocs --- README.org | 84 ++++++++++++++++++++++++++++++++++++++++-------------- init.el | 57 +++++++++++++++++++++++++++--------- 2 files changed, 106 insertions(+), 35 deletions(-) diff --git a/README.org b/README.org index 87b6e48b..eba127b0 100644 --- a/README.org +++ b/README.org @@ -944,8 +944,8 @@ Trying out corfu instead of company ;; Add `completion-at-point-functions', used by `completion-at-point'. (add-to-list 'completion-at-point-functions #'cape-file) ;; (add-to-list 'completion-at-point-functions #'cape-tex) - (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-keyword) + (add-to-list 'completion-at-point-functions #'cape-dabbrev) ;;(add-to-list 'completion-at-point-functions #'cape-sgml) ;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;;(add-to-list 'completion-at-point-functions #'cape-abbrev) @@ -953,11 +953,20 @@ Trying out corfu instead of company ;;(add-to-list 'completion-at-point-functions #'cape-dict) ;; (add-to-list 'completion-at-point-functions #'cape-symbol) ;;(add-to-list 'completion-at-point-functions #'cape-line) + :config (setq cape-dabbrev-min-length 2) ) #+END_SRC +*** Devdocs +Devdocs.io is a pretty great place to see documentation on nearly any developer technology. Devdocs.el will bring all that documentation right inside Emacs. +#+begin_src emacs-lisp +(use-package devdocs + :general + (chris/leader-keys 'normal + "hd" 'devdocs-lookup)) +#+end_src ** YASnippet YASnippet is a templating system. It's powerful. @@ -1109,7 +1118,23 @@ Since I like to make my window manager handle a lot of the window management, I :commands (helpful-callable helpful-variable helpful-command helpful-key) :general (general-def 'normal 'helpful-mode-map - "q" 'chris/kill-buffer-frame)) + "q" 'helpful-kill-buffers) + :config + (defun helpful--autoloaded-p (sym buf) + "Return non-nil if function SYM is autoloaded." + (-when-let (file-name (buffer-file-name buf)) + (setq file-name (s-chop-suffix ".gz" file-name)) + (help-fns--autoloaded-p sym))) + + (defun helpful--skip-advice (docstring) + "Remove mentions of advice from DOCSTRING." + (let* ((lines (s-lines docstring)) + (relevant-lines + (--take-while + (not (or (s-starts-with-p ":around advice:" it) + (s-starts-with-p "This function has :around advice:" it))) + lines))) + (s-trim (s-join "\n" relevant-lines))))) #+end_src ** Format @@ -1319,7 +1344,8 @@ I'm making a small function in here to open files in the appropriate program usi (message file) (call-process "xdg-open" nil 0 nil file))) - (setq dired-dwim-target t) + (setq dired-dwim-target t + delete-by-moving-to-trash t) (setq dired-listing-switches "-aoh --group-directories-first") (setq dired-hide-details-hide-symlink-targets nil @@ -1332,7 +1358,7 @@ I'm making a small function in here to open files in the appropriate program usi :keymaps 'override "od" '(dired-jump :which-key "open dired here") "oD" '(dired :which-key "open dired select")) - (general-def 'normal dired-mode-map + ('normal dired-mode-map "q" 'kill-this-buffer "C-" 'chris/dired-open-xdg "C-'" 'embark-act)) @@ -1407,9 +1433,17 @@ Let's try using dirvish as a kind of ranger ("t" "~/.local/share/Trash/files/" "TrashCan"))) :config (dirvish-override-dired-mode) - (dirvish-peek-mode) + ;; (dirvish-peek-mode) (setq dirvish-attributes '(all-the-icons file-size)) + (dirvish-define-preview exa (file) + "Uses `exa' to generate directory preview." + (when (file-directory-p file) ; we only interest in directories here + `(shell . ("exa" "--color=always" "-al" ,file)))) + (add-to-list 'dirvish-preview-dispatchers 'exa) + + (set-face-attribute 'ansi-color-blue nil :foreground "#FFFFFF") + (defun chris/dirvish-quit () "quit a fullscreen dirvish if it's open, else do a normal kill buffer" (interactive) @@ -1417,10 +1451,8 @@ Let's try using dirvish as a kind of ranger (dirvish-quit-h) (with-current-buffer (current-buffer) - (dirvish-toggle-fullscreen)) - (with-current-buffer - (current-buffer) - (kill-this-buffer)))) + (dirvish-toggle-fullscreen) + (dirvish-quit-h)))) :general (chris/leader-keys 'normal 'override "od" 'dirvish-dired :which-key "open dirvish here") @@ -1530,7 +1562,7 @@ Part of this config includes some special capture templates for my work as a you :jump-to-captured t) ("r" "Templates for projects") ("rt" "Project-local todo" entry - (file+headline +org-capture-project-todo-file "Inbox") + (file+headline chris/project-todo "Inbox") "* TODO %?\n%i\n%a" :prepend t) ("rn" "Project-local notes" entry (file+headline +org-capture-project-notes-file "Inbox") @@ -1576,6 +1608,7 @@ Part of this config includes some special capture templates for my work as a you "/home/chris/org/newsletter.org" "/home/chris/org/archive.org" "/home/chris/org/nvtfc_social_media.org" + "/home/chris/dev/church-presenter/TODO.org" "/home/chris/org/lessons/") org-id-method 'ts org-agenda-tags-column -105) @@ -1672,6 +1705,10 @@ We need to create a lesson capture function to find our lesson files differently (search-forward "PLAN"))) #+end_src +#+begin_src emacs-lisp +(defun chris/project-todo () + (concat (projectile-project-root) "TODO.org")) +#+end_src We are also going to make our config auto-tangle. This is so helpful on saving the .org file tangles out the config automatically. #+begin_src emacs-lisp (defun chris/org-babel-tangle-config () @@ -1997,7 +2034,7 @@ If on a: (setq mu4e-contexts (list (make-mu4e-context - :name "office" + :name "work" :match-func (lambda (msg) (when msg @@ -2008,9 +2045,9 @@ If on a: (mu4e-trash-folder . "/office/Deleted Items") (mu4e-refile-folder . "/office/Archive") (smtpmail-smtp-user . "chris@tfcconnection.org") - (mu4e-compose-signature . "---\nChris Cochrun"))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))) (make-mu4e-context - :name "outlook" + :name "personal" :match-func (lambda (msg) (when msg @@ -2021,7 +2058,7 @@ If on a: (mu4e-trash-folder . "/outlook/Deleted") (mu4e-refile-folder . "/outlook/Archive") (smtpmail-smtp-user . "chris.cochrun@outlook.com") - (mu4e-compose-signature . "---\nChris Cochrun"))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))) (make-mu4e-context :name "gmail" :match-func @@ -2031,7 +2068,7 @@ If on a: :vars '((user-mail-address . "ccochrun21@gmail.com") (mu4e-sent-folder . "/gmail/[Gmail].Sent Mail/") (smtpmail-smtp-user . "ccochrun21@gmail.com") - (mu4e-compose-signature . "---\nChris Cochrun"))))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))))) ;; Add the ability to send email for o365 (setq message-send-mail-function 'smtpmail-send-it @@ -2071,7 +2108,9 @@ If on a: :key 112))) (setq mu4e-mu-binary "/usr/bin/mu" - mu4e-view-prefer-html nil) + mu4e-view-prefer-html nil + shr-color-visible-luminance-min 80) + (setq mu4e-use-fancy-chars t mu4e-headers-draft-mark '("D" . "") mu4e-headers-flagged-mark '("F" . "") @@ -2417,11 +2456,13 @@ Let's use pdf-tools for a lot better interaction with pdfs. #+begin_src emacs-lisp :tangle no (use-package eaf - :straight (:host github :repo "manateelazycat/emacs-application-framework" - :files ("*.el" "*.py" "core" "app")) + :straight (:host github :repo "emacs-eaf/emacs-application-framework" + :files ("*.el" "*.py" "core" "*.json" "app" "*")) :defer 1 - :config - (setq eaf-browser-dark-mode t)) + :custom + (eaf-browser-dark-mode t) + (eaf-browser-continue-where-left-off t) + (eaf-browser-enable-adblocker t)) #+end_src ** Elfeed @@ -2648,7 +2689,8 @@ Matrix.el is a decent enough matrix client built in emacs. Like it. (use-package ement :straight (ement :type git :host github :repo "alphapapa/ement.el") :config - (setq ement-room-images t) + (setq ement-room-images t + ement-save-sessions t) :general (general-def 'normal ement-room-mode-map "q" 'bury-buffer diff --git a/init.el b/init.el index 15d80e24..865aeda7 100644 --- a/init.el +++ b/init.el @@ -560,8 +560,8 @@ targets." ;; Add `completion-at-point-functions', used by `completion-at-point'. (add-to-list 'completion-at-point-functions #'cape-file) ;; (add-to-list 'completion-at-point-functions #'cape-tex) - (add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-keyword) + (add-to-list 'completion-at-point-functions #'cape-dabbrev) ;;(add-to-list 'completion-at-point-functions #'cape-sgml) ;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;;(add-to-list 'completion-at-point-functions #'cape-abbrev) @@ -569,10 +569,16 @@ targets." ;;(add-to-list 'completion-at-point-functions #'cape-dict) ;; (add-to-list 'completion-at-point-functions #'cape-symbol) ;;(add-to-list 'completion-at-point-functions #'cape-line) + :config (setq cape-dabbrev-min-length 2) ) +(use-package devdocs + :general + (chris/leader-keys 'normal + "hd" 'devdocs-lookup)) + (use-package yasnippet :config (setq yas-snippet-dirs (list (expand-file-name "yasnippets/" user-emacs-directory))) @@ -684,7 +690,23 @@ targets." :commands (helpful-callable helpful-variable helpful-command helpful-key) :general (general-def 'normal 'helpful-mode-map - "q" 'chris/kill-buffer-frame)) + "q" 'helpful-kill-buffers) + :config + (defun helpful--autoloaded-p (sym buf) + "Return non-nil if function SYM is autoloaded." + (-when-let (file-name (buffer-file-name buf)) + (setq file-name (s-chop-suffix ".gz" file-name)) + (help-fns--autoloaded-p sym))) + + (defun helpful--skip-advice (docstring) + "Remove mentions of advice from DOCSTRING." + (let* ((lines (s-lines docstring)) + (relevant-lines + (--take-while + (not (or (s-starts-with-p ":around advice:" it) + (s-starts-with-p "This function has :around advice:" it))) + lines))) + (s-trim (s-join "\n" relevant-lines))))) (use-package format-all :config @@ -817,7 +839,8 @@ targets." (message file) (call-process "xdg-open" nil 0 nil file))) - (setq dired-dwim-target t) + (setq dired-dwim-target t + delete-by-moving-to-trash t) (setq dired-listing-switches "-aoh --group-directories-first") (setq dired-hide-details-hide-symlink-targets nil @@ -830,7 +853,7 @@ targets." :keymaps 'override "od" '(dired-jump :which-key "open dired here") "oD" '(dired :which-key "open dired select")) - (general-def 'normal dired-mode-map + ('normal dired-mode-map "q" 'kill-this-buffer "C-" 'chris/dired-open-xdg "C-'" 'embark-act)) @@ -959,7 +982,7 @@ targets." :jump-to-captured t) ("r" "Templates for projects") ("rt" "Project-local todo" entry - (file+headline +org-capture-project-todo-file "Inbox") + (file+headline chris/project-todo "Inbox") "* TODO %?\n%i\n%a" :prepend t) ("rn" "Project-local notes" entry (file+headline +org-capture-project-notes-file "Inbox") @@ -1005,6 +1028,7 @@ targets." "/home/chris/org/newsletter.org" "/home/chris/org/archive.org" "/home/chris/org/nvtfc_social_media.org" + "/home/chris/dev/church-presenter/TODO.org" "/home/chris/org/lessons/") org-id-method 'ts org-agenda-tags-column -105) @@ -1097,6 +1121,9 @@ targets." (goto-char (point-min)) (search-forward "PLAN"))) +(defun chris/project-todo () + (concat (projectile-project-root) "TODO.org")) + (defun chris/org-babel-tangle-config () (when (string-equal (buffer-file-name) (expand-file-name "README.org" user-emacs-directory)) @@ -1381,7 +1408,7 @@ If on a: (setq mu4e-contexts (list (make-mu4e-context - :name "office" + :name "work" :match-func (lambda (msg) (when msg @@ -1392,9 +1419,9 @@ If on a: (mu4e-trash-folder . "/office/Deleted Items") (mu4e-refile-folder . "/office/Archive") (smtpmail-smtp-user . "chris@tfcconnection.org") - (mu4e-compose-signature . "---\nChris Cochrun"))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))) (make-mu4e-context - :name "outlook" + :name "personal" :match-func (lambda (msg) (when msg @@ -1405,7 +1432,7 @@ If on a: (mu4e-trash-folder . "/outlook/Deleted") (mu4e-refile-folder . "/outlook/Archive") (smtpmail-smtp-user . "chris.cochrun@outlook.com") - (mu4e-compose-signature . "---\nChris Cochrun"))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))) (make-mu4e-context :name "gmail" :match-func @@ -1415,7 +1442,7 @@ If on a: :vars '((user-mail-address . "ccochrun21@gmail.com") (mu4e-sent-folder . "/gmail/[Gmail].Sent Mail/") (smtpmail-smtp-user . "ccochrun21@gmail.com") - (mu4e-compose-signature . "---\nChris Cochrun"))))) + (mu4e-compose-signature . "Praising God in all things,\nChris Cochrun"))))) ;; Add the ability to send email for o365 (setq message-send-mail-function 'smtpmail-send-it @@ -1455,7 +1482,9 @@ If on a: :key 112))) (setq mu4e-mu-binary "/usr/bin/mu" - mu4e-view-prefer-html nil) + mu4e-view-prefer-html nil + shr-color-visible-luminance-min 80) + (setq mu4e-use-fancy-chars t mu4e-headers-draft-mark '("D" . "") mu4e-headers-flagged-mark '("F" . "") @@ -1942,7 +1971,8 @@ interfere with the default `bongo-playlist-buffer'." (use-package ement :straight (ement :type git :host github :repo "alphapapa/ement.el") :config - (setq ement-room-images t) + (setq ement-room-images t + ement-save-sessions t) :general (general-def 'normal ement-room-mode-map "q" 'bury-buffer @@ -2002,8 +2032,7 @@ interfere with the default `bongo-playlist-buffer'." '(pdf-misc-print-program-args '("-o media=Letter" "-o fitplot") t) '(safe-local-variable-values '((projectile-project-run-cmd . "./build/bin/presenter") - (projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build/ . && make --dir build/") - (eval org-odt-styles-file "/home/chris/org/tfcexpenses2020.odt")))) + (projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build/ . && make --dir build/")))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful.