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’.
This commit is contained in:
parent
038c87bfea
commit
e38bb344e4
1 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue