]> code.delx.au - gnu-emacs-elpa/commitdiff
replace interactive-p with called-interactively-p macro
authorRoland Walker <walker@pobox.com>
Thu, 8 Nov 2012 17:47:00 +0000 (12:47 -0500)
committerRoland Walker <walker@pobox.com>
Thu, 8 Nov 2012 17:47:00 +0000 (12:47 -0500)
tested compatible with GNU Emacs v 22.x - 24.x

yasnippet.el

index a62dc4aac92c6ab03fde729cf6f91f6c7cb67de5..301b4de272e3b68caa4b52ab05400b029abc508f 100644 (file)
@@ -1200,7 +1200,7 @@ the template of a snippet in the current snippet-table."
   (intern (yas--table-name table)))
 
 \f
-;;; 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)