From 2a582684868382939f5c9251804c44e4db0b5764 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 12 Dec 2023 08:53:30 -0800 Subject: Don't fail if a snippet can't be found On my laptop the ‘mode-table’ is nil and causes the other function calls to fail. I'm not quite sure why this happens, but this shouldn't fail the operation. --- oni-yasnippet.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'oni-yasnippet.el') diff --git a/oni-yasnippet.el b/oni-yasnippet.el index 1e4d7f2..584d909 100644 --- a/oni-yasnippet.el +++ b/oni-yasnippet.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2023.0712.232619 +;; Version: 2023.1212.085307 ;; Package-Requires: (yasnippet yasnippet-snippets diminish) ;; This program is free software; you can redistribute it and/or modify @@ -36,11 +36,11 @@ (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))) + (and-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))) -- cgit v1.2.3-54-g00ecf