replace interactive-p with called-interactively-p macro

tested compatible with GNU Emacs v 22.x - 24.x
This commit is contained in:
Roland Walker 2012-11-08 12:47:00 -05:00
parent 880767e669
commit 7d411fbfd7

View File

@ -1200,7 +1200,7 @@ the template of a snippet in the current snippet-table."
(intern (yas--table-name table))) (intern (yas--table-name table)))
;;; Internal functions: ;;; Internal functions and macros:
(defun yas--real-mode? (mode) (defun yas--real-mode? (mode)
"Try to find out if MODE is a real 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))) :visible (yas--show-menu-p ',mode)))
menu-keymap)) 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 ;;; Template-related and snippet loading functions
@ -1646,7 +1655,7 @@ Optional USE-JIT use jit-loading of snippets."
(buffer-list)))) (buffer-list))))
(yas--schedule-jit mode-sym form) (yas--schedule-jit mode-sym form)
(eval form))))) (eval form)))))
(when (interactive-p) (when (yas--called-interactively-p 'interactive)
(yas--message 3 "Loaded snippets from %s." top-level-dir))) (yas--message 3 "Loaded snippets from %s." top-level-dir)))
(defun yas--load-directory-1 (directory mode-sym parents &optional no-compiled-snippets) (defun yas--load-directory-1 (directory mode-sym parents &optional no-compiled-snippets)