summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-12-02 09:30:14 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-12-02 09:30:14 +0100
commit28196707d59d7079ad9e7b5a035fe5c6deb78dd7 (patch)
tree6a5bfca552721d5053198f92ac9b0550b49f5bbf
parent61bd8a338f47487e507388e2b03d0b9ab36d23fb (diff)
Revert "paredit --> smartparens."
This reverts commit 3f2fcbe724649a56f87d0014d5c7d616513109fb.
-rw-r--r--init.org37
1 files changed, 23 insertions, 14 deletions
diff --git a/init.org b/init.org
index 5d32d0b..d858395 100644
--- a/init.org
+++ b/init.org
@@ -79,7 +79,7 @@ To install all packages via GNU Guix I can either use a manifest file or use the
emacs-web-mode \
emacs-wget \
emacs-znc \
- emacs-smartparens \
+ emacs-paredit \
magit \
sicp \
mu
@@ -865,7 +865,7 @@ I don’t like a cluttered modeline, so I like to hide mode lighters with =rich-
#+BEGIN_SRC elisp
;; clean up mode line
(require 'rich-minority)
-(setq rm-whitelist '(" God" " Smartparens"))
+(setq rm-whitelist '(" God" " Paredit"))
;; show time in modeline but not load average
(setq display-time-format "%H:%M")
@@ -941,31 +941,40 @@ Emacs also highlights matching parentheses, but it does so with a delay. Here I
(show-paren-mode 1)
#+END_SRC
-Editing lispy languages is no fun without =smartparens= (or =paredit=), a mode to enforce balanced parentheses. Smartparens can be used not only for lispy languages but for all programming languages.
+Editing lispy languages is no fun without =paredit=, a mode to enforce balanced parentheses. Enable it automatically when editing Scheme, Common Lisp, or Elisp.
#+BEGIN_SRC elisp
-(add-hook 'prog-mode-hook (lambda () (smartparens-mode 1)))
+(add-hook 'scheme-mode-hook (lambda () (paredit-mode 1)))
+(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode 1)))
+(add-hook 'lisp-mode-hook (lambda () (paredit-mode 1)))
+(add-hook 'geiser-repl-mode-hook (lambda () (paredit-mode 1)))
#+END_SRC
-Also enable =smartparens= when editing Elisp in the minibuffer.
+Also enable =paredit= when editing Elisp in the minibuffer.
#+BEGIN_SRC elisp
-;; Enable `smartparens-mode' in the minibuffer, during `eval-expression'.
-(defun conditionally-enable-smartparens-mode ()
+;; Enable `paredit-mode' in the minibuffer, during `eval-expression'.
+(defun conditionally-enable-paredit-mode ()
(if (eq this-command 'eval-expression)
- (smartparens-mode 1)))
+ (paredit-mode 1)))
-(add-hook 'minibuffer-setup-hook 'conditionally-enable-smartparens-mode)
+(add-hook 'minibuffer-setup-hook 'conditionally-enable-paredit-mode)
#+END_SRC
-Some customisations for =smartparens=.
+Some customisations for =paredit=.
#+BEGIN_SRC elisp
(eval-when-compile
- (require 'smartparens))
-(with-eval-after-load "smartparens"
- (setq smartparens-strict-mode t)
- (sp-use-paredit-bindings))
+ (require 'paredit))
+(with-eval-after-load "paredit"
+ ;; don't hijack \ please
+ (define-key paredit-mode-map (kbd "\\") nil)
+ ;; keybindings
+ (define-key paredit-mode-map (kbd "M-C-<backspace>") 'backward-kill-sexp)
+ ;; making paredit work with delete-selection-mode
+ (put 'paredit-forward-delete 'delete-selection 'supersede)
+ (put 'paredit-backward-delete 'delete-selection 'supersede)
+ (put 'paredit-newline 'delete-selection t))
#+END_SRC
TODO: the parentheses adjustments should happen only when I’m in programming mode.