From 96407712a799d06e4b24d50c84b4350233f04d98 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 2 Oct 2021 00:04:16 -0500 Subject: [PATCH] Lisp stuff --- init.el | 77 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/init.el b/init.el index 25aaad6..52eab26 100644 --- a/init.el +++ b/init.el @@ -379,8 +379,9 @@ "Toggle `lexical-binding' in the current buffer." (interactive) (setq lexical-binding (not lexical-binding)) - (message "Lexical-binding is %s" - (if lexical-binding "on." "off."))))) + (message "Lexical-binding is %sabled." + (if lexical-binding "en" "dis")) + (force-mode-line-update)))) (:with-map case-map @@ -723,7 +724,7 @@ specific to most general, they are these: smie-indent-basic tab-width) (:hook #'show-paren-mode - #'electric-pair-local-mode + ;; #'electric-pair-local-mode #'acdw/setup-fringes #'display-fill-column-indicator-mode @@ -774,13 +775,14 @@ specific to most general, they are these: (setup scratch (:option inhibit-startup-screen t initial-buffer-choice t - initial-scratch-message "" - ;; (concat ";; Howdy, " - ;; (nth 0 (split-string - ;; user-full-name)) - ;; "! " - ;; "Welcome to GNU Emacs.\n\n") - ) + initial-major-mode #'lisp-interaction-mode + lexical-binding t + initial-scratch-message + (concat ";; Howdy, " + (nth 0 (split-string + user-full-name)) + "! " + "Welcome to GNU Emacs.\n\n")) (add-hook 'kill-buffer-query-functions (defun kill-buffer-query@immortal-scratch () @@ -2110,17 +2112,18 @@ the default is \"/\"." (:file-match (rx ".pdf" eos)) (pdf-loader-install)) -(setup (:straight persistent-scratch) - (:option persistent-scratch-backup-directory (acdw/dir "scratch" t) - persistent-scratch-keep-n-newest-backups 12) +;; (setup (:straight persistent-scratch) +;; (:option persistent-scratch-backup-directory (acdw/dir "scratch" t) +;; persistent-scratch-keep-n-newest-backups 12 +;; persistent-scratch-what-to-save '(point)) - (persistent-scratch-setup-default) +;; (persistent-scratch-setup-default) - (mapc (lambda (buf) - (with-current-buffer buf - (when (funcall persistent-scratch-scratch-buffer-p-function) - (persistent-scratch-mode +1)))) - (buffer-list))) +;; (mapc (lambda (buf) +;; (with-current-buffer buf +;; (when (funcall persistent-scratch-scratch-buffer-p-function) +;; (persistent-scratch-mode +1)))) +;; (buffer-list))) (setup (:straight restart-emacs) (defun emacs-upgrade (&optional update-packages) @@ -2140,6 +2143,8 @@ the default is \"/\"." (:bind "M-!" shell-command+)) (:global "M-!" shell-command+)) +(setup (:straight sicp)) + (setup (:straight simple-modeline minions) (:also-load acdw-modeline) @@ -2222,8 +2227,40 @@ the default is \"/\"." (setup (:straight smartparens) (require 'smartparens-config) - (add-hook 'prog-mode #'smartparens-strict-mode)) + (sp-use-paredit-bindings) + (add-to-list 'sp-lisp-modes 'fennel-mode :append) + (dolist (mode '(cider-repl-mode-hook + clojure-mode-hook + common-lisp-mode-hook + emacs-lisp-mode-hook + fennel-mode-hook + geiser-repl-mode-hook + inferior-emacs-lisp-mode-hook + inferior-lisp-mode-hook + lisp-mode-hook + racket-mode-hook + racket-repl-mode-hook + scheme-mode-hook + sly-mrepl-mode-hook)) + (add-hook mode #'smartparens-strict-mode)) + + (dolist (mode '(eval-expression-minibuffer-setup-hook + lisp-data-mode-hook)) + (add-hook mode #'aorst/minibuffer-enable-sp)) + + (add-hook 'prog-mode #'smartparens-mode) + + (defun aorst/minibuffer-enable-sp () + "Enable `smartparens-strict-mode' in the minibuffer, during `eval-expression'." + (setq-local comment-start ";") + (sp-local-pair 'minibuffer-pairs "'" nil :actions nil) + (sp-local-pair 'minibuffer-pairs "`" nil :actions nil) + (sp-update-local-pairs 'minibuffer-pairs) + (smartparens-strict-mode 1)) + + (:bind "C-M-q" #'sp-indent-defun + "M-r" #'sp-rewrap-sexp)) (setup (:straight ssh-config-mode) (:file-match (rx "/.ssh/config" eos) (rx "/ssh" (? "d") "_config" eos))