From 0edc5e2f50b5a7ee85ad0a21b5055d2edf493555 Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 12 Oct 2000 04:00:13 +0000 Subject: [PATCH] * elmo-imap4.el (elmo-imap4-read): Abolished. (Renamed to `elmo-read' and moved to elmo-util.el) All other related portions are changed. * elmo-util.el (elmo-read): New function. (elmo-condition-parse-search-value): Use it. --- elmo/ChangeLog | 9 +++++++++ elmo/elmo-imap4.el | 46 ++++++++++++++++++++-------------------------- elmo/elmo-util.el | 10 +++++++++- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index c197590..c940f7e 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2000-10-12 Yuuichi Teranishi + + * elmo-imap4.el (elmo-imap4-read): Abolished. + (Renamed to `elmo-read' and moved to elmo-util.el) + All other related portions are changed. + + * elmo-util.el (elmo-read): New function. + (elmo-condition-parse-search-value): Use it. + 2000-10-11 Yuuichi Teranishi * elmo2.el (elmo-quit): Don't use `elmo-nntp-flush-connection'. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 2ac7348..536e310 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -866,7 +866,6 @@ BUFFER must be a single-byte buffer." (defvar elmo-imap4-header-fields "HEADER\.FIELDS") (defmacro elmo-imap4-replace-dot-symbols ()) ;; noop (defalias 'elmo-imap4-fetch-read 'read) - (defalias 'elmo-imap4-read 'read) ) (t ;;; For Nemacs. @@ -893,12 +892,7 @@ BUFFER must be a single-byte buffer." ((string= token "HEADER\.FIELDS") (intern elmo-imap4-header-fields)) (t (goto-char beg) - (elmo-imap4-read (current-buffer)))))))) - ;; Nemacs's `read' is different. - (defun elmo-imap4-read (obj) - (prog1 (read obj) - (if (bufferp obj) - (or (bobp) (forward-char -1))))))) + (elmo-read (current-buffer)))))))))) (defun elmo-imap4-make-number-set-list (msg-list &optional chop-length) "Make RFC2060's message set specifier from MSG-LIST. @@ -1090,7 +1084,7 @@ If optional argument UNMARK is non-nil, unmark." (defun elmo-imap4-parse-capability (string) (if (string-match "^\\*\\(.*\\)$" string) - (elmo-imap4-read + (elmo-read (concat "(" (downcase (elmo-match-string 1 string)) ")")))) ;; Current buffer is process buffer. @@ -1645,11 +1639,11 @@ Return nil if no complete line has arrived." (defun elmo-imap4-parse-response () "Parse a IMAP command response." (let (token) - (case (setq token (elmo-imap4-read (current-buffer))) + (case (setq token (elmo-read (current-buffer))) (+ (progn (skip-chars-forward " ") (list 'continue-req (buffer-substring (point) (point-max))))) - (* (case (prog1 (setq token (elmo-imap4-read (current-buffer))) + (* (case (prog1 (setq token (elmo-read (current-buffer))) (elmo-imap4-forward)) (OK (elmo-imap4-parse-resp-text-code)) (NO (elmo-imap4-parse-resp-text-code)) @@ -1661,19 +1655,19 @@ Return nil if no complete line has arrived." (LSUB (list 'lsub (elmo-imap4-parse-data-list))) (SEARCH (list 'search - (elmo-imap4-read (concat "(" + (elmo-read (concat "(" (buffer-substring (point) (point-max)) ")")))) (STATUS (elmo-imap4-parse-status)) ;; Added (NAMESPACE (elmo-imap4-parse-namespace)) (CAPABILITY (list 'capability - (elmo-imap4-read + (elmo-read (concat "(" (downcase (buffer-substring (point) (point-max))) ")")))) (ACL (elmo-imap4-parse-acl)) - (t (case (prog1 (elmo-imap4-read (current-buffer)) + (t (case (prog1 (elmo-read (current-buffer)) (elmo-imap4-forward)) (EXISTS (list 'exists token)) (RECENT (list 'recent token)) @@ -1682,7 +1676,7 @@ Return nil if no complete line has arrived." (t (list 'garbage (buffer-string))))))) (t (if (not (string-match elmo-imap4-seq-prefix (symbol-name token))) (list 'garbage (buffer-string)) - (case (prog1 (elmo-imap4-read (current-buffer)) + (case (prog1 (elmo-read (current-buffer)) (elmo-imap4-forward)) (OK (progn (setq elmo-imap4-parsing nil) @@ -1735,9 +1729,9 @@ Return nil if no complete line has arrived." (cond ((search-forward "PERMANENTFLAGS " nil t) (list 'permanentflags (elmo-imap4-parse-flag-list))) ((search-forward "UIDNEXT " nil t) - (list 'uidnext (elmo-imap4-read (current-buffer)))) + (list 'uidnext (elmo-read (current-buffer)))) ((search-forward "UNSEEN " nil t) - (list 'unseen (elmo-imap4-read (current-buffer)))) + (list 'unseen (elmo-read (current-buffer)))) ((looking-at "UIDVALIDITY \\([0-9]+\\)") (list 'uidvalidity (match-string 1))) ((search-forward "READ-ONLY" nil t) @@ -1806,7 +1800,7 @@ Return nil if no complete line has arrived." (setq element (cond ((eq token 'UID) (list 'uid (condition-case nil - (elmo-imap4-read (current-buffer)) + (elmo-read (current-buffer)) (error nil)))) ((eq token 'FLAGS) (list 'flags (elmo-imap4-parse-flag-list))) @@ -1821,7 +1815,7 @@ Return nil if no complete line has arrived." ((eq token (intern elmo-imap4-rfc822-text)) (list 'rfc822text (elmo-imap4-parse-nstring))) ((eq token (intern elmo-imap4-rfc822-size)) - (list 'rfc822size (elmo-imap4-read (current-buffer)))) + (list 'rfc822size (elmo-read (current-buffer)))) ((eq token 'BODY) (if (eq (char-before) ?\[) (list @@ -1852,19 +1846,19 @@ Return nil if no complete line has arrived." (while (not (eq (char-after (point)) ?\))) (setq status (cons - (let ((token (elmo-imap4-read (current-buffer)))) + (let ((token (elmo-read (current-buffer)))) (cond ((eq token 'MESSAGES) - (list 'messages (elmo-imap4-read (current-buffer)))) + (list 'messages (elmo-read (current-buffer)))) ((eq token 'RECENT) - (list 'recent (elmo-imap4-read (current-buffer)))) + (list 'recent (elmo-read (current-buffer)))) ((eq token 'UIDNEXT) - (list 'uidnext (elmo-imap4-read (current-buffer)))) + (list 'uidnext (elmo-read (current-buffer)))) ((eq token 'UIDVALIDITY) (and (looking-at " \\([0-9]+\\)") (prog1 (list 'uidvalidity (match-string 1)) (goto-char (match-end 1))))) ((eq token 'UNSEEN) - (list 'unseen (elmo-imap4-read (current-buffer)))) + (list 'unseen (elmo-read (current-buffer)))) (t (message "Unknown status data %s in mailbox %s ignored" @@ -1890,9 +1884,9 @@ Return nil if no complete line has arrived." (nconc (copy-sequence elmo-imap4-extra-namespace-alist) (elmo-imap4-parse-namespace-subr - (elmo-imap4-read (concat "(" (buffer-substring - (point) (point-max)) - ")")))))) + (elmo-read (concat "(" (buffer-substring + (point) (point-max)) + ")")))))) (defun elmo-imap4-parse-namespace-subr (ns) (let (prefix delim namespace-alist default-delim) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index d12a8c4..404f401 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -85,6 +85,14 @@ spec args))) +;; Nemacs's `read' is different. +(static-if (fboundp 'nemacs-version) + (defun elmo-read (obj) + (prog1 (read obj) + (if (bufferp obj) + (or (bobp) (forward-char -1))))) + (defalias 'elmo-read 'read)) + (defmacro elmo-set-work-buf (&rest body) "Execute BODY on work buffer. Work buffer remains." (` (save-excursion @@ -598,7 +606,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (defun elmo-condition-parse-search-value () (cond ((looking-at "\"") - (read (current-buffer))) + (elmo-read (current-buffer))) ((or (looking-at "yesterday") (looking-at "lastweek") (looking-at "lastmonth") (looking-at "lastyear") (looking-at "[0-9]+ *daysago") -- 1.7.10.4