comparison lisp/mh-e/mh-acros.el @ 67760:9c3504ae6060

Follow MH-E Developers Guide conventions. Use `' quotes for Help hyperlinks such as symbols, Info nodes, or URLs. Use \" quotes for everything else. Otherwise, you can accidently get links to nonsense symbols.
author Bill Wohler <wohler@newt.com>
date Fri, 23 Dec 2005 08:40:31 +0000
parents 6b063593fdad
children ec4727559827
comparison
equal deleted inserted replaced
67759:b7b75914a27d 67760:9c3504ae6060
30 ;; their presence there would cause a dependency loop with mh-customize.el. 30 ;; their presence there would cause a dependency loop with mh-customize.el.
31 ;; This file must always be included like this: 31 ;; This file must always be included like this:
32 ;; 32 ;;
33 ;; (eval-when-compile (require 'mh-acros)) 33 ;; (eval-when-compile (require 'mh-acros))
34 ;; 34 ;;
35 ;; It is so named with a silent `m' so that it is compiled first. Otherwise, 35 ;; It is so named with a silent "m" so that it is compiled first. Otherwise,
36 ;; "make recompile" in Emacs 21.4 fails. 36 ;; "make recompile" in Emacs 21.4 fails.
37 37
38 ;;; Change Log: 38 ;;; Change Log:
39 39
40 ;;; Code: 40 ;;; Code:
45 ;; The Emacs coding conventions require that the cl package not be required at 45 ;; The Emacs coding conventions require that the cl package not be required at
46 ;; runtime. However, the cl package in versions of Emacs prior to 21.4 left cl 46 ;; runtime. However, the cl package in versions of Emacs prior to 21.4 left cl
47 ;; routines in their macro expansions. Use mh-require-cl to provide the cl 47 ;; routines in their macro expansions. Use mh-require-cl to provide the cl
48 ;; routines in the best way possible. 48 ;; routines in the best way possible.
49 (defmacro mh-require-cl () 49 (defmacro mh-require-cl ()
50 "Macro to load `cl' if needed. 50 "Macro to load \"cl\" if needed.
51 Some versions of `cl' produce code for the expansion of 51 Some versions of \"cl\" produce code for the expansion of
52 \(setf (gethash ...) ...) that uses functions in `cl' at run 52 \(setf (gethash ...) ...) that uses functions in \"cl\" at run
53 time. This macro recognizes that and loads `cl' where 53 time. This macro recognizes that and loads \"cl\" where
54 appropriate." 54 appropriate."
55 (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash) 55 (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash)
56 `(require 'cl) 56 `(require 'cl)
57 `(eval-when-compile (require 'cl)))) 57 `(eval-when-compile (require 'cl))))
58 58
93 (t ;GNU Emacs 93 (t ;GNU Emacs
94 `(and (boundp 'transient-mark-mode) transient-mark-mode 94 `(and (boundp 'transient-mark-mode) transient-mark-mode
95 (boundp 'mark-active) mark-active)))) 95 (boundp 'mark-active) mark-active))))
96 96
97 (defmacro mh-defstruct (name-spec &rest fields) 97 (defmacro mh-defstruct (name-spec &rest fields)
98 "Replacement for `defstruct' from the `cl' package. 98 "Replacement for `defstruct' from the \"cl\" package.
99 The `defstruct' in the `cl' library produces compiler warnings, 99 The `defstruct' in the \"cl\" library produces compiler warnings,
100 and generates code that uses functions present in `cl' at 100 and generates code that uses functions present in \"cl\" at
101 run-time. This is a partial replacement, that avoids these 101 run-time. This is a partial replacement, that avoids these
102 issues. 102 issues.
103 103
104 NAME-SPEC declares the name of the structure, while FIELDS 104 NAME-SPEC declares the name of the structure, while FIELDS
105 describes the various structure fields. Lookup `defstruct' for 105 describes the various structure fields. Lookup `defstruct' for