* message.el (message-fix-before-sending): Hide again the invisible property
[elisp/gnus.git-] / lisp / dgnushack.el
1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ;;        Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;;      Katsumi Yamaoka <yamaoka@jpl.org>
7 ;; Version: 4.19
8 ;; Keywords: news, path
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;;; Code:
30
31 ;; Set coding priority of Shift-JIS to the bottom.
32 (if (featurep 'xemacs)
33     (defalias 'set-coding-priority 'ignore)
34   (defalias 'coding-priority-list 'ignore)
35   (defalias 'set-coding-priority-list 'ignore))
36 (cond ((and (featurep 'xemacs) (featurep 'mule))
37        (if (memq 'shift-jis (coding-priority-list))
38            (set-coding-priority-list
39             (append (delq 'shift-jis (coding-priority-list)) '(shift-jis)))))
40       ((boundp 'MULE)
41        (put '*coding-category-sjis* 'priority (length *predefined-category*)))
42       ((featurep 'mule)
43        (if (memq 'coding-category-sjis coding-category-list)
44            (set-coding-priority
45             (append (delq 'coding-category-sjis
46                           (copy-sequence coding-category-list))
47                     '(coding-category-sjis))))))
48
49 (defalias 'facep 'ignore)
50
51 (require 'cl)
52 (unless (dolist (var nil t))
53   ;; Override the macro `dolist' which might be defined in egg.el.
54   (load "cl-macs" nil t))
55
56 (defvar srcdir (or (getenv "srcdir") "."))
57
58 (let ((urldir (getenv "URLDIR")))
59   (unless (zerop (length urldir))
60     (push (file-name-as-directory urldir) load-path)))
61
62 (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR")))
63                                  (unless (zerop (length w3dir))
64                                    (file-name-as-directory w3dir))))
65 (when dgnushack-w3-directory
66   (push dgnushack-w3-directory load-path))
67
68 ;; If we are building w3 in a different directory than the source
69 ;; directory, we must read *.el from source directory and write *.elc
70 ;; into the building directory.  For that, we define this function
71 ;; before loading bytecomp.  Bytecomp doesn't overwrite this function.
72 (defun byte-compile-dest-file (filename)
73   "Convert an Emacs Lisp source file name to a compiled file name.
74  In addition, remove directory name part from FILENAME."
75   (setq filename (byte-compiler-base-file-name filename))
76   (setq filename (file-name-sans-versions filename))
77   (setq filename (file-name-nondirectory filename))
78   (if (memq system-type '(win32 w32 mswindows windows-nt))
79       (setq filename (downcase filename)))
80   (cond ((eq system-type 'vax-vms)
81          (concat (substring filename 0 (string-match ";" filename)) "c"))
82         ((string-match emacs-lisp-file-regexp filename)
83          (concat (substring filename 0 (match-beginning 0)) ".elc"))
84         (t (concat filename ".elc"))))
85
86 (require 'bytecomp)
87
88 (unless (fboundp 'si:byte-optimize-form-code-walker)
89   (byte-optimize-form nil);; Load `byte-opt' or `byte-optimize'.
90   (setq max-specpdl-size 3000)
91   (defalias 'si:byte-optimize-form-code-walker
92     (symbol-function 'byte-optimize-form-code-walker))
93   (defun byte-optimize-form-code-walker (form for-effect)
94     (if (and for-effect (memq (car-safe form) '(and or)))
95         ;; Fix bug in and/or forms.
96         (let ((fn (car form))
97               (backwards (reverse (cdr form))))
98           (while (and backwards
99                       (null (setcar backwards
100                                     (byte-optimize-form (car backwards) t))))
101             (setq backwards (cdr backwards)))
102           (if (and (cdr form) (null backwards))
103               (byte-compile-log
104                "  all subforms of %s called for effect; deleted" form))
105           (if backwards
106               (let ((head backwards))
107                 (while (setq backwards (cdr backwards))
108                   (setcar backwards (byte-optimize-form (car backwards)
109                                                         nil)))
110                 (cons fn (nreverse head)))))
111       (si:byte-optimize-form-code-walker form for-effect)))
112   (byte-compile 'byte-optimize-form-code-walker))
113
114 (condition-case nil
115     (char-after)
116   (wrong-number-of-arguments
117    ;; Optimize byte code for `char-after'.
118    (put 'char-after 'byte-optimizer 'byte-optimize-char-after)
119    (defun byte-optimize-char-after (form)
120      (if (null (cdr form))
121          '(char-after (point))
122        form))))
123
124 (condition-case nil
125     (char-before)
126   (wrong-number-of-arguments
127    ;; Optimize byte code for `char-before'.
128    (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
129    (defun byte-optimize-char-before (form)
130      (if (null (cdr form))
131          '(char-before (point))
132        form))))
133
134 (load (expand-file-name "dgnuspath.el" srcdir) nil nil t)
135
136 (condition-case err
137     (load "~/.lpath.el" t nil t)
138   (error (message "Error in \"~/.lpath.el\" file: %s" err)))
139
140 ;; Don't load path-util until `char-after' and `char-before' have been
141 ;; optimized because it requires `poe' and then modify the functions.
142 (or (featurep 'path-util)
143     (load "apel/path-util"))
144 (add-path "apel")
145 (add-path "flim")
146 (unless (module-installed-p 'mel)
147   ;; FLIM 1.14 may have installed in two "flim" subdirectories.
148   (push (expand-file-name "flim"
149                           (file-name-directory (get-latest-path "^apel$" t)))
150         load-path)
151   (unless (module-installed-p 'mel)
152     (error "
153 FLIM package does not found in %s.
154 Try to re-configure with --with-addpath=FLIM_PATH and run make again.
155 "
156            (progn
157              (add-path "semi")
158              load-path))))
159 (add-path "semi")
160
161 (push srcdir load-path)
162 (load (expand-file-name "lpath.el" srcdir) nil t t)
163
164 (load (expand-file-name "gnus-clfns.el" srcdir) nil t t)
165
166 (require 'custom)
167
168 ;; Bind functions defined by `defun-maybe'.
169 (put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
170 (defun byte-compile-file-form-defun-maybe (form)
171   (if (and (not (fboundp (nth 1 form)))
172            (memq 'unresolved byte-compile-warnings))
173       (setq byte-compile-function-environment
174             (cons (cons (nth 1 form)
175                         (cons 'lambda (cdr (cdr form))))
176                   byte-compile-function-environment)))
177   form)
178
179 (condition-case nil
180     :symbol-for-testing-whether-colon-keyword-is-available-or-not
181   (void-variable
182    ;; Bind keywords.
183    (dolist (keyword '(:button-keymap :data :file :mime-handle
184                                      :key-type :value-type
185                                      :ascent :foreground :help))
186      (set keyword keyword))))
187
188 ;; If you are using Mule 2.3 based on Emacs 19.34, you may also put the
189 ;; following lines in your .emacs file, before gnus related modules are
190 ;; loaded.  It is not always necessary.  However if it is done, you will
191 ;; be able to load or evaluate gnus related *.el (not compiled) files.
192 ;; ------ cut here ------ cut here ------ cut here ------ cut here ------
193 (if (boundp 'MULE)
194     (progn
195       (setq :version ':version
196             :set-after ':set-after)
197       (require 'custom)
198       (defadvice custom-handle-keyword
199         (around dont-signal-an-error-even-if-unsupported-keyword-is-given
200                 activate)
201         "Don't signal an error even if unsupported keyword is given."
202         (if (not (memq (ad-get-arg 1) '(:version :set-after)))
203             ad-do-it))))
204 ;; ------ cut here ------ cut here ------ cut here ------ cut here ------
205
206 (when (boundp 'MULE)
207   (put 'custom-declare-face 'byte-optimizer
208        'byte-optimize-ignore-unsupported-custom-keywords)
209   (put 'custom-declare-group 'byte-optimizer
210        'byte-optimize-ignore-unsupported-custom-keywords)
211   (defun byte-optimize-ignore-unsupported-custom-keywords (form)
212     (if (or (memq ':version (nthcdr 4 form))
213             (memq ':set-after (nthcdr 4 form)))
214         (let ((newform (list (car form) (nth 1 form)
215                              (nth 2 form) (nth 3 form)))
216               (args (nthcdr 4 form)))
217           (while args
218             (or (memq (car args) '(:version :set-after))
219                 (setq newform (nconc newform (list (car args)
220                                                    (car (cdr args))))))
221             (setq args (cdr (cdr args))))
222           newform)
223       form))
224
225   (put 'custom-declare-variable 'byte-hunk-handler
226        'byte-compile-file-form-custom-declare-variable)
227   (defun byte-compile-file-form-custom-declare-variable (form)
228     ;; Bind defcustom'ed variables.
229     (if (memq 'free-vars byte-compile-warnings)
230         (setq byte-compile-bound-variables
231               (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
232     (if (memq ':version (nthcdr 4 form))
233         ;; Make the variable uncustomizable.
234         `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form))
235            ,(substring (nth 3 form) (if (string-match "^[\t *]+" (nth 3 form))
236                                         (match-end 0)
237                                       0)))
238       ;; Ignore unsupported keyword(s).
239       (if (memq ':set-after (nthcdr 4 form))
240           (let ((newform (list (car form) (nth 1 form)
241                                (nth 2 form) (nth 3 form)))
242                 (args (nthcdr 4 form)))
243             (while args
244               (or (eq (car args) ':set-after)
245                   (setq newform (nconc newform (list (car args)
246                                                      (car (cdr args))))))
247               (setq args (cdr (cdr args))))
248             newform)
249         form))))
250
251 ;; Unknown variables and functions.
252 (unless (boundp 'buffer-file-coding-system)
253   (defvar buffer-file-coding-system (symbol-value 'file-coding-system)))
254 (unless (featurep 'xemacs)
255   (defalias 'Custom-make-dependencies 'ignore)
256   (defalias 'update-autoloads-from-directory 'ignore))
257
258 (defalias 'device-sound-enabled-p 'ignore)
259 (defalias 'play-sound-file 'ignore)
260 (defalias 'nndb-request-article 'ignore)
261 (defalias 'efs-re-read-dir 'ignore)
262 (defalias 'ange-ftp-re-read-dir 'ignore)
263 (defalias 'define-mail-user-agent 'ignore)
264
265 (defconst dgnushack-unexporting-files
266   (append '("dgnushack.el" "dgnuspath.el" "lpath.el")
267           (unless (or (condition-case code
268                           (require 'w3-forms)
269                         (error
270                          (message "No w3: %s %s retrying..." code
271                                   (locate-library "w3-forms"))
272                          nil))
273                       ;; Maybe mis-configured Makefile is used (e.g.
274                       ;; configured for FSFmacs but XEmacs is running).
275                       (let ((lp (delete dgnushack-w3-directory
276                                         (copy-sequence load-path))))
277                         (if (let ((load-path lp))
278                               (condition-case nil
279                                   (require 'w3-forms)
280                                 (error nil)))
281                             ;; If success, fix `load-path' for compiling.
282                             (progn
283                               (setq load-path lp)
284                               (message " => fixed; W3DIR=%s"
285                                        (file-name-directory
286                                         (locate-library "w3-forms")))
287                               t)
288                           (message " => ignored")
289                           nil)))
290             '("nnweb.el" "nnlistserv.el" "nnultimate.el"
291               "nnslashdot.el" "nnwarchive.el" "webmail.el"
292               "nnwfm.el" "nnrss.el"))
293           (condition-case nil
294               (progn (require 'bbdb) nil)
295             (error '("gnus-bbdb.el")))
296           (unless (featurep 'xemacs)
297             '("gnus-xmas.el" "gnus-picon.el" "messagexmas.el"
298               "nnheaderxm.el" "smiley.el"))
299           (when (or (featurep 'xemacs) (<= emacs-major-version 20))
300             '("smiley-ems.el"))
301           (when (and (fboundp 'base64-decode-string)
302                      (subrp (symbol-function 'base64-decode-string)))
303             '("base64.el"))
304           (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
305             '("md5.el")))
306   "Files which will not be installed.")
307
308 (defconst dgnushack-exporting-files
309   (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
310     (dolist (file dgnushack-unexporting-files)
311       (setq files (delete file files)))
312     (sort files 'string-lessp))
313   "Files which will be compiled and installed.")
314
315 (defun dgnushack-exporting-files ()
316   "Print name of files which will be installed."
317   (princ (mapconcat 'identity dgnushack-exporting-files " ")))
318
319 (defun dgnushack-compile (&optional warn)
320   ;;(setq byte-compile-dynamic t)
321   (unless warn
322     (setq byte-compile-warnings
323           '(free-vars unresolved callargs redefine)))
324   (unless (locate-library "cus-edit")
325     (error "You do not seem to have Custom installed.
326 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
327 You also then need to add the following to the lisp/dgnushack.el file:
328
329      (push \"~/lisp/custom\" load-path)
330
331 Modify to suit your needs."))
332
333   ;; Show `load-path'.
334   (message "load-path=(\"%s\")"
335            (mapconcat 'identity load-path "\"\n           \""))
336
337   (dolist (file dgnushack-exporting-files)
338     (setq file (expand-file-name file srcdir))
339     (when (and (file-exists-p
340                 (setq elc (concat (file-name-nondirectory file) "c")))
341                (file-newer-than-file-p file elc))
342       (delete-file elc)))
343
344   (let ((files dgnushack-exporting-files)
345         ;;(byte-compile-generate-call-tree t)
346         file elc)
347     ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
348     ;; installed.
349     (when (featurep 'xemacs)
350       (setq gnus-xmas-glyph-directory "dummy"))
351     (while (setq file (pop files))
352       (setq file (expand-file-name file srcdir))
353       (when (or (not (file-exists-p
354                       (setq elc (concat (file-name-nondirectory file) "c"))))
355                 (file-newer-than-file-p file elc))
356         (ignore-errors
357           (byte-compile-file file))))))
358
359 (defun dgnushack-recompile ()
360   (require 'gnus)
361   (byte-recompile-directory "." 0))
362
363 (defvar dgnushack-gnus-load-file (expand-file-name "gnus-load.el" srcdir))
364 (defvar dgnushack-cus-load-file (expand-file-name "cus-load.el" srcdir))
365 (defvar dgnushack-auto-load-file (expand-file-name "auto-autoloads.el" srcdir))
366
367 (defun dgnushack-make-cus-load ()
368   (when (condition-case nil
369             (load "cus-dep")
370           (error nil))
371     (let ((cusload-base-file dgnushack-cus-load-file))
372       (if (fboundp 'custom-make-dependencies)
373           (custom-make-dependencies)
374         (Custom-make-dependencies)))))
375
376 (defun dgnushack-make-auto-load ()
377   (require 'autoload)
378   (let ((generated-autoload-file dgnushack-gnus-load-file)
379         (make-backup-files nil)
380         (autoload-package-name "gnus"))
381     (if (featurep 'xemacs)
382         (progn
383           (if (file-exists-p generated-autoload-file)
384               (delete-file generated-autoload-file))
385           (if (file-exists-p dgnushack-auto-load-file)
386               (delete-file dgnushack-auto-load-file)))
387       (with-temp-file generated-autoload-file
388         (insert ?\014)))
389     (if (featurep 'xemacs)
390         (let ((si:message (symbol-function 'message)))
391           (defun message (fmt &rest args)
392             (cond ((and (string-equal "Generating autoloads for %s..." fmt)
393                         (file-exists-p (file-name-nondirectory (car args))))
394                    (funcall si:message
395                             fmt (file-name-nondirectory (car args))))
396                   ((string-equal "No autoloads found in %s" fmt))
397                   ((string-equal "Generating autoloads for %s...done" fmt))
398                   (t (apply si:message fmt args))))
399           (unwind-protect
400               (batch-update-autoloads)
401             (fset 'message si:message)))
402       (batch-update-autoloads))))
403
404 (defun dgnushack-make-load ()
405   (message (format "Generating %s..." dgnushack-gnus-load-file))
406   (with-temp-file dgnushack-gnus-load-file
407     (if (file-exists-p dgnushack-cus-load-file)
408         (progn
409           (insert-file-contents dgnushack-cus-load-file)
410           (delete-file dgnushack-cus-load-file)
411           (goto-char (point-min))
412           (search-forward ";;; Code:")
413           (forward-line)
414           (delete-region (point-min) (point))
415           (unless (re-search-forward "\
416 ^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]"
417                                      nil t)
418             (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))
419           (goto-char (point-min))
420           (insert "\
421 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
422 ;;
423 ;;; Code:
424 ")
425           (goto-char (point-max))
426           (if (search-backward "custom-versions-load-alist" nil t)
427               (forward-line -1)
428             (forward-line -1)
429             (while (eq (char-after) ?\;)
430               (forward-line -1))
431             (forward-line))
432           (delete-region (point) (point-max))
433           (insert "\n"))
434       (insert "\
435 ;;; gnus-load.el --- automatically extracted autoload
436 ;;
437 ;;; Code:
438 "))
439     ;; smiley-* are duplicated. Remove them all.
440     (let ((point (point)))
441       (insert-file-contents dgnushack-gnus-load-file)
442       (goto-char point)
443       (while (search-forward "smiley-" nil t)
444         (beginning-of-line)
445         (if (looking-at "(autoload ")
446             (delete-region (point) (progn (forward-sexp) (point)))
447           (forward-line))))
448     ;;
449     (goto-char (point-max))
450     (when (search-backward "\n(provide " nil t)
451       (forward-line -1)
452       (delete-region (point) (point-max)))
453     (insert "\
454
455 \(provide 'gnus-load)
456
457 ;;; Local Variables:
458 ;;; version-control: never
459 ;;; no-byte-compile: t
460 ;;; no-update-autoloads: t
461 ;;; End:
462 ;;; gnus-load.el ends here\n"))
463   (message (format "Compiling %s..." dgnushack-gnus-load-file))
464   (byte-compile-file dgnushack-gnus-load-file))
465
466 \f
467 (defun dgnushack-compose-package ()
468   "Re-split the file gnus-load.el into custom-load.el and
469 auto-autoloads.el.  It is silly, should be improved!"
470   (message "
471 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
472   (let ((customload (expand-file-name "custom-load.el" srcdir))
473         (autoloads (expand-file-name "auto-autoloads.el" srcdir))
474         start)
475     (with-temp-buffer
476       (insert-file-contents dgnushack-gnus-load-file)
477       (delete-file dgnushack-gnus-load-file)
478       (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
479         (delete-file (concat dgnushack-gnus-load-file "c")))
480       (while (prog1
481                  (looking-at "[\t ;]")
482                (forward-line 1)))
483       (setq start (point))
484       (insert "\
485 ;;; custom-load.el --- automatically extracted custom dependencies\n
486 ;;; Code:\n\n")
487       (goto-char (point-max))
488       (while (progn
489                (forward-line -1)
490                (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
491       (forward-list 1)
492       (forward-line 1)
493       (insert "\n;;; custom-load.el ends here\n")
494       (write-region start (point) customload)
495       (while (looking-at "[\t ]*$")
496         (forward-line 1))
497       (setq start (point))
498       (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
499           (let ((from (goto-char (match-beginning 0))))
500             (delete-region from (progn
501                                   (forward-list 1)
502                                   (forward-line 1)
503                                   (point))))
504         (while (looking-at "[\t ;]")
505           (forward-line 1)))
506       (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
507       (goto-char (point-max))
508       (while (progn
509                (forward-line -1)
510                (not (looking-at "[\t ]*(provide[\t\n ]"))))
511       (insert "(provide 'gnus-autoloads)\n")
512       (write-region start (point) autoloads))
513     (byte-compile-file customload)
514     (byte-compile-file autoloads))
515   (message "\
516 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done
517 \n"))
518
519 \f
520 (defconst dgnushack-info-file-regexp-en
521   (let ((names '("gnus" "message" "emacs-mime"))
522         regexp name)
523     (while (setq name (pop names))
524       (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
525                            (when names "\\|"))))
526     regexp)
527   "Regexp matching English info files.")
528
529 (defconst dgnushack-info-file-regexp-ja
530   (let ((names '("gnus-ja" "message-ja"))
531         regexp name)
532     (while (setq name (pop names))
533       (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
534                            (when names "\\|"))))
535     regexp)
536   "Regexp matching Japanese info files.")
537
538 (defun dgnushack-remove-extra-files-in-package ()
539   "Remove extra files in the lisp directory of the XEmacs package."
540   (let ((lisp-dir (expand-file-name (concat "lisp/"
541                                             ;; GNUS_PRODUCT_NAME
542                                             (cadr command-line-args-left)
543                                             "/")
544                                     ;; PACKAGEDIR
545                                     (car command-line-args-left))))
546     (when (file-directory-p lisp-dir)
547       (let (files)
548         (dolist (file dgnushack-exporting-files)
549           (setq files (nconc files (list file (concat file "c")))))
550         (dolist (file (directory-files lisp-dir nil nil t t))
551           (unless (member file files)
552             (setq file (expand-file-name file lisp-dir))
553             (message "Removing %s..." file)
554             (condition-case nil
555                 (delete-file file)
556               (error nil))))))))
557
558 (defun dgnushack-install-package-manifest ()
559   "Install MANIFEST file as an XEmacs package."
560   (let* ((package-dir (car command-line-args-left))
561          (product-name (cadr command-line-args-left))
562          (name (expand-file-name (concat "pkginfo/MANIFEST." product-name)
563                                  package-dir))
564          make-backup-files)
565     (message "Generating %s..." name)
566     (with-temp-file name
567       (insert "pkginfo/MANIFEST." product-name "\n")
568       (let ((lisp-dir (concat "lisp/" product-name "/"))
569             (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
570             file)
571         (while (setq file (pop files))
572           (unless (member file dgnushack-unexporting-files)
573             (insert lisp-dir file "\n")))
574         (setq files
575               (sort (directory-files "../texi/" nil
576                                      (concat dgnushack-info-file-regexp-en
577                                              "\\|"
578                                              dgnushack-info-file-regexp-ja)
579                                      t)
580                     'string-lessp))
581         (while (setq file (pop files))
582           (insert "info/" file "\n"))))))
583
584 \f
585 (define-compiler-macro describe-key-briefly (&whole form key &optional insert)
586   (if (condition-case nil
587           (progn
588             (describe-key-briefly '((())) nil)
589             t)
590         (wrong-number-of-arguments nil);; Old Emacsen.
591         (error t))
592       form
593     (if insert
594         `(if ,insert
595              (insert (funcall 'describe-key-briefly ,key))
596            (funcall 'describe-key-briefly ,key))
597       `(funcall 'describe-key-briefly ,key))))
598
599 ;;; dgnushack.el ends here