Commit 122480c6 authored by Christer Ekholm's avatar Christer Ekholm

Added compatibility macro for called-interactively-p, with a lot of

help from David Byers.

interactive-p is deprecated from emacs 23.2, called-interactively-p
should be used instead.  But called-interactively-p takes one argument
in emacs-23.2, and zero in emacs-23.1 and emacs-22.

Use called-interactively-p if defined, with arg unless calling it with
arg is an error, then call it without arg. If it's not defined use
interactive-p.

Tested in emacs-22.3 emacs-23.4 emacs-24.3 and xemacs-21.5.34
parent 33a36155
2014-06-15 Christer Ekholm <che@chrekh.se>
Added compatibility macro for called-interactively-p, with a lot
of help from David Byers.
* compatibility.el (lyskom-called-interactively-p): Added
compatibility macro lyskom-called-interactively-p
* commands1.el (kom-status-session, kom-review-presentation)
(kom-unread-presentation): Use lyskom-called-interactively-p
* commands2.el (kom-status-person, lyskom-help): Use
lyskom-called-interactively-p
2014-06-07 Christer Ekholm <che@chrekh.se>
Fixed docstrings for "Customize LysKOM".
......
......@@ -184,7 +184,7 @@ This command accepts text number prefix arguments (see
(let ((conf-stat
(if text-or-conf-no
(blocking-do 'get-conf-stat
(if (interactive-p)
(if (lyskom-called-interactively-p 'any)
(text-stat->author
(blocking-do 'get-text-stat text-or-conf-no))
text-or-conf-no))
......@@ -206,7 +206,7 @@ This command accepts text number prefix arguments (see
(let ((conf-stat
(if text-or-conf-no
(blocking-do 'get-conf-stat
(if (interactive-p)
(if (lyskom-called-interactively-p 'any)
(text-stat->author
(blocking-do 'get-text-stat text-or-conf-no))
text-or-conf-no))
......@@ -3251,7 +3251,7 @@ argument is used to find a text whose author's status is shown."
(interactive (and current-prefix-arg ; only peek at textno:s when prefixed!
(list (lyskom-read-text-no-prefix-arg
'text-to-see-author-status-of))))
(let ((sessions (or (when (and text-or-session-no (interactive-p))
(let ((sessions (or (when (and text-or-session-no (lyskom-called-interactively-p 'any))
(lyskom-session-from-conf
(text-stat->author
(blocking-do 'get-text-stat text-or-session-no))))
......
......@@ -287,7 +287,7 @@ This command accepts text number prefix arguments \(see
(list (lyskom-read-text-no-prefix-arg
'text-to-see-author-status-of))))
(let ((pers-no
(or (when (interactive-p)
(or (when (lyskom-called-interactively-p 'any)
(text-stat->author (blocking-do 'get-text-stat text-or-pers-no)))
text-or-pers-no
(lyskom-read-conf-no 'pers-for-status '(pers) nil nil t)))
......@@ -1222,7 +1222,7 @@ will be prompted for the mark."
"\n")))
;; next-char
)
(when (interactive-p)
(when (lyskom-called-interactively-p 'any)
(if (eq major-mode 'lyskom-mode)
(progn
(lyskom-insert text)
......
......@@ -714,6 +714,25 @@ Emacsen."
(defalias 'lyskom-pos-visible-in-window-p
'lyskom-pos-visible-in-window-p-22-1))
;;; ================================================================
;;; For emacs-23.2 and later.
(defmacro lyskom-called-interactively-p (kind)
"Calls called-interactively-p if supported, interactive-p if not."
(condition-case nil
(progn (called-interactively-p nil)
;; If the call didn't signal an error, then the new form
;; is supported: use it.
`(called-interactively-p ,kind))
(wrong-number-of-arguments
;; Probably Emacs-23.1.
(if (equal (eval kind) 'interactive)
`(interactive-p)
`(called-interactively-p)))
(error
;; called-interactively-p seems not to be supported, fallback
;; on the good ol' interactive-p.
`(interactive-p))))
;;; ================================================================
;;; ================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment