X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-compat.el;h=80e3113ecac177fc6e615ab6c64a54469e480554;hb=3bfc0af5c92752b2388a237510187be53d6bb2e7;hp=cc0bd456eb6a3c81319ebd02cae8d5a221a594ac;hpb=9fd82949bb69b002e2ff057f2a4e61c77261d1fc;p=gnus diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el index cc0bd456e..80e3113ec 100644 --- a/lisp/gnus-compat.el +++ b/lisp/gnus-compat.el @@ -1,6 +1,6 @@ ;;; gnus-compat.el --- Compatability functions for Gnus -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2012-2013g Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: compat @@ -77,6 +77,7 @@ TRASH is ignored." (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)) @@ -85,6 +86,49 @@ TRASH is ignored." (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))))))))) + +(unless (fboundp 'move-beginning-of-line) + (defun move-beginning-of-line (arg) + (interactive "p") + (unless (= arg 1) + (forward-line arg)) + (beginning-of-line))) + (provide 'gnus-compat) ;; gnus-compat.el ends here