branch: externals/setup commit 36b5ef26147185ea47feb84465a017998b82f5cf Author: Philip K <phil...@posteo.net> Commit: Philip K <phil...@posteo.net>
Add yasnippet configuration as another example --- README.md | 23 +++++++++++++++++++++-- setup.el | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0bbb6e7..9e25927 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,18 @@ example, these macros: (:bind (key bury-buffer)))) - (setup (package paredit) + (setup (:package paredit) (:hide-mode) (:hook-into scheme-mode lisp-mode)) + + (setup (:package yasnippet) + (:with-mode yas-minor-mode + (:rebind "<backtab>" yas-expand) + (:option yas-prompt-functions '(yas-completing-prompt) + yas-wrap-around-region t) + (:hook-into prog-mode))) + will be replaced with the functional equivalent of (global-set-key (kbd "C-c s") #'shell) @@ -22,12 +30,23 @@ will be replaced with the functional equivalent of (unless (package-install-p 'paredit) - (package-install 'paredit )) + (package-install 'paredit)) (delq (assq 'paredit-mode minor-mode-alist) minor-mode-alist) (add-hook 'scheme-mode-hook #'paredit-mode) (add-hook 'lisp-mode-hook #'paredit-mode) + + (unless (package-install-p 'yasnippet) + (package-install 'yasnippet)) + (with-eval-after-load 'yasnippet + (dolist (key (where-is-internal 'yas-expand yas-minor-mode-map)) + (define-key yas-minor-mode-map key nil)) + (define-key yas-minor-mode-map "<backtab>" #'yas-expand) + (customize-set-variable 'yas-prompt-functions '(yas-completing-prompt)) + (customize-set-variable 'yas-wrap-around-region t)) + (add-hook 'prog-mode-hook #'yas-minor-mode) + Additional "keywords" can be defined using `setup-define'. All known keywords are documented in the docstring for `setup'. diff --git a/setup.el b/setup.el index 8a95dbe..69a32e3 100644 --- a/setup.el +++ b/setup.el @@ -28,6 +28,13 @@ ;; (setup (:package paredit) ;; (:hide-mode) ;; (:hook-into scheme-mode lisp-mode)) +;; +;; (setup (:package yasnippet) +;; (:with-mode yas-minor-mode +;; (:rebind "<backtab>" yas-expand) +;; (:option yas-prompt-functions '(yas-completing-prompt) +;; yas-wrap-around-region t) +;; (:hook-into prog-mode))) ;; will be replaced with the functional equivalent of @@ -42,6 +49,17 @@ ;; minor-mode-alist) ;; (add-hook 'scheme-mode-hook #'paredit-mode) ;; (add-hook 'lisp-mode-hook #'paredit-mode) +;; +;; (unless (package-install-p 'yasnippet) +;; (package-install 'yasnippet)) +;; (with-eval-after-load 'yasnippet +;; (dolist (key (where-is-internal 'yas-expand yas-minor-mode-map)) +;; (define-key yas-minor-mode-map key nil)) +;; (define-key yas-minor-mode-map "<backtab>" #'yas-expand) +;; (customize-set-variable 'yas-prompt-functions '(yas-completing-prompt)) +;; (customize-set-variable 'yas-wrap-around-region t)) +;; (add-hook 'prog-mode-hook #'yas-minor-mode) + ;; Additional "keywords" can be defined using `setup-define'. All ;; known keywords are documented in the docstring for `setup'.