X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-compat.el;h=2b25e45edcdce476b5fafd773745b9a78fd6d299;hb=873ba7b51ddfb07246cd874b7de72662308236c9;hp=f92c5b27165766d152dd552cf2909386e90fc97a;hpb=0444d5f075616b0e4341ebf706a017224e351712;p=gnus diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el index f92c5b271..2b25e45ed 100644 --- a/lisp/gnus-compat.el +++ b/lisp/gnus-compat.el @@ -33,15 +33,40 @@ (ignore-errors (require 'help-fns)) +;; XEmacs doesn't have this function. (when (and (not (fboundp 'help-function-arglist)) (fboundp 'function-arglist)) (defun help-function-arglist (def &optional preserve-names) + "Return a formal argument list for the function DEF. +PRESERVE-NAMES is ignored." (cdr (car (read-from-string (downcase (function-arglist def))))))) +;; Modify this function on Emacs 23.1 and earlier to always return the +;; right answer. +(when (and (fboundp 'help-function-arglist) + (eq (help-function-arglist 'car) t)) + (defvar gnus-compat-original-help-function-arglist + (symbol-function 'help-function-arglist)) + (defun help-function-arglist (def &optional preserve-names) + "Return a formal argument list for the function DEF. +PRESERVE-NAMES is ignored." + (let ((orig (funcall gnus-compat-original-help-function-arglist def))) + (if (not (eq orig t)) + orig + ;; Built-in subrs have the arglist hidden in the doc string. + (let ((doc (documentation def))) + (when (and doc + (string-match "\n\n\\((fn\\( .*\\)?)\\)\\'" doc)) + (cdr (car (read-from-string (downcase (match-string 1 doc))))))))))) + (when (= (length (help-function-arglist 'delete-directory)) 1) (defvar gnus-compat-original-delete-directory (symbol-function 'delete-directory)) - (defun delete-directory (directory &optional recursive) + (defun delete-directory (directory &optional recursive trash) + "Delete the directory named DIRECTORY. Does not follow symlinks. +If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well. +TRASH is ignored." + (interactive "DDirectory: ") (if (not recursive) (funcall gnus-compat-original-delete-directory directory) (dolist (file (directory-files directory t)) @@ -51,6 +76,34 @@ (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)))) + (provide 'gnus-compat) ;; gnus-compat.el ends here