0840225e8d8e685cf0452803d3ef57853c00dc9d
[elisp/gnus.git-] / lisp / mm-util.el
1 ;;; mm-util.el --- Utility functions for Mule and low level things
2 ;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;;      MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; This file is part of GNU Emacs.
7
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; any later version.
12
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ;; GNU General Public License for more details.
17
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (eval-when-compile (require 'cl))
28 (eval-when-compile (require 'gnus-clfns))
29 (eval-when-compile (require 'static))
30
31 (require 'mail-prsvr)
32
33 (defvar mm-mime-mule-charset-alist
34   `((us-ascii ascii)
35     (iso-8859-1 latin-iso8859-1)
36     (iso-8859-2 latin-iso8859-2)
37     (iso-8859-3 latin-iso8859-3)
38     (iso-8859-4 latin-iso8859-4)
39     (iso-8859-5 cyrillic-iso8859-5)
40     ;; Non-mule (X)Emacs uses the last mule-charset for 8bit characters.
41     ;; The fake mule-charset, gnus-koi8-r, tells Gnus that the default
42     ;; charset is koi8-r, not iso-8859-5.
43     (koi8-r cyrillic-iso8859-5 gnus-koi8-r)
44     (iso-8859-6 arabic-iso8859-6)
45     (iso-8859-7 greek-iso8859-7)
46     (iso-8859-8 hebrew-iso8859-8)
47     (iso-8859-9 latin-iso8859-9)
48     (iso-8859-14 latin-iso8859-14)
49     (iso-8859-15 latin-iso8859-15)
50     (viscii vietnamese-viscii-lower)
51     (iso-2022-jp latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978)
52     (euc-kr korean-ksc5601)
53     (gb2312 chinese-gb2312)
54     (big5 chinese-big5-1 chinese-big5-2)
55     (tibetan tibetan)
56     (thai-tis620 thai-tis620)
57     (iso-2022-7bit ethiopic arabic-1-column arabic-2-column)
58     (iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7
59                    latin-jisx0201 japanese-jisx0208-1978
60                    chinese-gb2312 japanese-jisx0208
61                    korean-ksc5601 japanese-jisx0212
62                    katakana-jisx0201)
63     (iso-2022-int-1 latin-iso8859-1 greek-iso8859-7
64                     latin-jisx0201 japanese-jisx0208-1978
65                     chinese-gb2312 japanese-jisx0208
66                     korean-ksc5601 japanese-jisx0212
67                     chinese-cns11643-1 chinese-cns11643-2)
68     (iso-2022-int-1 latin-iso8859-1 latin-iso8859-2
69                     cyrillic-iso8859-5 greek-iso8859-7
70                     latin-jisx0201 japanese-jisx0208-1978
71                     chinese-gb2312 japanese-jisx0208
72                     korean-ksc5601 japanese-jisx0212
73                     chinese-cns11643-1 chinese-cns11643-2
74                     chinese-cns11643-3 chinese-cns11643-4
75                     chinese-cns11643-5 chinese-cns11643-6
76                     chinese-cns11643-7)
77     ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case
78              (not (fboundp 'coding-system-p))
79              (charsetp 'unicode-a)
80              (not (coding-system-p 'mule-utf-8)))
81          '(utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e)
82        ;; If we have utf-8 we're in Mule 5+.
83        (append '(utf-8)
84                (delete 'ascii
85                        (coding-system-get 'mule-utf-8 'safe-charsets)))))
86   "Alist of MIME-charset/MULE-charsets.")
87
88 (eval-and-compile
89   (mapcar
90    (lambda (elem)
91      (let ((nfunc (intern (format "mm-%s" (car elem)))))
92        (if (fboundp (car elem))
93            (defalias nfunc (car elem))
94          (defalias nfunc (cdr elem)))))
95    '((decode-coding-string . (lambda (s a) s))
96      (encode-coding-string . (lambda (s a) s))
97      (encode-coding-region . ignore)
98      (coding-system-list . ignore)
99      (decode-coding-region . ignore)
100      (char-int . identity)
101      (device-type . ignore)
102      (coding-system-equal . equal)
103      (annotationp . ignore)
104      (set-buffer-file-coding-system . ignore)
105      (make-char
106       . (lambda (charset int)
107           (int-to-char int)))
108      (read-charset
109       . (lambda (prompt)
110           "Return a charset."
111           (intern
112            (completing-read
113             prompt
114             (mapcar (lambda (e) (list (symbol-name (car e))))
115                     mm-mime-mule-charset-alist)
116             nil t))))
117      (subst-char-in-string
118       . (lambda (from to string) ;; stolen (and renamed) from nnheader.el
119           "Replace characters in STRING from FROM to TO."
120           (let ((string (substring string 0))   ;Copy string.
121                 (len (length string))
122                 (idx 0))
123             ;; Replace all occurrences of FROM with TO.
124             (while (< idx len)
125               (when (= (aref string idx) from)
126                 (aset string idx to))
127               (setq idx (1+ idx)))
128             string)))
129      (string-as-unibyte . identity)
130      (string-as-multibyte . identity)
131      (multibyte-string-p . ignore))))
132
133 (eval-and-compile
134   (defalias 'mm-char-or-char-int-p
135     (cond
136      ((fboundp 'char-or-char-int-p) 'char-or-char-int-p)
137      ((fboundp 'char-valid-p) 'char-valid-p)
138      (t 'identity))))
139
140 (eval-and-compile
141   (defalias 'mm-read-coding-system
142     (cond
143      ((fboundp 'read-coding-system)
144       (if (and (featurep 'xemacs)
145                (<= (string-to-number emacs-version) 21.1))
146           (lambda (prompt &optional default-coding-system)
147             (read-coding-system prompt))
148         'read-coding-system))
149      (t (lambda (prompt &optional default-coding-system)
150           "Prompt the user for a coding system."
151           (completing-read
152            prompt (mapcar (lambda (s) (list (symbol-name (car s))))
153                           mm-mime-mule-charset-alist)))))))
154
155 (defvar mm-coding-system-list nil)
156 (defun mm-get-coding-system-list ()
157   "Get the coding system list."
158   (or mm-coding-system-list
159       (setq mm-coding-system-list (mm-coding-system-list))))
160
161 (defun mm-coding-system-p (sym)
162   "Return non-nil if SYM is a coding system."
163   (or (and (fboundp 'coding-system-p) (coding-system-p sym))
164       (memq sym (mm-get-coding-system-list))))
165
166 (defvar mm-charset-synonym-alist
167   `((big5 . cn-big5)
168     (gb2312 . cn-gb-2312)
169     (cn-gb . cn-gb-2312)
170     ;; Windows-1252 is actually a superset of Latin-1.  See also
171     ;; `gnus-article-dumbquotes-map'.
172     ,(unless (mm-coding-system-p 'windows-1252) ; should be defined eventually
173        '(windows-1252 . iso-8859-1))
174     ;; Windows-1250 is a variant of Latin-2 heavily used by Microsoft
175     ;; Outlook users in Czech republic. Use this to allow reading of their
176     ;; e-mails. cp1250 should be defined by M-x codepage-setup.
177     ,(unless (mm-coding-system-p 'windows-1250) ; should be defined eventually
178        '(windows-1250 . cp1250))
179     (x-ctext . ctext))
180   "A mapping from invalid charset names to the real charset names.")
181
182 (defvar mm-binary-coding-system
183   (cond
184    ((mm-coding-system-p 'binary) 'binary)
185    ((mm-coding-system-p 'no-conversion) 'no-conversion)
186    (t nil))
187   "100% binary coding system.")
188
189 (defvar mm-text-coding-system
190   (or (if (memq system-type '(windows-nt ms-dos ms-windows))
191           (and (mm-coding-system-p 'raw-text-dos) 'raw-text-dos)
192         (and (mm-coding-system-p 'raw-text) 'raw-text))
193       mm-binary-coding-system)
194   "Text-safe coding system (For removing ^M).")
195
196 (defvar mm-text-coding-system-for-write nil
197   "Text coding system for write.")
198
199 (defvar mm-auto-save-coding-system
200   (cond
201    ((mm-coding-system-p 'emacs-mule)
202     (if (memq system-type '(windows-nt ms-dos ms-windows))
203         (if (mm-coding-system-p 'emacs-mule-dos)
204             'emacs-mule-dos mm-binary-coding-system)
205       'emacs-mule))
206    ((mm-coding-system-p 'escape-quoted) 'escape-quoted)
207    (t mm-binary-coding-system))
208   "Coding system of auto save file.")
209
210 (defvar mm-universal-coding-system mm-auto-save-coding-system
211   "The universal Coding system.")
212
213 ;;; Internal variables:
214
215 ;;; Functions:
216
217 (defun mm-mule-charset-to-mime-charset (charset)
218   "Return the MIME charset corresponding to the given Mule CHARSET."
219   (let ((alist mm-mime-mule-charset-alist)
220         out)
221     (while alist
222       (when (memq charset (cdar alist))
223         (setq out (caar alist)
224               alist nil))
225       (pop alist))
226     out))
227
228 (defun mm-charset-to-coding-system (charset &optional lbt)
229   "Return coding-system corresponding to CHARSET.
230 CHARSET is a symbol naming a MIME charset.
231 If optional argument LBT (`unix', `dos' or `mac') is specified, it is
232 used as the line break code type of the coding system."
233   (when (stringp charset)
234     (setq charset (intern (downcase charset))))
235   (setq charset
236         (or (cdr (assq charset mm-charset-synonym-alist))
237             charset))
238   (when lbt
239     (setq charset (intern (format "%s-%s" charset lbt))))
240   (cond
241    ;; Running in a non-MULE environment.
242    ((null (mm-get-coding-system-list))
243     charset)
244    ;; ascii
245    ((eq charset 'us-ascii)
246     'ascii)
247    ;; Check to see whether we can handle this charset.  (This depends
248    ;; on there being some coding system matching each `mime-charset'
249    ;; coding sysytem property defined, as there should be.)
250    ((memq charset (mm-get-coding-system-list))
251     charset)
252    ;; Nope.
253    (t
254     nil)))
255
256 (defsubst mm-replace-chars-in-string (string from to)
257   (mm-subst-char-in-string from to string))
258
259 (defsubst mm-enable-multibyte ()
260   "Set the multibyte flag of the current buffer.
261 Only do this if the default value of `enable-multibyte-characters' is
262 non-nil.  This is a no-op in XEmacs."
263   (when (and (not (featurep 'xemacs))
264              (boundp 'default-enable-multibyte-characters)
265              default-enable-multibyte-characters
266              (fboundp 'set-buffer-multibyte))
267     (set-buffer-multibyte t)))
268
269 (defsubst mm-disable-multibyte ()
270   "Unset the multibyte flag of in the current buffer.
271 This is a no-op in XEmacs."
272   (when (and (not (featurep 'xemacs))
273              (fboundp 'set-buffer-multibyte))
274     (set-buffer-multibyte nil)))
275
276 (defsubst mm-enable-multibyte-mule4 ()
277   "Enable multibyte in the current buffer.
278 Only used in Emacs Mule 4."
279   (when (and (not (featurep 'xemacs))
280              (boundp 'default-enable-multibyte-characters)
281              default-enable-multibyte-characters
282              (fboundp 'set-buffer-multibyte)
283              (fboundp 'charsetp)
284              (not (charsetp 'eight-bit-control)))
285     (set-buffer-multibyte t)))
286
287 (defsubst mm-disable-multibyte-mule4 ()
288   "Disable multibyte in the current buffer.
289 Only used in Emacs Mule 4."
290   (when (and (not (featurep 'xemacs))
291              (fboundp 'set-buffer-multibyte)
292              (fboundp 'charsetp)
293              (not (charsetp 'eight-bit-control)))
294     (set-buffer-multibyte nil)))
295
296 (defun mm-preferred-coding-system (charset)
297   ;; A typo in some Emacs versions.
298   (or (get-charset-property charset 'prefered-coding-system)
299       (get-charset-property charset 'preferred-coding-system)))
300
301 (defun mm-charset-after (&optional pos)
302   "Return charset of a character in current buffer at position POS.
303 If POS is nil, it defauls to the current point.
304 If POS is out of range, the value is nil.
305 If the charset is `composition', return the actual one."
306   (let ((char (char-after pos)) charset)
307     (if (< (mm-char-int char) 128)
308         (setq charset 'ascii)
309       ;; charset-after is fake in some Emacsen.
310       (setq charset (and (fboundp 'char-charset) (char-charset char)))
311       (if (eq charset 'composition)
312           (let ((p (or pos (point))))
313             (cadr (find-charset-region p (1+ p))))
314         (if (and charset (not (memq charset '(ascii eight-bit-control
315                                                     eight-bit-graphic))))
316             charset
317           (or
318            mail-parse-mule-charset ;; cached mule-charset
319            (progn
320              (setq mail-parse-mule-charset
321                    (and (boundp 'current-language-environment)
322                         (car (last
323                               (assq 'charset
324                                     (assoc current-language-environment
325                                            language-info-alist))))))
326              (if (or (not mail-parse-mule-charset)
327                      (eq mail-parse-mule-charset 'ascii))
328                  (setq mail-parse-mule-charset
329                        (or (car (last (assq mail-parse-charset
330                                             mm-mime-mule-charset-alist)))
331                            ;; Fixme: don't fix that!
332                            'latin-iso8859-1)))
333              mail-parse-mule-charset)))))))
334
335 (defun mm-mime-charset (charset)
336   "Return the MIME charset corresponding to the MULE CHARSET."
337   (if (eq charset 'unknown)
338       (error "The message contains non-printable characters, please use attachment"))
339   (if (and (fboundp 'coding-system-get) (fboundp 'get-charset-property))
340       ;; This exists in Emacs 20.
341       (or
342        (and (mm-preferred-coding-system charset)
343             (coding-system-get
344              (mm-preferred-coding-system charset) 'mime-charset))
345        (and (eq charset 'ascii)
346             'us-ascii)
347        (mm-preferred-coding-system charset)
348        (mm-mule-charset-to-mime-charset charset))
349     ;; This is for XEmacs.
350     (mm-mule-charset-to-mime-charset charset)))
351
352 (defun mm-delete-duplicates (list)
353   "Simple  substitute for CL `delete-duplicates', testing with `equal'."
354   (let (result head)
355     (while list
356       (setq head (car list))
357       (setq list (delete head list))
358       (setq result (cons head result)))
359     (nreverse result)))
360
361 (defun mm-find-mime-charset-region (b e)
362   "Return the MIME charsets needed to encode the region between B and E."
363   (let ((charsets (mapcar 'mm-mime-charset
364                           (delq 'ascii
365                                 (mm-find-charset-region b e)))))
366     (when (memq 'iso-2022-jp-2 charsets)
367       (setq charsets (delq 'iso-2022-jp charsets)))
368     (setq charsets (mm-delete-duplicates charsets))
369     (if (and (> (length charsets) 1)
370              (fboundp 'find-coding-systems-region)
371              (let ((cs (find-coding-systems-region b e)))
372                (or (memq 'utf-8 cs) (memq 'mule-utf-8 cs))))
373         '(utf-8)
374       charsets)))
375
376 (defsubst mm-multibyte-p ()
377   "Say whether multibyte is enabled."
378   (if (and (not (featurep 'xemacs))
379            (boundp 'enable-multibyte-characters))
380       enable-multibyte-characters
381     (featurep 'mule)))
382
383 (defmacro mm-with-unibyte-buffer (&rest forms)
384   "Create a temporary buffer, and evaluate FORMS there like `progn'.
385 Use unibyte mode for this."
386   `(let (default-enable-multibyte-characters)
387      (with-temp-buffer ,@forms)))
388 (put 'mm-with-unibyte-buffer 'lisp-indent-function 0)
389 (put 'mm-with-unibyte-buffer 'edebug-form-spec '(body))
390
391 (defmacro mm-with-unibyte-current-buffer (&rest forms)
392   "Evaluate FORMS with current current buffer temporarily made unibyte.
393 Also bind `default-enable-multibyte-characters' to nil.
394 Equivalent to `progn' in XEmacs"
395   (let ((buffer (make-symbol "buffer")))
396     `(if (and (not (featurep 'xemacs))
397               (boundp 'enable-multibyte-characters)
398               enable-multibyte-characters
399               (fboundp 'set-buffer-multibyte))
400          (let ((,buffer (current-buffer)))
401            (unwind-protect
402                (let (default-enable-multibyte-characters)
403                  (set-buffer-multibyte nil)
404                  ,@forms)
405              (set-buffer ,buffer)
406              (set-buffer-multibyte t)))
407        (let (default-enable-multibyte-characters)
408          ,@forms))))
409 (put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
410 (put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
411
412 (defmacro mm-with-unibyte-current-buffer-mule4 (&rest forms)
413   "Evaluate FORMS there like `progn' in current buffer.
414 Mule4 only."
415   (let ((buffer (make-symbol "buffer")))
416     `(if (and (not (featurep 'xemacs))
417               (boundp 'enable-multibyte-characters)
418               enable-multibyte-characters
419               (fboundp 'set-buffer-multibyte)
420               (fboundp 'charsetp)
421               (not (charsetp 'eight-bit-control))) ;; For Emacs Mule 4 only.
422          (let ((,buffer (current-buffer)))
423            (unwind-protect
424                (let (default-enable-multibyte-characters)
425                  (set-buffer-multibyte nil)
426                  ,@forms)
427              (set-buffer ,buffer)
428              (set-buffer-multibyte t)))
429        (let (default-enable-multibyte-characters)
430          ,@forms))))
431 (put 'mm-with-unibyte-current-buffer-mule4 'lisp-indent-function 0)
432 (put 'mm-with-unibyte-current-buffer-mule4 'edebug-form-spec '(body))
433
434 (defmacro mm-with-unibyte (&rest forms)
435   "Eval the FORMS with the default value of `enable-multibyte-characters' nil, ."
436   `(let (default-enable-multibyte-characters)
437      ,@forms))
438 (put 'mm-with-unibyte 'lisp-indent-function 0)
439 (put 'mm-with-unibyte 'edebug-form-spec '(body))
440
441 (defun mm-find-charset-region (b e)
442   "Return a list of Emacs charsets in the region B to E."
443   (cond
444    ((and (mm-multibyte-p)
445          (fboundp 'find-charset-region))
446     ;; Remove composition since the base charsets have been included.
447     ;; Remove eight-bit-*, treat them as ascii.
448     (let ((css (find-charset-region b e)))
449       (mapcar (lambda (cs) (setq css (delq cs css)))
450               '(composition eight-bit-control eight-bit-graphic
451                             control-1))
452       css))
453    (t
454     ;; We are in a unibyte buffer or XEmacs non-mule, so we futz around a bit.
455     (save-excursion
456       (save-restriction
457         (narrow-to-region b e)
458         (goto-char (point-min))
459         (skip-chars-forward "\0-\177")
460         (if (eobp)
461             '(ascii)
462           (let (charset)
463             (setq charset
464                   (and (boundp 'current-language-environment)
465                        (car (last (assq 'charset
466                                         (assoc current-language-environment
467                                                language-info-alist))))))
468             (if (eq charset 'ascii) (setq charset nil))
469             (or charset
470                 (setq charset
471                       (car (last (assq mail-parse-charset
472                                        mm-mime-mule-charset-alist)))))
473             (list 'ascii (or charset 'latin-iso8859-1)))))))))
474
475 (static-if (fboundp 'shell-quote-argument)
476     (defalias 'mm-quote-arg 'shell-quote-argument)
477   (defun mm-quote-arg (arg)
478     "Return a version of ARG that is safe to evaluate in a shell."
479     (let ((pos 0) new-pos accum)
480       ;; *** bug: we don't handle newline characters properly
481       (while (setq new-pos (string-match "[]*[;!'`\"$\\& \t{} |()<>]" arg pos))
482         (push (substring arg pos new-pos) accum)
483         (push "\\" accum)
484         (push (list (aref arg new-pos)) accum)
485         (setq pos (1+ new-pos)))
486       (if (= pos 0)
487           arg
488         (apply 'concat (nconc (nreverse accum) (list (substring arg pos))))))))
489
490 (defun mm-auto-mode-alist ()
491   "Return an `auto-mode-alist' with only the .gz (etc) thingies."
492   (let ((alist auto-mode-alist)
493         out)
494     (while alist
495       (when (listp (cdar alist))
496         (push (car alist) out))
497       (pop alist))
498     (nreverse out)))
499
500 (defvar mm-inhibit-file-name-handlers
501   '(jka-compr-handler image-file-handler)
502   "A list of handlers doing (un)compression (etc) thingies.")
503
504 (defun mm-insert-file-contents (filename &optional visit beg end replace
505                                          inhibit)
506   "Like `insert-file-contents', q.v., but only reads in the file.
507 A buffer may be modified in several ways after reading into the buffer due
508 to advanced Emacs features, such as file-name-handlers, format decoding,
509 find-file-hooks, etc.
510 If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers.
511   This function ensures that none of these modifications will take place."
512   (let ((format-alist nil)
513         (auto-mode-alist (if inhibit nil (mm-auto-mode-alist)))
514         (default-major-mode 'fundamental-mode)
515         (enable-local-variables nil)
516         (after-insert-file-functions nil)
517         (enable-local-eval nil)
518         (find-file-hooks nil)
519         (inhibit-file-name-operation (if inhibit
520                                          'insert-file-contents
521                                        inhibit-file-name-operation))
522         (inhibit-file-name-handlers
523          (if inhibit
524              (append mm-inhibit-file-name-handlers
525                      inhibit-file-name-handlers)
526            inhibit-file-name-handlers)))
527     (insert-file-contents filename visit beg end replace)))
528
529 (defun mm-append-to-file (start end filename &optional codesys inhibit)
530   "Append the contents of the region to the end of file FILENAME.
531 When called from a function, expects three arguments,
532 START, END and FILENAME.  START and END are buffer positions
533 saying what text to write.
534 Optional fourth argument specifies the coding system to use when
535 encoding the file.
536 If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers."
537   (let ((coding-system-for-write
538          (or codesys mm-text-coding-system-for-write
539              mm-text-coding-system))
540         (inhibit-file-name-operation (if inhibit
541                                          'append-to-file
542                                        inhibit-file-name-operation))
543         (inhibit-file-name-handlers
544          (if inhibit
545              (append mm-inhibit-file-name-handlers
546                      inhibit-file-name-handlers)
547            inhibit-file-name-handlers)))
548     (append-to-file start end filename)))
549
550 (defun mm-write-region (start end filename &optional append visit lockname
551                               coding-system inhibit)
552
553   "Like `write-region'.
554 If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers."
555   (let ((coding-system-for-write
556          (or coding-system mm-text-coding-system-for-write
557              mm-text-coding-system))
558         (inhibit-file-name-operation (if inhibit
559                                          'write-region
560                                        inhibit-file-name-operation))
561         (inhibit-file-name-handlers
562          (if inhibit
563              (append mm-inhibit-file-name-handlers
564                      inhibit-file-name-handlers)
565            inhibit-file-name-handlers)))
566     (write-region start end filename append visit lockname)))
567
568 (defun mm-image-load-path (&optional package)
569   (let (dir result)
570     (dolist (path load-path (nreverse result))
571       (if (file-directory-p
572            (setq dir (concat (file-name-directory
573                               (directory-file-name path))
574                              "etc/" (or package "gnus/"))))
575           (push dir result))
576       (push path result))))
577
578 (provide 'mm-util)
579
580 ;;; mm-util.el ends here