diff options
author | shoshin <shoshin@cicadas.surf> | 2023-05-12 21:34:57 -0500 |
---|---|---|
committer | shoshin <shoshin@cicadas.surf> | 2023-05-12 21:37:06 -0500 |
commit | 2c9aa551e5a56a775da69e4ecc19ea75b8bc4aee (patch) | |
tree | 89a53a00c4e7969c03952334bd1e1865e568c2a2 | |
parent | 9da5adccc37190095d0cf5fb98554fbfdf529a42 (diff) |
Clean: fix lint errors, warnings and notes
-rw-r--r-- | shoshimacs.el | 88 | ||||
-rw-r--r-- | shoshimacs.org | 89 |
2 files changed, 106 insertions, 71 deletions
diff --git a/shoshimacs.el b/shoshimacs.el index fec63b2..b210f6e 100644 --- a/shoshimacs.el +++ b/shoshimacs.el @@ -1,4 +1,8 @@ -;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*- +;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*- +;;; Commentary: +;;; Personal configuration rewritten from basics. + +;;; Code: (let ((my-custom-file (expand-file-name "shoshimacs-custom.el" user-emacs-directory))) @@ -16,7 +20,7 @@ (find-file *my-config*)) (defun my-reload-config () - "Tangles and reloads a literate config with `org-babel-load-file'" + "Tangles and reloads a literate config with `org-babel-load-file'." (interactive) (org-babel-load-file *my-config*)) @@ -37,17 +41,23 @@ "List of themes I prefer for narrowing and random selection.") ;;; Package Management +(require 'package) + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) (package-refresh-contents) ;; this will make internet requests on start up -(when (and (functionp #'native-comp-available-p) (native-comp-available-p)) - (setq native-comp-always-compile t - package-native-compile t)) +(require 'comp) +(setq native-comp-always-compile t + package-native-compile t) ;;; Major Keybinding ;; these need to be set before requiring the package +(defvar xah-fly-use-control-key) +(defvar xah-fly-use-meta-key) +(defvar xah-fly-leader-key-map) +(defvar xah-fly-command-map) (setq xah-fly-use-control-key nil xah-fly-use-meta-key nil) (package-install 'xah-fly-keys) @@ -58,18 +68,18 @@ (define-key 'xah-fly-leader-key-map (kbd "1") #'delete-other-windows) (defmacro with-map-defkey (keymap leader &rest pairs) - "Define a new KEYMAP with prefix key LEADER, and list of bindings in it." + "Define a new KEYMAP with prefix key LEADER and list of bindings PAIRS in it." (declare (indent 2)) `(progn (defvar ,keymap (make-sparse-keymap)) (define-prefix-command (quote ,keymap)) (global-set-key (kbd ,leader) ,keymap) (mapc (lambda (pair) - (define-key ,keymap - (kbd (if (numberp (car pair)) (number-to-string (car pair)) - (symbol-name (car pair)))) - (cadr pair))) - (quote ,(seq-partition pairs 2))))) + (define-key ,keymap + (kbd (if (numberp (car pair)) (number-to-string (car pair)) + (symbol-name (car pair)))) + (cadr pair))) + (quote ,(seq-partition pairs 2))))) (with-map-defkey my-key-map "M-m" 1 delete-other-windows @@ -99,6 +109,7 @@ tab-always-indent 'complete) (package-install 'consult) +(require 'consult) (global-set-key (kbd "C-x b") #'consult-buffer) (define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer) @@ -109,6 +120,7 @@ (setq consult-themes my-chosen-themes)) (defun my-show-all-themes () + "Remove the selected themes from `consult-themes` so all installed themes will show." (interactive) (setq consult-themes nil)) @@ -171,6 +183,7 @@ org-refile-targets '((nil . (:maxlevel . 2)))) (defun my-org-top-level-heading () + "Jump to the top level parent of an org subtree." (interactive) (let ((moo 1)) (while moo (setq moo (org-up-heading-safe))))) @@ -202,9 +215,29 @@ ;;; Programming (setq inferior-lisp-program "sbcl") -(package-install 'sly) - -(package-install 'sly-quicklisp) +(setq slime-contribs + '( + slime-fancy ;; default value, includes many fundamental contribs + slime-company + slime-mrepl + inferior-slime + slime-fuzzy + slime-asdf + slime-banner + slime-presentations + slime-xref-browser + slime-highlight-edits + slime-quicklisp + )) + +(slime-setup) + +(defun my-slime-return (_) + "Function to advise `slime-repl-return' to make <RET> inspect the presentation at point." + (when (slime-presentation-around-or-before-point-p) + (slime-inspect-presentation-at-point (point)))) + +(advice-add 'slime-repl-return :before #'my-slime-return) (package-install 'json-mode) @@ -253,31 +286,6 @@ (package-install 'srht) (setq srht-username "shoshin") -(defun read-file-into-string (f) - (with-temp-buffer - (insert-file-contents f) - (buffer-string))) - -(setq cicadas-paste-pw (read-file-into-string "~/.bepasty-key")) - -(defun cicadas-paste-current-buffer () - (interactive) - (let ((tmpfile - (concat "/tmp/" (buffer-name)))) - (write-region nil nil tmpfile) - (let ((url - (cl-first (last (butlast - (split-string - (shell-command-to-string - (format "pastebinit -i '%s' -p %s -t '%s' -f text/plain" - tmpfile - cicadas-paste-pw - (buffer-name))) - "\n")))))) - (delete-file tmpfile) - (kill-new url) - (message "Pasted to %s (on kill ring)" url)))) - (package-install 'restclient) ;;; User Interface @@ -331,3 +339,5 @@ Saves to a temp file and puts the filename in the kill ring." (message filename))) (package-install 'windresize) +(provide 'shoshimacs) +;;; shoshimacs.el ends here diff --git a/shoshimacs.org b/shoshimacs.org index fd6aed7..97520a4 100644 --- a/shoshimacs.org +++ b/shoshimacs.org @@ -32,7 +32,11 @@ The following code block is the "table of contents" that determines what is "tangled" into the resulting elisp file: #+begin_src emacs-lisp :tangle ~/melpa-emacs.d/init.el :noweb no-export - ;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*- + ;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*- + ;;; Commentary: + ;;; Personal configuration rewritten from basics. + + ;;; Code: <<preamble>> @@ -64,6 +68,9 @@ is "tangled" into the resulting elisp file: ;;; User Interface <<user-interface>> + + (provide 'shoshimacs) + ;;; shoshimacs.el ends here #+end_src ** Preamble @@ -101,7 +108,7 @@ quickly jump to it and reload it. (find-file *my-config*)) (defun my-reload-config () - "Tangles and reloads a literate config with `org-babel-load-file'" + "Tangles and reloads a literate config with `org-babel-load-file'." (interactive) (org-babel-load-file *my-config*)) #+end_src @@ -139,6 +146,10 @@ like straight is having all of the packages' source code cloned into local repos on your machine. This makes it easier to fix bugs and make contributions to the packages you're using. +#+begin_src emacs-lisp + (require 'package) +#+end_src + ** MELPA This is one of the primary community archives. It is very exhaustive, primarily @@ -240,9 +251,9 @@ Compilation will happen in the background and is logged to the have to worry about it, though you may see some compilation warnings at times. #+begin_src emacs-lisp - (when (and (functionp #'native-comp-available-p) (native-comp-available-p)) - (setq native-comp-always-compile t - package-native-compile t)) + (require 'comp) + (setq native-comp-always-compile t + package-native-compile t) #+end_src * Keybinding @@ -264,10 +275,17 @@ and keep organized. This is what I adopted to combat RSI. my muscle memory is tied into it tightly right now. you may have other opinions about keybindings +There's some oddity with some of the variables in the package when trying +to lint/compile my init, so i'm declaring some of the special vars here too. + #+begin_src emacs-lisp ;; these need to be set before requiring the package + (defvar xah-fly-use-control-key) + (defvar xah-fly-use-meta-key) + (defvar xah-fly-leader-key-map) + (defvar xah-fly-command-map) (setq xah-fly-use-control-key nil - xah-fly-use-meta-key nil) + xah-fly-use-meta-key nil) (package-install 'xah-fly-keys) (require 'xah-fly-keys) (xah-fly-keys-set-layout "qwerty") @@ -297,18 +315,18 @@ bit of ergonomics essentially avoiding some parens and quotes 😂 #+begin_src emacs-lisp (defmacro with-map-defkey (keymap leader &rest pairs) - "Define a new KEYMAP with prefix key LEADER, and list of bindings in it." + "Define a new KEYMAP with prefix key LEADER and list of bindings PAIRS in it." (declare (indent 2)) `(progn (defvar ,keymap (make-sparse-keymap)) (define-prefix-command (quote ,keymap)) (global-set-key (kbd ,leader) ,keymap) (mapc (lambda (pair) - (define-key ,keymap - (kbd (if (numberp (car pair)) (number-to-string (car pair)) - (symbol-name (car pair)))) - (cadr pair))) - (quote ,(seq-partition pairs 2))))) + (define-key ,keymap + (kbd (if (numberp (car pair)) (number-to-string (car pair)) + (symbol-name (car pair)))) + (cadr pair))) + (quote ,(seq-partition pairs 2))))) (with-map-defkey my-key-map "M-m" 1 delete-other-windows @@ -379,8 +397,8 @@ into leader key maps. :END: Completion is a huge part of my experience using Emacs. I have been on -an evolving journey of from the basic type of terminal tab completion -to spaceship level UI implemented as almost a sub-application in Emacs. +an evolving journey from the basic type of terminal tab completion +to spaceship level UI implemented as a sub-application in Emacs. This configuration is aiming at using a new crop of completion enhancements that tie into Emacs's native completion API. This is a more modular approach @@ -468,6 +486,7 @@ built in completing read functionality of the minibuffer. #+begin_src emacs-lisp (package-install 'consult) + (require 'consult) #+end_src main entry point would be ~consult-buffer~. however, there are many consult @@ -517,6 +536,7 @@ all of them in the ~consult-themes~ list. #+begin_src emacs-lisp (defun my-show-all-themes () + "Remove the selected themes from `consult-themes` so all installed themes will show." (interactive) (setq consult-themes nil)) #+end_src @@ -713,6 +733,7 @@ to find one i could build a command out of: #+begin_src emacs-lisp (defun my-org-top-level-heading () + "Jump to the top level parent of an org subtree." (interactive) (let ((moo 1)) (while moo (setq moo (org-up-heading-safe))))) @@ -853,7 +874,7 @@ Company backend for slime (package-install 'slime-company) #+end_src -***** Manual install +***** COMMENT Manual install #+begin_src emacs-lisp (defvar slime-company-repo "https://github.com/anwyn/slime-company") (defvar slime-company-src-dir (expand-file-name "~/src/slime-company/")) @@ -863,7 +884,7 @@ Company backend for slime (format "git clone %s %s" slime-company-repo slime-company-src-dir))) (add-to-list 'load-path slime-company-src-dir) - (packag-install-file slime-company-src-dir) + (package-install-file slime-company-src-dir) (setq slime-company-completion 'fuzzy slime-company-display-arglist 1) #+end_src @@ -1044,6 +1065,7 @@ its the best! 🪄 #+begin_src emacs-lisp (package-install 'magit) #+end_src + * Applications :PROPERTIES: :header-args:emacs-lisp: :noweb-ref applications :noweb-sep "\n\n" :results silent @@ -1126,33 +1148,34 @@ HTTP requests. an API token is stored in my ~.authinfo~ file. -** paste.cicadas.surf +** COMMENT paste.cicadas.surf #+begin_src emacs-lisp (defun read-file-into-string (f) + "Return the contents of file F as a string." (with-temp-buffer (insert-file-contents f) (buffer-string))) (setq cicadas-paste-pw (read-file-into-string "~/.bepasty-key")) - (defun cicadas-paste-current-buffer () + (defun cicadas-paste-current-buffer () (interactive) (let ((tmpfile - (concat "/tmp/" (buffer-name)))) + (concat "/tmp/" (buffer-name)))) (write-region nil nil tmpfile) - (let ((url - (cl-first (last (butlast - (split-string - (shell-command-to-string - (format "pastebinit -i '%s' -p %s -t '%s' -f text/plain" - tmpfile - cicadas-paste-pw - (buffer-name))) - "\n")))))) - (delete-file tmpfile) - (kill-new url) - (message "Pasted to %s (on kill ring)" url)))) + (let ((url + (cl-first (last (butlast + (split-string + (shell-command-to-string + (format "pastebinit -i '%s' -p %s -t '%s' -f text/plain" + tmpfile + cicadas-paste-pw + (buffer-name))) + "\n")))))) + (delete-file tmpfile) + (kill-new url) + (message "Pasted to %s (on kill ring)" url)))) #+end_src ** restclient @@ -1174,7 +1197,7 @@ an API token is stored in my ~.authinfo~ file. (package-install-file (file-name-concat restclient-dir "restclient.el")) #+end_src -* UI +* UI/UX :PROPERTIES: :header-args:emacs-lisp: :noweb-ref user-interface :noweb-sep "\n\n" :results silent :END: @@ -1319,6 +1342,8 @@ candidates to ~consult-themes~. "List of themes I prefer for narrowing and random selection.") #+end_src +base16-still-alive + *** autothemer autothemer is a dependency of some nice themes, and a great tool |