diff options
author | 2023-07-12 23:28:12 -0700 | |
---|---|---|
committer | 2023-07-12 23:28:12 -0700 | |
commit | e38bb344e4196aa2a1488e9611d1ccecdeb5acd6 (patch) | |
tree | 7604669479ac5dbab3b305d79221338b92c10aa5 | |
parent | 038c87bfeafff488cdfa305bfb9dde776947a4dc (diff) | |
download | emacs-config-e38bb344e4196aa2a1488e9611d1ccecdeb5acd6.tar.gz emacs-config-e38bb344e4196aa2a1488e9611d1ccecdeb5acd6.zip |
Remove the ‘defun’ snippet from ‘lisp-interaction-mode’
It always confuses me that it's defined in ‘lisp-interaction-mode’, but not in
‘emacs-lisp-mode’. ‘emacs-lisp-mode’ has the same basic snippet under the key
‘def’.
-rw-r--r-- | oni-yasnippet.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/oni-yasnippet.el b/oni-yasnippet.el index 46a9e95..1e4d7f2 100644 --- a/oni-yasnippet.el +++ b/oni-yasnippet.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2021.0919.235328 +;; Version: 2023.0712.232619 ;; Package-Requires: (yasnippet yasnippet-snippets diminish) ;; This program is free software; you can redistribute it and/or modify @@ -34,6 +34,20 @@ (require 'yasnippet) (require 'diminish) +(defun oni-yasnippet-remove-snippet-by-name (name mode) + "Remove the snippet NAME from MODE's snippet tables." + (let* ((mode-table (gethash mode yas--tables)) + (uuidhash-table (yas--table-uuidhash mode-table)) + (hash-table (yas--table-hash mode-table)) + (snippet (gethash name uuidhash-table)) + (key (yas--template-key snippet))) + (remhash key hash-table) + (remhash name uuidhash-table))) + +(defun oni-yasnippet-cleanup-snippets () + "Remove some snippets that I don't like." + (oni-yasnippet-remove-snippet-by-name "defun" 'lisp-interaction-mode)) + (with-eval-after-load 'yasnippet (diminish 'yas-minor-mode)) (setq-default yas-buffer-local-condition yas-not-string-or-comment-condition) @@ -43,5 +57,7 @@ (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand) (define-key yas-minor-mode-map (kbd "TAB") nil) +(add-hook 'yas-after-reload-hook #'oni-yasnippet-cleanup-snippets) + (provide 'oni-yasnippet) ;;; oni-yasnippet.el ends here |