migrated to smartparens

This commit is contained in:
Thomas von Dein
2018-11-13 20:19:09 +01:00
parent 62f9b57fba
commit 41320789e4
2 changed files with 583 additions and 554 deletions

66
.emacs
View File

@@ -1,4 +1,4 @@
;; Toms Emacs Config - portable - version (20181111.01) -*-emacs-lisp-*- ;; Toms Emacs Config - portable - version (20181113.01) -*-emacs-lisp-*-
;; * Introduction ;; * Introduction
;; This is my emacs config, it is more than twenty years old. It ;; This is my emacs config, it is more than twenty years old. It
@@ -696,10 +696,11 @@
;; 20181111.01 ;; 20181111.01
;; - fixed autoscratch elisp trigger ;; - fixed autoscratch elisp trigger
;; - started with smartparens, first config just replaces paredit ;; - started with smartparens, first config just replaces paredit
;; 20181113.01
;; - disabled paredit, enabled smartparens
;; ** TODO ;; ** TODO
;; - check helpful https://github.com/wilfred/helpful ;; - check helpful https://github.com/wilfred/helpful
@@ -727,7 +728,7 @@
;; My emacs config has a version (consisting of a timestamp with a ;; My emacs config has a version (consisting of a timestamp with a
;; serial), which I display in the mode line. So I can clearly see, if ;; serial), which I display in the mode line. So I can clearly see, if
;; I'm using an outdated config somewhere. ;; I'm using an outdated config somewhere.
(defvar tvd-emacs-version "20181111.01") (defvar tvd-emacs-version "20181113.01")
;; -------------------------------------------------------------------------------- ;; --------------------------------------------------------------------------------
@@ -2143,28 +2144,30 @@ col1, col2"
;; *** Paredit for lisp only ;; *** Paredit for lisp only
;; 13.11.2018: disabled in exchange for smartparens, which see
;; I use paredit in lisp a lot, and I'm mostly happy with the defaults. ;; I use paredit in lisp a lot, and I'm mostly happy with the defaults.
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) ;; (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
;; However, I use it with lisp dialects only ;; ;; However, I use it with lisp dialects only
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) ;; (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode) ;; (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode) ;; (add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode) ;; (add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) ;; (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode) ;; (add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1))) ;; (add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
;; sometimes I need to be able to turn it off fast: ;; ;; sometimes I need to be able to turn it off fast:
(defalias 'pe 'paredit-mode) ;; (defalias 'pe 'paredit-mode)
(eval-after-load 'paredit ;; (eval-after-load 'paredit
'(progn ;; '(progn
;; force my own bindings for those ;; ;; force my own bindings for those
(define-key paredit-mode-map (kbd "C-d") nil) ;; (define-key paredit-mode-map (kbd "C-d") nil)
(define-key paredit-mode-map (kbd "<M-up>") nil) ;; (define-key paredit-mode-map (kbd "<M-up>") nil)
(define-key paredit-mode-map (kbd "<M-down>") nil))) ;; (define-key paredit-mode-map (kbd "<M-down>") nil)))
;; -------------------------------------------------------------------------------- ;; --------------------------------------------------------------------------------
;; *** Smart Parens ;; *** Smart Parens
;; I'm trying to migrate to smart-parens, since it supports all of ;; I'm trying to migrate to smart-parens, since it supports all of
@@ -2187,6 +2190,14 @@ Used when enabling smartparens-mode."
(when paredit-mode (when paredit-mode
(disable-paredit-mode)))) (disable-paredit-mode))))
;; automatically enable where needed
(add-something-to-mode-hooks
'(emacs-lisp ielm lisp lisp-interaction scheme slime-repl) 'smartparens-mode)
;; also in some select prog modes
(add-something-to-mode-hooks
'(perl ruby c c++ shell-script makefile config-general) 'smartparens-mode)
(eval-after-load 'smartparens (eval-after-load 'smartparens
'(progn '(progn
;; hydra via https://github.com/lunaryorn/old-emacs-configuration/blob/master/init.el ;; hydra via https://github.com/lunaryorn/old-emacs-configuration/blob/master/init.el
@@ -2273,7 +2284,7 @@ respectively."
(double-quote . "\"") (double-quote . "\"")
(back-quote . "`"))) (back-quote . "`")))
(add-hook 'smartparens-enabled-hook #'tvd-disable-par-and-pair) ;;(add-hook 'smartparens-enabled-hook #'tvd-disable-par-and-pair)
(add-hook 'smartparens-enabled-hook #'turn-on-smartparens-strict-mode) (add-hook 'smartparens-enabled-hook #'turn-on-smartparens-strict-mode)
;; auto wrapping w/o region ;; auto wrapping w/o region
@@ -2289,8 +2300,6 @@ respectively."
(define-key smartparens-mode-map (kbd "C-k") 'sp-kill-sexp) (define-key smartparens-mode-map (kbd "C-k") 'sp-kill-sexp)
(define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-slurp-sexp) (define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-slurp-sexp)
(define-key smartparens-mode-map (kbd "C-<right>") 'sp-forward-barf-sexp) (define-key smartparens-mode-map (kbd "C-<right>") 'sp-forward-barf-sexp)
(define-key smartparens-mode-map (kbd "M-<delete>") 'sp-unwrap-sexp)
(define-key smartparens-mode-map (kbd "M-<backspace>") 'sp-backward-unwrap-sexp)
;; movement ;; movement
;; Also Check: https://github.com/Fuco1/smartparens/wiki/Working-with-expressions ;; Also Check: https://github.com/Fuco1/smartparens/wiki/Working-with-expressions
@@ -2737,7 +2746,8 @@ string). It returns t if a new expansion is found, nil otherwise."
(sh-electric-here-document-mode 1) (sh-electric-here-document-mode 1)
;; Inserting a brace or quote automatically inserts the matching pair ;; Inserting a brace or quote automatically inserts the matching pair
(electric-pair-mode t) ;; use smartparens now
;; (electric-pair-mode t)
(setq-local hippie-expand-only-buffers '(config-general-mode)) (setq-local hippie-expand-only-buffers '(config-general-mode))
;; configure order of expansion functions ;; configure order of expansion functions
@@ -4287,13 +4297,13 @@ update heading list if neccessary."
(outshine-to-org) (outshine-to-org)
(org-export-to-file 'html file)))) (org-export-to-file 'html file))))
(defun export () (defun export (cmessage)
"Export .emacs to git, do not use." "Export .emacs to git, do not use."
;; FIXME: generate version number, add last changelog to git ;; FIXME: generate version number, add last changelog to git
(interactive) (interactive "sEnter Commit Message: ")
(outshine-to-html "~/D/github/dot-emacs/emacs.html") (outshine-to-html "~/D/github/dot-emacs/emacs.html")
(shell-command "cp ~/.emacs ~/D/github/dot-emacs/") (shell-command "cp ~/.emacs ~/D/github/dot-emacs/")
(shell-command "cd ~/D/github/dot-emacs && git ci +fixes .emacs emacs.html") (shell-command (format "cd ~/D/github/dot-emacs && git ci '%s' .emacs emacs.html" cmessage))
(shell-command "cd ~/D/github/dot-emacs && git push")) (shell-command "cd ~/D/github/dot-emacs && git push"))
;; -------------------------------------------------------------------------------- ;; --------------------------------------------------------------------------------

1071
emacs.html

File diff suppressed because it is too large Load Diff