From: teranisi Date: Sun, 22 Feb 2004 01:35:47 +0000 (+0000) Subject: * elmo-file.el (elmo-file-find): Use expand-file-name for return value. X-Git-Tag: wl-2_11_25~44 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=dca8ca3a9e250daa7d67eaddced7735638823a56;p=elisp%2Fwanderlust.git * 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. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 7e5cca8..03fe962 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2004-02-22 Yuuichi Teranishi + + * 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 * elmo-file.el (elmo-file-command-argument): Fixed problem when a diff --git a/elmo/elmo-file.el b/elmo/elmo-file.el index af09c0c..a1866ec 100644 --- a/elmo/elmo-file.el +++ b/elmo/elmo-file.el @@ -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)) @@ -95,24 +95,26 @@ (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)))))) @@ -202,7 +204,7 @@ (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)