* gnus-compat.el: Require `help-fns' to fix compilation error.
[gnus] / lisp / gnus-compat.el
1 ;;; gnus-compat.el --- Compatability functions for Gnus
2
3 ;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: compat
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;; This package defines and redefines a bunch of functions for Gnus
26 ;; usage.  The basic (and somewhat unsound) idea is to make all
27 ;; Emacsen look like the current trunk of Emacs.  So it will define
28 ;; functions "missing" in other Emacs instances, and redefine other
29 ;; functions to work like the Emacs trunk versions.
30
31 (eval-when-compile (require 'cl))
32
33 (ignore-errors
34   (require 'help-fns))
35
36 (when (and (not (fboundp 'help-function-arglist))
37            (fboundp 'function-arglist))
38   (defun help-function-arglist (def &optional preserve-names)
39     (cdr (car (read-from-string (downcase (function-arglist def)))))))
40
41 (when (= (length (help-function-arglist 'delete-directory)) 1)
42   (defvar gnus-compat-original-delete-directory
43     (symbol-function 'delete-directory))
44   (defun delete-directory (directory &optional recursive)
45     (if (not recursive)
46         (funcall gnus-compat-original-delete-directory directory)
47       (dolist (file (directory-files directory t))
48         (unless (member (file-name-nondirectory file) '("." ".."))
49           (if (file-directory-p file)
50               (delete-directory file t)
51             (delete-file file))))
52       (delete-directory directory))))
53
54 (provide 'gnus-compat)
55
56 ;; gnus-compat.el ends here