;;; elmo-util.el -- Utilities for Elmo.
-;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
;; Author: Yuuichi Teranishi <teranisi@gohome.org>
;; Keywords: mail, net news
(if (file-writable-p filename)
(progn
(when mime-charset
- ;;(elmo-set-buffer-multibyte default-enable-multibyte-characters)
+;;; (elmo-set-buffer-multibyte default-enable-multibyte-characters)
(encode-mime-charset-region (point-min) (point-max) mime-charset))
(as-binary-output-file
(write-region (point-min) (point-max) filename nil 'no-msg)))
File content is encoded with MIME-CHARSET."
(elmo-set-work-buf
(prin1 object (current-buffer))
- ;;(princ "\n" (current-buffer))
+;;;(princ "\n" (current-buffer))
(elmo-save-buffer filename mime-charset)))
(defsubst elmo-imap4-decode-folder-string (string)
)
(if (file-name-absolute-p fld-name)
(setq path (expand-file-name fld-name))
+;;; (setq path (expand-file-name fld-name
+;;; elmo-localdir-folder-path))
(setq path fld-name))
- ;(setq path (expand-file-name fld-name
- ;elmo-localdir-folder-path)))
(list (if (elmo-folder-maildir-p folder)
'maildir
'localdir) path))))
(defun elmo-uniq-list (lst)
"Distractively uniqfy elements of LST."
(let ((tmp lst))
- (while tmp (setq tmp (setcdr tmp (and (cdr tmp) (delete (car tmp) (cdr tmp)))))))
+ (while tmp (setq tmp
+ (setcdr tmp
+ (and (cdr tmp)
+ (delete (car tmp)
+ (cdr tmp)))))))
lst)
(defun elmo-string-partial-p (string)
(erase-buffer)
(prin1 elmo-passwd-alist tmp-buffer)
(princ "\n" tmp-buffer)
-; (if (and (file-exists-p filename)
-; (not (equal 384 (file-modes filename))))
-; (error "%s is not safe.chmod 600 %s!" filename filename))
+;;; (if (and (file-exists-p filename)
+;;; (not (equal 384 (file-modes filename))))
+;;; (error "%s is not safe.chmod 600 %s!" filename filename))
(if (file-writable-p filename)
(progn
(write-region (point-min) (point-max)
;; from subr.el
(defun elmo-replace-in-string (str regexp newtext &optional literal)
- "Replaces all matches in STR for REGEXP with NEWTEXT string.
+ "Replace all matches in STR for REGEXP with NEWTEXT string.
And returns the new string.
Optional LITERAL non-nil means do a literal replacement.
Otherwise treat \\ in NEWTEXT string as special:
(elmo-make-directory parent))
(make-directory path)
(if (string= path (expand-file-name elmo-msgdb-dir))
- (set-file-modes path 448) ; 700
- )))
+ (set-file-modes path (+ (* 64 7) (* 8 0) 0))))) ; chmod 0700
(defun elmo-delete-directory (path &optional no-hierarchy)
"Delete directory recursively."
(cond ((eq (elmo-folder-get-type folder1) 'imap4)
(let ((spec1 (elmo-folder-get-spec folder1))
(spec2 (elmo-folder-get-spec folder2)))
- (and ;(elmo-imap4-identical-name-space-p ;; No use.
- ; (nth 1 spec1) (nth 1 spec2))
+ (and
+;;; No use.
+;;; (elmo-imap4-identical-name-space-p
+;;; (nth 1 spec1) (nth 1 spec2))
(string= (elmo-imap4-spec-hostname spec1)
- (elmo-imap4-spec-hostname spec2)) ; hostname
+ (elmo-imap4-spec-hostname spec2)) ; hostname
(string= (elmo-imap4-spec-username spec1)
(elmo-imap4-spec-username spec2))))) ; username
(t
(list 'makunbound (list 'intern string hashtable))))
(defmacro elmo-unintern (string)
- ;; Emacs 19.28 or earlier does not have unintern.
+ "`unintern' symbol named STRING, When can use `unintern'.
+Emacs 19.28 or earlier does not have `unintern'."
(static-if (fboundp 'unintern)
(list 'unintern string)))
(defsubst elmo-copy-file (src dst)
(condition-case err
(elmo-add-name-to-file src dst t)
- (error (copy-file src dst t)
- (error "Copy file failed"))))
+ (error (copy-file src dst t))))
(defsubst elmo-buffer-exists-p (buffer)
(if (bufferp buffer)
(set-text-properties 0 (length obj) nil obj)
obj)))
+(defun elmo-flatten (list-of-list)
+ "Flatten LIST-OF-LIST."
+ (unless (null list-of-list)
+ (append (if (and (car list-of-list)
+ (listp (car list-of-list)))
+ (car list-of-list)
+ (list (car list-of-list)))
+ (elmo-flatten (cdr list-of-list)))))
+
(defun elmo-y-or-n-p (prompt &optional auto default)
"Same as `y-or-n-p'.
But if optional argument AUTO is non-nil, DEFAULT is returned."