From 3a4c83ec3bc146bc0bc0f659f67559177ad80e80 Mon Sep 17 00:00:00 2001 From: Tyler Ware Date: Wed, 26 Feb 2020 10:45:14 -0700 Subject: [PATCH] Fix file template :when logic to apply to modes When a file template rule is evaluated against a particular buffer it is supposed to call the :when function if it is defined. Currently, the function is ignored if the PRED of the template rule is a mode. This fixes this issue. --- modules/editor/file-templates/config.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/editor/file-templates/config.el b/modules/editor/file-templates/config.el index 537cd1afd..ea1d1d81a 100644 --- a/modules/editor/file-templates/config.el +++ b/modules/editor/file-templates/config.el @@ -122,10 +122,10 @@ information.") (eq major-mode pred)) (and (stringp pred) (stringp buffer-file-name) - (string-match-p pred buffer-file-name) - (or (not (plist-member plist :when)) - (funcall (plist-get plist :when) - buffer-file-name)))) + (string-match-p pred buffer-file-name))) + (or (not (plist-member plist :when)) + (funcall (plist-get plist :when) + buffer-file-name)) rule))) (defun +file-templates-check-h ()