comparison lisp/mh-e/mh-acros.el @ 68137:ec4727559827

* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here from mh-gnus.el. * mh-gnus.el: Require mh-acros. (mh-defmacro-compat, mh-defun-compat): Move to mh-acros.el. * mh-utils.el (url-unreserved-chars, url-hexify-string): Define if not defined. Copied from url-util.el in Emacs22 for Emacs 21.
author Bill Wohler <wohler@newt.com>
date Wed, 11 Jan 2006 21:02:35 +0000
parents 9c3504ae6060
children bb73cb6860d2
comparison
equal deleted inserted replaced
68136:98275190ec04 68137:ec4727559827
1 ;;; mh-acros.el --- Macros used in MH-E 1 ;;; mh-acros.el --- Macros used in MH-E
2 2
3 ;; Copyright (C) 2004 Free Software Foundation, Inc. 3 ;; Copyright (C) 2004, 2006 Free Software Foundation, Inc.
4 4
5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu> 5 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
6 ;; Maintainer: Bill Wohler <wohler@newt.com> 6 ;; Maintainer: Bill Wohler <wohler@newt.com>
7 ;; Keywords: mail 7 ;; Keywords: mail
8 ;; See: mh-e.el 8 ;; See: mh-e.el
71 (defmacro mh-funcall-if-exists (function &rest args) 71 (defmacro mh-funcall-if-exists (function &rest args)
72 "Call FUNCTION with ARGS as parameters if it exists." 72 "Call FUNCTION with ARGS as parameters if it exists."
73 (when (fboundp function) 73 (when (fboundp function)
74 `(when (fboundp ',function) 74 `(when (fboundp ',function)
75 (funcall ',function ,@args)))) 75 (funcall ',function ,@args))))
76
77 (defmacro mh-defun-compat (function arg-list &rest body)
78 "This is a macro to define functions which are not defined.
79 It is used for functions which were added to Emacs recently.
80 If FUNCTION is not defined then it is defined to have argument
81 list, ARG-LIST and body, BODY."
82 (let ((defined-p (fboundp function)))
83 (unless defined-p
84 `(defun ,function ,arg-list ,@body))))
85 (put 'mh-defun-compat 'lisp-indent-function 'defun)
86
87 (defmacro mh-defmacro-compat (function arg-list &rest body)
88 "This is a macro to define functions which are not defined.
89 It is used for macros which were added to Emacs recently.
90 If FUNCTION is not defined then it is defined to have argument
91 list, ARG-LIST and body, BODY."
92 (let ((defined-p (fboundp function)))
93 (unless defined-p
94 `(defmacro ,function ,arg-list ,@body))))
95 (put 'mh-defmacro-compat 'lisp-indent-function 'defun)
76 96
77 (defmacro mh-make-local-hook (hook) 97 (defmacro mh-make-local-hook (hook)
78 "Make HOOK local if needed. 98 "Make HOOK local if needed.
79 XEmacs and versions of GNU Emacs before 21.1 require 99 XEmacs and versions of GNU Emacs before 21.1 require
80 `make-local-hook' to be called." 100 `make-local-hook' to be called."