(mime-spadework-module-version): New constant.
[elisp/flim.git] / mime-def.el
1 ;;; mime-def.el --- definition module for SEMI
2
3 ;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: definition, MIME, multimedia, mail, news
7
8 ;; This file is part of SEMI (Spadework for Emacs MIME Interfaces).
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; 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; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (defconst mime-spadework-module-version
28   '("FLIM" "Ky\e-Dòto"\e-A 1 0 1))
29
30
31 (require 'custom)
32
33 (defgroup mime nil
34   "Emacs MIME Interfaces"
35   :group 'news
36   :group 'mail)
37
38 (custom-handle-keyword 'default-mime-charset :group 'mime
39                        'custom-variable)
40
41 (unless (fboundp 'butlast)
42   (defun butlast (x &optional n)
43     "Returns a copy of LIST with the last N elements removed."
44     (if (and n (<= n 0)) x
45       (nbutlast (copy-sequence x) n)))
46   
47   (defun nbutlast (x &optional n)
48     "Modifies LIST to remove the last N elements."
49     (let ((m (length x)))
50       (or n (setq n 1))
51       (and (< n m)
52            (progn
53              (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil))
54              x))))
55   )
56
57 (defsubst eliminate-top-spaces (string)
58   "Eliminate top sequence of space or tab in STRING."
59   (if (string-match "^[ \t]+" string)
60       (substring string (match-end 0))
61     string))
62
63
64 ;;; @ definitions about MIME
65 ;;;
66
67 (defconst mime-tspecials "][()<>@,\;:\\\"/?=")
68 (defconst mime-token-regexp (concat "[^" mime-tspecials "\000-\040]+"))
69 (defconst mime-charset-regexp mime-token-regexp)
70
71 (defconst mime-media-type/subtype-regexp
72   (concat mime-token-regexp "/" mime-token-regexp))
73
74
75 ;;; @ end
76 ;;;
77
78 (provide 'mime-def)
79
80 ;;; mime-def.el ends here