This commit was generated by cvs2svn to compensate for changes in r493,
authormorioka <morioka>
Wed, 11 Mar 1998 12:32:21 +0000 (12:32 +0000)
committermorioka <morioka>
Wed, 11 Mar 1998 12:32:21 +0000 (12:32 +0000)
which included commits to RCS files with non-trunk default branches.

12 files changed:
APEL-CFG [new file with mode: 0644]
APEL-ELS [new file with mode: 0644]
APEL-MK [new file with mode: 0644]
EMU-CFG [new file with mode: 0644]
EMU-ELS [new file with mode: 0644]
EMU-MK [new file with mode: 0644]
README.en [new file with mode: 0644]
env.el [new file with mode: 0644]
ftp.in [new file with mode: 0644]
path-util.el [new file with mode: 0644]
std11-parse.el
std11.el

diff --git a/APEL-CFG b/APEL-CFG
new file mode 100644 (file)
index 0000000..dca4e05
--- /dev/null
+++ b/APEL-CFG
@@ -0,0 +1,45 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: APEL-CFG,v 0.3 1997-11-04 08:50:36 morioka Exp $
+;;;
+
+(defvar default-load-path load-path)
+(setq load-path (cons (expand-file-name ".") load-path))
+(require 'install)
+
+
+;;; @ Please specify prefix of install directory.
+;;;
+
+;; Please specify install path prefix.
+;; If it is omitted, shared directory (maybe /usr/local is used).
+(defvar PREFIX install-prefix)
+;;(setq PREFIX "~/")
+
+;; Please specify emu prefix [optional]
+(setq EMU_PREFIX
+      (if (string-match "XEmacs" emacs-version)
+         "emu"
+       ""))
+
+;; Please specify prefix for ``apel'' [optional]
+(setq APEL_PREFIX "apel")
+
+\f
+
+;;; @ optional settings
+;;;
+
+(setq EMU_DIR
+      (expand-file-name
+       EMU_PREFIX
+       (install-detect-elisp-directory PREFIX nil 'version-specific)))
+
+;; It is generated by automatically. Please set variable `PREFIX'.
+;; If you don't like default directory tree, please set it.
+(defvar LISPDIR (install-detect-elisp-directory PREFIX))
+;; (setq install-default-elisp-directory "~/lib/emacs/lisp")
+
+(setq APEL_DIR (expand-file-name APEL_PREFIX LISPDIR))
+
+;;; APEL-CFG ends here
diff --git a/APEL-ELS b/APEL-ELS
new file mode 100644 (file)
index 0000000..769b945
--- /dev/null
+++ b/APEL-ELS
@@ -0,0 +1,12 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: APEL-ELS,v 1.6 1997-11-06 15:47:18 morioka Exp $
+;;;
+
+(setq apel-modules '(alist atype
+                          path-util filename install
+                          std11 std11-parse
+                          mule-caesar
+                          file-detect))
+
+;;; APEL-ELS ends here
diff --git a/APEL-MK b/APEL-MK
new file mode 100644 (file)
index 0000000..5b662c0
--- /dev/null
+++ b/APEL-MK
@@ -0,0 +1,43 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: APEL-MK,v 0.5 1997-11-05 15:23:35 morioka Exp $
+;;;
+
+(defun config-apel ()
+  (let (prefix lisp-dir)
+    (and (setq prefix (car command-line-args-left))
+        (or (string-equal "NONE" prefix)
+            (defvar PREFIX prefix)
+            ))
+    (setq command-line-args-left (cdr command-line-args-left))
+    (and (setq lisp-dir (car command-line-args-left))
+        (or (string-equal "NONE" lisp-dir)
+            (defvar LISPDIR lisp-dir)
+            ))
+    (setq command-line-args-left (cdr command-line-args-left))
+    (load-file "APEL-CFG")
+    (or (boundp 'apel-modules)
+       (load-file "APEL-ELS")
+       )
+    (princ (format "PREFIX=%s\n" PREFIX))
+    ))
+
+(defun compile-apel ()
+  ;;(add-to-list 'load-path (expand-file-name "../emu"))
+  ;;(add-to-list 'load-path ".")
+  ;;(require 'install)
+  (config-apel)
+  (load "EMU-ELS")
+  (load-file "APEL-ELS")
+  (compile-elisp-modules emu-modules   ".")
+  (compile-elisp-modules apel-modules  ".")
+  )
+
+(defun install-apel ()
+  (compile-apel)
+  ;;(config-apel)
+  (install-elisp-modules emu-modules   "."     EMU_DIR)
+  (install-elisp-modules apel-modules  "."     APEL_DIR)
+  )
+
+;;; APEL-MK ends here
diff --git a/EMU-CFG b/EMU-CFG
new file mode 100644 (file)
index 0000000..4eeb9b5
--- /dev/null
+++ b/EMU-CFG
@@ -0,0 +1,42 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: EMU-CFG,v 0.0 1997-03-14 07:16:00 morioka Exp $
+;;;
+
+(setq load-path (append
+                (mapcar (function
+                         (lambda (path)
+                           (expand-file-name path default-directory)
+                           ))
+                        '("." "../apel" "../tl")
+                        )
+                load-path))
+
+(require 'install)
+
+
+;;; @ Please specify prefix of install directory.
+;;;
+
+;; Please specify install path prefix.
+;; If it is omitted, shared directory (maybe /usr/local is used).
+(defvar PREFIX install-prefix)
+;;(setq PREFIX "~/")
+
+;; Please specify emu prefix [optional]
+(setq EMU_PREFIX
+      (if (string-match "XEmacs" emacs-version)
+         "emu"
+       ""))
+
+\f
+
+;;; @ optional settings
+;;;
+
+(setq EMU_DIR
+      (expand-file-name
+       EMU_PREFIX
+       (install-detect-elisp-directory PREFIX nil 'version-specific)))
+
+;;; EMU-CFG ends here
diff --git a/EMU-ELS b/EMU-ELS
new file mode 100644 (file)
index 0000000..8ba4731
--- /dev/null
+++ b/EMU-ELS
@@ -0,0 +1,48 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: EMU-ELS,v 1.3 1997-08-30 05:30:43 morioka Exp $
+;;;
+
+(setq emu-modules
+      (cons
+       'emu
+       (if (or running-emacs-19_29-or-later
+              running-xemacs-19_14-or-later)
+          '(richtext)
+        '(tinyrich)
+        )))
+
+(setq emu-modules
+      (nconc
+       (cond (running-mule-merged-emacs
+             '(emu-e20 emu-20)
+             )
+            (running-xemacs-with-mule
+             '(emu-x20 emu-20)
+             )
+            ((boundp 'MULE)
+             '(emu-mule)
+             )
+            ((boundp 'NEMACS)
+             '(emu-nemacs)
+             )
+            (t
+             '(emu-e19)
+             ))
+       emu-modules))
+
+(setq emu-modules
+      (nconc
+       (cond (running-emacs-18
+             '(emu-18 env)
+             )
+            (running-xemacs
+             '(emu-xemacs)
+             )
+            (t
+             '(emu-19)
+             )
+            )
+       emu-modules))
+
+;;; EMU-ELS ends here
diff --git a/EMU-MK b/EMU-MK
new file mode 100644 (file)
index 0000000..378f30f
--- /dev/null
+++ b/EMU-MK
@@ -0,0 +1,30 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: EMU-MK,v 0.0 1997-03-14 07:17:53 morioka Exp $
+;;;
+
+(defun config-emu ()
+  (let (prefix)
+    (setq prefix (car command-line-args-left))
+    (and prefix
+        (not (string-equal "NONE" prefix))
+        (progn
+          (defvar PREFIX prefix)
+          (setq command-line-args-left (cdr command-line-args-left))
+          ))
+    (load-file "EMU-CFG")
+    (load-file "EMU-ELS")
+    (princ (format "PREFIX=%s\n" PREFIX))
+    ))
+
+(defun compile-emu ()
+  (config-emu)
+  (compile-elisp-modules emu-modules   ".")
+  )
+
+(defun install-emu ()
+  (config-emu)
+  (install-elisp-modules emu-modules   "./"    EMU_DIR)
+  )
+
+;;; EMU-MK ends here
diff --git a/README.en b/README.en
new file mode 100644 (file)
index 0000000..d56753a
--- /dev/null
+++ b/README.en
@@ -0,0 +1,244 @@
+[README for APEL (English Version)]
+by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+$Id: README.en,v 1.9 1998-03-08 22:42:42 shuhei-k Exp $
+
+What's APEL?
+============
+
+  APEL stands for "A Portable Emacs Library".  It consists of
+  following modules:
+
+       emu:    A package to fill incompatibilities of emacsen
+               emu.el --- main module
+           About mule API:
+               emu-nemacs.el --- for NEmacs
+               emu-e19.el    --- for Emacs 19 or XEmacs without mule
+               emu-mule.el   --- for MULE 2.3
+               emu-20.el     --- for Emacs 20 and XEmacs/mule
+               emu-e20.el    --- for Emacs 20 and MULE 3
+               emu-x20.el    --- for XEmacs/mule
+           About other API
+               emu-18.el     --- for Emacs 18
+               emu-19.el     --- for Emacs 19 or later
+               emu-xemacs.el --- for XEmacs
+               env.el        --- env.el for Emacs 18
+               richtext.el   --- text/richtext module
+                                   for Emacs 19.29 or later,
+                                       XEmacs 19.14 or later
+               tinyrich.el   --- text/richtext module for old emacsen
+
+       alist.el: utility for Association-list
+
+       atype.el: utility for atype
+
+       path-util.el: utility for path management or file detection
+
+       filename.el: utility to make file-name
+
+       install.el: utility to install emacs-lisp package
+
+       mule-caesar.el: ROT 13-47-48 Caesar rotation utility
+
+       std11: RFC 822/STD 11 parser and utility
+           std11.el       --- main module
+           std11-parse.el --- parser
+
+
+Installation
+============
+
+(a) run in expanded place
+
+  If you don't want to install other directories, please do only
+  following:
+
+       % make
+
+  You can specify the emacs command name, for example
+
+       % make install EMACS=xemacs
+
+  If `EMACS=...' is omitted, EMACS=emacs is used.
+
+(b) make install
+
+  If you want to install other directories, please do following:
+
+       % make install
+
+  You can specify the emacs command name, for example
+
+       % make install EMACS=xemacs
+
+  If `EMACS=...' is omitted, EMACS=emacs is used.
+
+  You can specify the prefix of the directory tree for Emacs Lisp
+  programs and shell scripts, for example:
+
+       % make install PREFIX=~/
+
+  If `PREFIX=...' is omitted, the prefix of the directory tree of the
+  specified emacs command is used (perhaps /usr/local).
+
+  For example, if PREFIX=/usr/local and Emacs 20.2 is specified, it
+  will create the following directory tree:
+
+       /usr/local/share/emacs/20.2/site-lisp/  --- emu
+       /usr/local/share/emacs/site-lisp/apel/  --- APEL
+
+  You can specify other optional settings by editing the file
+  APEL-CFG.  Please read comments in it.
+
+
+load-path (for Emacs or MULE)
+=============================
+
+  If you are using Emacs or Mule, please add directory of apel to
+  load-path.  If you install by default setting, you can write
+  subdirs.el for example:
+
+  --------------------------------------------------------------------
+  (normal-top-level-add-to-load-path '("apel"))
+  --------------------------------------------------------------------
+
+  If you are using XEmacs, there are no need of setting about
+  load-path.
+
+
+How to use
+==========
+
+alist
+-----
+
+Function put-alist (ITEM VALUE ALIST)
+
+  Modify ALIST to set VALUE to ITEM.  If there is a pair whose car is
+  ITEM, replace its cdr by VALUE.  If there is not such pair, create
+  new pair (ITEM . VALUE) and return new alist whose car is the new
+  pair and cdr is ALIST.
+
+Function del-alist (ITEM ALIST)
+
+  If there is a pair whose key is ITEM, delete it from ALIST.
+
+Function set-alist (SYMBOL ITEM VALUE)
+
+  Modify a alist indicated by SYMBOL to set VALUE to ITEM.
+
+  Ex. (set-alist 'auto-mode-alist "\\.pln$" 'text-mode)
+
+Function modify-alist (MODIFIER DEFAULT)
+
+  Modify alist DEFAULT into alist MODIFIER.
+
+Function set-modified-alist (SYMBOL MODIFIER)
+
+  Modify a value of a SYMBOL into alist MODIFIER.  The SYMBOL should
+  be alist. If it is not bound, its value regard as nil.
+
+path-util
+---------
+
+Function add-path (PATH &rest OPTIONS)
+
+  Add PATH to `load-path' if it exists under `default-load-path'
+  directories and it does not exist in `load-path'.
+
+  You can use following PATH styles:
+
+    load-path relative: "PATH" (it is searched from
+                               `defaul-load-path')
+
+    home directory relative: "~/PATH" "~USER/PATH"
+
+    absolute path: "/FOO/BAR/BAZ"
+
+  You can specify following OPTIONS:
+
+    'all-paths --- search from `load-path' instead of
+                  `default-load-path'
+
+    'append --- add PATH to the last of `load-path'
+
+Function add-latest-path (PATTERN &optional ALL-PATHS)
+
+  Add latest path matched by regexp PATTERN to `load-path' if it
+  exists under `default-load-path' directories and it does not exist
+  in `load-path'.
+
+  For example, if there is bbdb-1.50 and bbdb-1.51 under site-lisp,
+  and if bbdb-1.51 is newer than bbdb-1.50, and site-lisp is
+  /usr/local/share/emacs/site-lisp,
+
+       (add-path "bbdb")
+
+  it adds "/usr/local/share/emacs/site-lisp/bbdb-1.51" to top of
+  `load-path'.
+
+  If optional argument ALL-PATHS is specified, it is searched from all
+  of `load-path' instead of `default-load-path'.
+
+Function get-latest-path (PATTERN &optional ALL-PATHS)
+
+  Return latest directory in default-load-path which is matched to
+  regexp PATTERN.  If optional argument ALL-PATHS is specified, it is
+  searched from all of load-path instead of default-load-path.
+
+  Ex. (let ((gnus-path (get-latest-path "gnus")))
+        (add-path (expand-file-name "lisp" gnus-path))
+        (add-to-list 'Info-default-directory-list
+                    (expand-file-name "texi" gnus-path))
+        )
+
+Function file-installed-p (FILE &optional PATHS)
+
+  Return absolute-path of FILE if FILE exists in PATHS.  If PATHS is
+  omitted, `load-path' is used.
+
+Function exec-installed-p (FILE &optional PATHS SUFFIXES)
+
+  Return absolute-path of FILE if FILE exists in PATHS.  If PATHS is
+  omitted, `exec-path' is used.  If suffixes is omitted,
+  `exec-suffix-list' is used.
+
+Function module-installed-p (MODULE &optional PATHS)
+
+  Return non-nil if module is provided or exists in PATHS.  If PATHS
+  is omitted, `load-path' is used.
+
+filename
+--------
+
+Function replace-as-filename (string)
+
+  Return safety file-name from STRING.
+
+  It refers variable `filename-filters'.  It is list of functions for
+  file-name filter.  Default filter refers following variables:
+
+       Variable filename-limit-length
+
+         Limit size of file-name.
+
+       Variable filename-replacement-alist
+
+         Alist list of characters vs. string as replacement.  List of
+          characters represents characters not allowed as file-name.
+
+
+Bug reports
+===========
+
+  If you write bug-reports and/or suggestions for improvement, please
+  send them to the tm Mailing List:
+
+       bug-tm-en@chamonix.jaist.ac.jp  (English)
+       bug-tm-ja@chamonix.jaist.ac.jp  (Japanese)
+
+  Via the tm ML, you can report APEL bugs, obtain the latest release
+  of APEL, and discuss future enhancements to APEL.  To join the tm
+  ML, send an empty e-mail to
+
+       tm-en-help@chamonix.jaist.ac.jp (English)
+       tm-ja-help@chamonix.jaist.ac.jp (Japanese)
diff --git a/env.el b/env.el
new file mode 100644 (file)
index 0000000..c0e68f6
--- /dev/null
+++ b/env.el
@@ -0,0 +1,114 @@
+;;; env.el --- functions to manipulate environment variables.
+
+;; Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+
+;; Maintainer: FSF
+;; Keywords: processes, unix
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; UNIX processes inherit a list of name-to-string associations from their
+;; parents called their `environment'; these are commonly used to control
+;; program options.  This package permits you to set environment variables
+;; to be passed to any sub-process run under Emacs.
+
+;;; Code:
+
+;; History list for environment variable names.
+(defvar read-envvar-name-history nil)
+
+(defun read-envvar-name (prompt &optional mustmatch)
+  "Read environment variable name, prompting with PROMPT.
+Optional second arg MUSTMATCH, if non-nil, means require existing envvar name.
+If it is also not t, RET does not exit if it does non-null completion."
+  (completing-read prompt
+                  (mapcar (function
+                           (lambda (enventry)
+                             (list (substring enventry 0
+                                              (string-match "=" enventry)))))
+                          process-environment)
+                  nil mustmatch nil 'read-envvar-name-history))
+
+;; History list for VALUE argument to setenv.
+(defvar setenv-history nil)
+
+;;;###autoload
+(defun setenv (variable &optional value unset)
+  "Set the value of the environment variable named VARIABLE to VALUE.
+VARIABLE should be a string.  VALUE is optional; if not provided or is
+`nil', the environment variable VARIABLE will be removed.  
+
+Interactively, a prefix argument means to unset the variable.
+Interactively, the current value (if any) of the variable
+appears at the front of the history list when you type in the new value.
+
+This function works by modifying `process-environment'."
+  (interactive
+   (if current-prefix-arg
+       (list (read-envvar-name "Clear environment variable: " 'exact) nil t)
+     (let* ((var (read-envvar-name "Set environment variable: " nil))
+           (oldval (getenv var))
+           newval
+           oldhist)
+       ;; Don't put the current value on the history
+       ;; if it is already there.
+       (if (equal oldval (car setenv-history))
+          (setq oldval nil))
+       ;; Now if OLDVAL is non-nil, we should add it to the history.
+       (if oldval
+          (setq setenv-history (cons oldval setenv-history)))
+       (setq oldhist setenv-history)
+       (setq newval (read-from-minibuffer (format "Set %s to value: " var)
+                                         nil nil nil 'setenv-history))
+       ;; If we added the current value to the history, remove it.
+       ;; Note that read-from-minibuffer may have added the new value.
+       ;; Don't remove that!
+       (if oldval
+          (if (eq oldhist setenv-history)
+              (setq setenv-history (cdr setenv-history))
+            (setcdr setenv-history (cdr (cdr setenv-history)))))
+       ;; Here finally we specify the args to give call setenv with.
+       (list var newval))))
+  (if unset (setq value nil))
+  (if (string-match "=" variable)
+      (error "Environment variable name `%s' contains `='" variable)
+    (let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
+         (case-fold-search nil)
+         (scan process-environment)
+         found)
+      (if (string-equal "TZ" variable)
+         (set-time-zone-rule value))
+      (while scan
+       (cond ((string-match pattern (car scan))
+              (setq found t)
+              (if (eq nil value)
+                  (setq process-environment (delq (car scan) process-environment))
+                (setcar scan (concat variable "=" value)))
+              (setq scan nil)))
+       (setq scan (cdr scan)))
+      (or found
+         (if value
+             (setq process-environment
+                   (cons (concat variable "=" value)
+                         process-environment)))))))
+
+(provide 'env)
+
+;;; env.el ends here
diff --git a/ftp.in b/ftp.in
new file mode 100644 (file)
index 0000000..7fd734e
--- /dev/null
+++ b/ftp.in
@@ -0,0 +1,24 @@
+--<<alternative>>-{
+
+  It is available from
+
+    ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/  (Japan)
+
+or its mirrors
+
+    ftp://ftp.nis.co.jp/pub/gnu/emacs-lisp/tm/alpha/   (Japan)
+    ftp://ftp.nisiq.net/pub/gnu/emacs-lisp/tm/alpha/   (US)
+    ftp://ftp.miranova.com/pub/mime/jaist.ac.jp/alpha/ (US)
+    ftp://ftp.unicamp.br/pub/mail/mime/tm/alpha/       (Brazil)
+
+--[[message/external-body;
+       access-type=anon-ftp;
+       site="ftp.jaist.ac.jp";
+       directory="/pub/GNU/elisp/apel";
+       name="apel-VERSION.tar.gz";
+       mode=image]]
+Content-Type: application/octet-stream;
+       name="apel-VERSION.tar.gz";
+       type=tar;
+       conversions=gzip
+--}-<<alternative>>
diff --git a/path-util.el b/path-util.el
new file mode 100644 (file)
index 0000000..5ff9826
--- /dev/null
@@ -0,0 +1,170 @@
+;;; path-util.el --- Emacs Lisp file detection utility
+
+;; Copyright (C) 1996,1997 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version: $Id: path-util.el,v 1.1 1997-11-06 15:47:23 morioka Exp $
+;; Keywords: file detection, install, module
+
+;; This file is part of APEL (A Portable Emacs Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(defvar default-load-path load-path
+  "*Base of `load-path'.
+It is used as default value of target path to search file or
+subdirectory under load-path.")
+
+;;;###autoload
+(defun add-path (path &rest options)
+  "Add PATH to `load-path' if it exists under `default-load-path'
+directories and it does not exist in `load-path'.
+
+You can use following PATH styles:
+       load-path relative: \"PATH/\"
+                       (it is searched from `defaul-load-path')
+       home directory relative: \"~/PATH/\" \"~USER/PATH/\"
+       absolute path: \"/HOO/BAR/BAZ/\"
+
+You can specify following OPTIONS:
+       'all-paths      search from `load-path'
+                       instead of `default-load-path'
+       'append         add PATH to the last of `load-path'"
+  (let ((rest (if (memq 'all-paths options)
+                 load-path
+               default-load-path))
+       p)
+    (if (and (catch 'tag
+              (while rest
+                (setq p (expand-file-name path (car rest)))
+                (if (file-directory-p p)
+                    (throw 'tag p)
+                  )
+                (setq rest (cdr rest))
+                ))
+            (not (member p load-path))
+            )
+       (setq load-path
+             (if (memq 'append options)
+                 (append load-path (list p))
+               (cons p load-path)
+               ))
+      )))
+
+;;;###autoload
+(defun add-latest-path (pattern &optional all-paths)
+  "Add latest path matched by PATTERN to `load-path'
+if it exists under `default-load-path' directories
+and it does not exist in `load-path'.
+
+If optional argument ALL-PATHS is specified, it is searched from all
+of load-path instead of default-load-path."
+  (let ((path (get-latest-path pattern all-paths)))
+    (if path
+       (add-to-list 'load-path path)
+      )))
+
+;;;###autoload
+(defun get-latest-path (pattern &optional all-paths)
+  "Return latest directory in default-load-path
+which is matched to regexp PATTERN.
+If optional argument ALL-PATHS is specified,
+it is searched from all of load-path instead of default-load-path."
+  (catch 'tag
+    (let ((paths (if all-paths
+                   load-path
+                 default-load-path))
+         dir)
+      (while (setq dir (car paths))
+       (if (and (file-exists-p dir)
+                (file-directory-p dir)
+                )
+           (let ((files (sort (directory-files dir t pattern t)
+                              (function file-newer-than-file-p)))
+                 file)
+             (while (setq file (car files))
+               (if (file-directory-p file)
+                   (throw 'tag file)
+                 )
+               (setq files (cdr files))
+               )))
+       (setq paths (cdr paths))
+       ))))
+
+;;;###autoload
+(defun file-installed-p (file &optional paths)
+  "Return absolute-path of FILE if FILE exists in PATHS.
+If PATHS is omitted, `load-path' is used."
+  (if (null paths)
+      (setq paths load-path)
+    )
+  (catch 'tag
+    (let (path)
+      (while paths
+       (setq path (expand-file-name file (car paths)))
+       (if (file-exists-p path)
+           (throw 'tag path)
+         )
+       (setq paths (cdr paths))
+       ))))
+
+;;;###autoload
+(defvar exec-suffix-list '("")
+  "*List of suffixes for executable.")
+
+;;;###autoload
+(defun exec-installed-p (file &optional paths suffixes)
+  "Return absolute-path of FILE if FILE exists in PATHS.
+If PATHS is omitted, `exec-path' is used.
+If suffixes is omitted, `exec-suffix-list' is used."
+  (or paths
+      (setq paths exec-path)
+      )
+  (or suffixes
+      (setq suffixes exec-suffix-list)
+      )
+  (catch 'tag
+    (while paths
+      (let ((stem (expand-file-name file (car paths)))
+           (sufs suffixes)
+           )
+       (while sufs
+         (let ((file (concat stem (car sufs))))
+           (if (file-exists-p file)
+               (throw 'tag file)
+             ))
+         (setq sufs (cdr sufs))
+         ))
+      (setq paths (cdr paths))
+      )))
+
+;;;###autoload
+(defun module-installed-p (module &optional paths)
+  "Return t if module is provided or exists in PATHS.
+If PATHS is omitted, `load-path' is used."
+  (or (featurep module)
+      (exec-installed-p (symbol-name module) load-path '(".elc" ".el"))
+      ))
+
+
+;;; @ end
+;;;
+
+(provide 'path-util)
+
+;;; path-util.el ends here
index 10912b0..9139530 100644 (file)
@@ -1,11 +1,10 @@
 ;;; std11-parse.el --- STD 11 parser for GNU Emacs
 
-;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Keywords: mail, news, RFC 822, STD 11
-;; Version:
-;;     $Id: std11-parse.el,v 0.15 1996-11-28 19:38:27 morioka Exp $
+;; Version: $Id: std11-parse.el,v 1.1 1998-02-04 07:21:11 morioka Exp $
 
 ;; This file is part of MU (Message Utilities).
 
 ;;;
 
 (defconst std11-space-chars " \t\n")
-(defconst std11-spaces-regexp (concat "[" std11-space-chars "]+"))
-(defconst std11-special-chars "][()<>@,;:\\<>.\"")
+(defconst std11-spaces-regexp (` (, (concat "[" std11-space-chars "]+"))))
+(defconst std11-special-char-list '(?\] ?\[
+                                       ?\( ?\) ?< ?> ?@
+                                       ?, ?\; ?: ?\\ ?\"
+                                       ?.))
 (defconst std11-atom-regexp
-  (concat "^[^" std11-special-chars std11-space-chars "]+"))
+  (` (, (concat "^[^" std11-special-char-list std11-space-chars "]+"))))
 
 (defun std11-analyze-spaces (string)
   (if (and (string-match std11-spaces-regexp string)
@@ -49,8 +51,7 @@
 
 (defun std11-analyze-special (str)
   (if (and (> (length str) 0)
-          (find (aref str 0) std11-special-chars)
-          )
+          (memq (aref str 0) std11-special-char-list))
       (cons (cons 'specials (substring str 0 1))
            (substring str 1)
            )))
   (let (token itl parsed token-value)
     (while (and lal
                (setq token (car lal))
-               (if (and (setq token-value (cdr token))
-                        (find-non-ascii-charset-string token-value)
-                        )
-                   (setq token nil)
-                 (std11-ignored-token-p token)
-                 ))
+               (or (std11-ignored-token-p token)
+                   (if (and (setq token-value (cdr token))
+                            (find-non-ascii-charset-string token-value)
+                            )
+                       (setq token nil)
+                     )))
       (setq lal (cdr lal))
       (setq itl (cons token itl))
       )
          (nreverse dest)
          ))))
 
+(defun std11-parse-msg-id (lal)
+  (let ((ret (std11-parse-ascii-token lal))
+       < addr-spec >)
+    (if (and ret
+            (setq < (car ret))
+            (string-equal (cdr (assq 'specials <)) "<")
+            (setq lal (cdr ret))
+            (setq ret (std11-parse-addr-spec lal))
+            (setq addr-spec (car ret))
+            (setq lal (cdr ret))
+            (setq ret (std11-parse-ascii-token lal))
+            (setq > (car ret))
+            (string-equal (cdr (assq 'specials >)) ">")
+            )
+       (cons (cons 'msg-id (cdr addr-spec))
+             (cdr ret))
+      )))
+
 
 ;;; @ end
 ;;;
index c051a16..117ddc6 100644 (file)
--- a/std11.el
+++ b/std11.el
@@ -4,7 +4,7 @@
 
 ;; Author:   MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Keywords: mail, news, RFC 822, STD 11
-;; Version: $Id: std11.el,v 0.40 1997-03-03 08:03:06 shuhei-k Exp $
+;; Version: $Id: std11.el,v 1.1 1998-02-04 07:24:33 morioka Exp $
 
 ;; This file is part of MU (Message Utilities).
 
@@ -330,6 +330,48 @@ represents addr-spec of RFC 822. [std11.el]"
                 )
           ))))
 
+(defun std11-msg-id-string (msg-id)
+  "Return string from parsed MSG-ID of RFC 822."
+  (concat "<" (std11-addr-to-string (cdr msg-id)) ">")
+  )
+
+(defun std11-fill-msg-id-list-string (string &optional column)
+  "Fill list of msg-id in STRING, and return the result."
+  (or column
+      (setq column 12))
+  (let ((lal (std11-lexical-analyze string))
+       dest)
+    (let ((ret (std11-parse-msg-id lal)))
+      (if ret
+         (let* ((str (std11-msg-id-string (car ret)))
+                (len (length str)))
+           (setq lal (cdr ret))
+           (if (> (+ len column) 76)
+               (setq dest (concat dest "\n " str)
+                     column (1+ len))
+             (setq dest str
+                   column (+ column len))
+             ))
+       (setq dest (concat dest (cdr (car lal)))
+             lal (cdr lal))
+       ))
+    (while lal
+      (let ((ret (std11-parse-msg-id lal)))
+       (if ret
+           (let* ((str (std11-msg-id-string (car ret)))
+                  (len (1+ (length str))))
+             (setq lal (cdr ret))
+             (if (> (+ len column) 76)
+                 (setq dest (concat dest "\n " str)
+                       column len)
+               (setq dest (concat dest " " str)
+                     column (+ column len))
+               ))
+         (setq dest (concat dest (cdr (car lal)))
+               lal (cdr lal))
+         )))
+    dest))
+
 
 ;;; @ parser
 ;;;