* elmo-file.el (elmo-file-find): Use expand-file-name for return value.
authorteranisi <teranisi>
Sun, 22 Feb 2004 01:35:47 +0000 (01:35 +0000)
committerteranisi <teranisi>
Sun, 22 Feb 2004 01:35:47 +0000 (01:35 +0000)
(elmo-file-command-argument): Undo last change for cygwin.
(elmo-file-detect-content-type): Renamed from elmo-file-detect-format;
Don't return nil.
(elmo-map-message-fetch): Use elmo-file-detect-content-type.

elmo/ChangeLog
elmo/elmo-file.el

index 7e5cca8..03fe962 100644 (file)
@@ -1,3 +1,12 @@
+2004-02-22  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-file.el (elmo-file-find): Use expand-file-name for return
+       value.
+       (elmo-file-command-argument): Undo last change for cygwin.
+       (elmo-file-detect-content-type): Renamed from elmo-file-detect-format;
+       Don't return nil.
+       (elmo-map-message-fetch): Use elmo-file-detect-content-type.
+
 2004-02-21  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-file.el (elmo-file-command-argument): Fixed problem when a
index af09c0c..a1866ec 100644 (file)
@@ -40,7 +40,7 @@
        (setq file (car files)
              files nil))
       (setq files (cdr files)))
-    file))
+    (expand-file-name file)))
 
 (defcustom elmo-file-command (exec-installed-p "file")
   "*Program name of the file type detection command `file'."
@@ -51,7 +51,7 @@
   (let ((magic-file (elmo-file-find
                     '("/usr/share/magic.mime"
                       "/usr/share/file/magic.mime"
-                      "c:/cygwin/usr/share/file/magic.mime"))))
+                      "/cygwin/usr/share/file/magic.mime"))))
     (if magic-file (list "-m" magic-file)))
   "*Argument list for the `file' command.
 \(It should return the MIME content type\)"
@@ -86,7 +86,7 @@
     (concat (elmo-match-string 1 s) ", "
            (timezone-make-date-arpa-standard s (current-time-zone)))))
 
-(defun elmo-file-detect-format (file)
+(defun elmo-file-detect-content-type (file)
   "Return content-type of the FILE."
   (if (or (not (file-exists-p file))
          (file-directory-p file))
       (setq type (mime-find-file-type file))
       (if (and (string= (nth 0 type) "application")
               (string= (nth 1 type) "octet-stream"))
-         (if elmo-file-command
+         (if (and elmo-file-command
+                  elmo-file-command-argument)
              (with-temp-buffer
-               (when
-                   (zerop (apply 'call-process elmo-file-command
+               (if (zerop (apply 'call-process elmo-file-command
                                  nil `(,(current-buffer) nil)
                                  nil (append elmo-file-command-argument
                                              (list (expand-file-name file)))))
-                 (goto-char (point-min))
-                 (when (re-search-forward ": *" nil t)
-                   (setq type (buffer-substring (match-end 0)
-                                                (point-at-eol))))
-                 (cond
-                  ((string= "empty" type)
-                   "application/octet-stream")
-                  ((string-match "text" type)
-                   "text/plain")
-                  (t
-                   (car (split-string type))))))
+                   (progn
+                     (goto-char (point-min))
+                     (when (re-search-forward ": *" nil t)
+                       (setq type (buffer-substring (match-end 0)
+                                                    (point-at-eol))))
+                     (cond
+                      ((string= "empty" type)
+                       "application/octet-stream")
+                      ((string-match "text" type)
+                       "text/plain")
+                      (t
+                       (car (split-string type)))))
+                 "application/octet-stream"))
            (concat (nth 0 type) "/" (nth 1 type)))
        (concat (nth 0 type) "/" (nth 1 type))))))
 
        (unless (or (std11-field-body "To")
                    (std11-field-body "Cc")
                    (std11-field-body "Subject"))
-         (setq guess (elmo-file-detect-format file))
+         (setq guess (elmo-file-detect-content-type file))
          (setq is-text (string-match "^text/" guess))
          (when is-text
            (set-buffer-multibyte t)