X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-compat.el;h=3241cd1ae22931e067340a50edb78e7fa04257bf;hb=2df323a009ddd334ef992f32b7a8441daa6b6256;hp=ea8dd4d7bea80a12c1476edaf0d0a49c42590e54;hpb=6c131a3af3eb29c1139390ba2cb598a88f6077bc;p=gnus diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el index ea8dd4d7b..3241cd1ae 100644 --- a/lisp/gnus-compat.el +++ b/lisp/gnus-compat.el @@ -76,6 +76,52 @@ TRASH is ignored." (delete-file file)))) (delete-directory directory)))) +;; Emacs 24.0.93 +(require 'url) +(when (= (length (help-function-arglist 'url-retrieve)) 5) + (defvar gnus-compat-original-url-retrieve + (symbol-function 'url-retrieve)) + (defun url-retrieve (url callback &optional cbargs silent inhibit-cookies) + "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished." + (funcall gnus-compat-original-url-retrieve + url callback cbargs silent))) + +;; XEmacs +(when (and (not (fboundp 'timer-set-function)) + (fboundp 'set-itimer-function)) + (defun timer-set-function (timer function &optional args) + "Make TIMER call FUNCTION with optional ARGS when triggering." + (lexical-let ((function function) + (args args)) + (set-itimer-function timer + (lambda (process status) + (apply function process status args)))))) + +;; XEmacs 21.4 +(unless (fboundp 'bound-and-true-p) + (defmacro bound-and-true-p (var) + "Return the value of symbol VAR if it is bound, else nil." + (and (boundp var) + (symbol-value var)))) + + +;; Emacs less than 24.3 +(unless (fboundp 'add-face) + (defun add-face (beg end face) + "Combine FACE BEG and END." + (let ((b beg)) + (while (< b end) + (let ((oldval (get-text-property b 'face))) + (put-text-property + b (setq b (next-single-property-change b 'face nil end)) + 'face (cond ((null oldval) + face) + ((and (consp oldval) + (not (keywordp (car oldval)))) + (cons face oldval)) + (t + (list face oldval))))))))) + (provide 'gnus-compat) ;; gnus-compat.el ends here