From 7d411fbfd7ffa7c49d374fea065fd6f123ebb01f Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Thu, 8 Nov 2012 12:47:00 -0500 Subject: [PATCH] replace interactive-p with called-interactively-p macro tested compatible with GNU Emacs v 22.x - 24.x --- yasnippet.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index a62dc4a..301b4de 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1200,7 +1200,7 @@ the template of a snippet in the current snippet-table." (intern (yas--table-name table))) -;;; Internal functions: +;;; Internal functions and macros: (defun yas--real-mode? (mode) "Try to find out if MODE is a real mode. @@ -1310,6 +1310,15 @@ them all in `yas--menu-table'" :visible (yas--show-menu-p ',mode))) menu-keymap)) +(defmacro yas--called-interactively-p (&optional kind) + "A backward-compatible version of `called-interactively-p'. + +Optional KIND is as documented at `called-interactively-p' +in GNU Emacs 24.1 or higher." + (if (eq 0 (cdr (subr-arity (symbol-function 'called-interactively-p)))) + '(called-interactively-p) + `(called-interactively-p ,kind))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Template-related and snippet loading functions @@ -1646,7 +1655,7 @@ Optional USE-JIT use jit-loading of snippets." (buffer-list)))) (yas--schedule-jit mode-sym form) (eval form))))) - (when (interactive-p) + (when (yas--called-interactively-p 'interactive) (yas--message 3 "Loaded snippets from %s." top-level-dir))) (defun yas--load-directory-1 (directory mode-sym parents &optional no-compiled-snippets)