From 78da857009cd9a5a4e45288d5f0d9fa60b42c940 Mon Sep 17 00:00:00 2001 From: keiichi Date: Fri, 14 May 1999 04:20:15 +0000 Subject: [PATCH] Sync up with gnus-6_10. --- lisp/dgnushack.el | 2 +- lisp/gnus-art.el | 45 +++++++++++++++++++++------------------------ lisp/gnus-kill.el | 2 +- lisp/gnus-mh.el | 2 +- lisp/gnus-msg.el | 2 +- lisp/gnus-picon.el | 4 +--- lisp/gnus-soup.el | 8 ++++---- lisp/gnus-spec.el | 2 +- lisp/gnus-sum.el | 9 +++++---- lisp/gnus-util.el | 2 +- lisp/gnus-xmas.el | 3 +-- lisp/gnus.el | 2 +- lisp/md5.el | 2 +- lisp/message.el | 43 +++++++++++++++++++++++-------------------- lisp/nndb.el | 4 ++-- lisp/nnheader.el | 2 +- lisp/nnmail.el | 12 +++++------- lisp/nnsoup.el | 4 ++-- lisp/nnspool.el | 3 +-- lisp/nntp.el | 4 ++-- lisp/pop3-fma.el | 2 +- 21 files changed, 77 insertions(+), 82 deletions(-) diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index e6fde66..051c2f5 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -120,7 +120,7 @@ Modify to suit your needs.")) (with-temp-buffer (let ((standard-output (current-buffer))) (Custom-make-dependencies ".")) - (message (buffer-substring (point-min) (point-max)))) + (message (buffer-string))) (require 'cus-load) (byte-compile-file "custom-load.el") diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index ca0a9fa..b67fa90 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -701,9 +701,8 @@ always hide." ;; select which header lines is to remain visible in the ;; article buffer. (goto-char (point-min)) - (while (memq (char-after) '(?\t ?\ )) - (forward-line 1)) - (while (not (eobp)) + (while (re-search-forward "^[^ \t]*:" nil t) + (beginning-of-line) ;; Mark the rank of the header. (put-text-property (point) (1+ (point)) 'message-rank @@ -712,9 +711,7 @@ always hide." (not (looking-at ignored)))) (gnus-article-header-rank) (+ 2 max))) - (forward-line 1) - (while (memq (char-after) '(?\t ?\ )) - (forward-line 1))) + (forward-line 1)) (message-sort-headers-1) (when (setq beg (text-property-any (point-min) (point-max) 'message-rank (+ 2 max))) @@ -749,11 +746,12 @@ always hide." (while (re-search-forward "^[^:]+:[ \t]*\n[^ \t]" nil t) (forward-line -1) (gnus-article-hide-text-type - (point) + (progn (beginning-of-line) (point)) (progn - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (point)) + (end-of-line) + (if (re-search-forward "^[^ \t]" nil t) + (match-beginning 0) + (point-max))) 'boring-headers))) ;; Hide boring Newsgroups header. ((eq elem 'newsgroups) @@ -809,9 +807,10 @@ always hide." (gnus-article-hide-text-type (progn (beginning-of-line) (point)) (progn - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (point)) + (end-of-line) + (if (re-search-forward "^[^ \t]" nil t) + (match-beginning 0) + (point-max))) 'boring-headers)))) (defun article-treat-dumbquotes () @@ -878,7 +877,7 @@ characters to translate to." (adaptive-fill-mode t)) (while (not (eobp)) (and (>= (current-column) (min fill-column (window-width))) - (not (eq (preceding-char) ?:)) + (not (eq (char-before) ?:)) (fill-paragraph nil)) (end-of-line 2)))))) @@ -2707,7 +2706,7 @@ groups." "Exit the article editing without updating." (interactive) ;; We remove all text props from the article buffer. - (let ((buf (format "%s" (buffer-substring (point-min) (point-max)))) + (let ((buf (format "%s" (buffer-string))) (curbuf (current-buffer)) (p (point)) (window-start (window-start))) @@ -2816,7 +2815,7 @@ after replacing with the original article." (setq font-lock-defaults nil) (font-lock-mode 0)) ;; We remove all text props from the article buffer. - (setq buf (format "%s" (buffer-substring (point-min) (point-max)))) + (setq buf (format "%s" (buffer-string))) (set-buffer (get-buffer-create gnus-original-article-buffer)) (erase-buffer) (insert buf) @@ -3029,11 +3028,9 @@ do the highlighting. See the documentation for those functions." (when (and field-face (not (memq (setq from (point)) fpoints))) (push from fpoints) - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (unless (eobp) - ;; Go to the end of the previous line. - (end-of-line 0)) + (if (re-search-forward "^[^ \t]" nil t) + (forward-char -2) + (goto-char (point-max))) (gnus-put-text-property from (point) 'face field-face)))))))) (defun gnus-article-highlight-signature () @@ -3125,9 +3122,9 @@ specified by `gnus-button-alist'." (while (re-search-forward (car entry) nil t) ;; Each header matching the entry. (setq beg (match-beginning 0)) - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (setq end (point)) + (setq end (or (and (re-search-forward "^[^ \t]" nil t) + (match-beginning 0)) + (point-max))) (goto-char beg) (while (re-search-forward (nth 1 entry) end t) ;; Each match within a header. diff --git a/lisp/gnus-kill.el b/lisp/gnus-kill.el index 1860074..abcc401 100644 --- a/lisp/gnus-kill.el +++ b/lisp/gnus-kill.el @@ -282,7 +282,7 @@ If NEWSGROUP is nil, the global kill file is selected." (if (and gnus-current-kill-article (get-buffer gnus-summary-buffer)) ;; Assume newsgroup is selected. - (gnus-kill-file-apply-string (buffer-substring (point-min) (point-max))) + (gnus-kill-file-apply-string (buffer-string)) (ding) (gnus-message 2 "No newsgroup is selected."))) (defun gnus-kill-file-apply-string (string) diff --git a/lisp/gnus-mh.el b/lisp/gnus-mh.el index a82e4e2..fa01f5a 100644 --- a/lisp/gnus-mh.el +++ b/lisp/gnus-mh.el @@ -76,7 +76,7 @@ Optional argument FOLDER specifies folder name." (set-buffer errbuf) (if (zerop (buffer-size)) (message "Article saved in folder: %s" folder) - (message "%s" (buffer-substring (point-min) (point-max)))) + (message "%s" (buffer-string))) (kill-buffer errbuf)))) (setq gnus-newsgroup-last-folder folder))) diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index e6e8ead..5ca0e78 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -427,7 +427,7 @@ header line with the old Message-ID." (gnus-remove-text-with-property 'gnus-next) (insert (prog1 - (format "%s" (buffer-substring (point-min) (point-max))) + (format "%s" (buffer-string)) (erase-buffer))) ;; Find the original headers. (set-buffer gnus-original-article-buffer) diff --git a/lisp/gnus-picon.el b/lisp/gnus-picon.el index fba2811..a3b5418 100644 --- a/lisp/gnus-picon.el +++ b/lisp/gnus-picon.el @@ -514,9 +514,7 @@ none, and whose CDR is the corresponding element of DOMAINS." nil 'quiet) (prog1 (make-glyph (vector 'xbm :file fname)) (delete-file fname)))) - (t (make-glyph - (vector type :data - (buffer-substring (point-min) (point-max))))))) + (t (make-glyph (vector type :data (buffer-string)))))) ;;; Parsing of piconsearch result page. diff --git a/lisp/gnus-soup.el b/lisp/gnus-soup.el index 3d97829..1fdd83f 100644 --- a/lisp/gnus-soup.el +++ b/lisp/gnus-soup.el @@ -380,12 +380,12 @@ though the two last may be nil if they are missing." (push (vector (gnus-soup-field) (gnus-soup-field) (gnus-soup-field) - (and (eq (preceding-char) ?\t) + (and (eq (char-before) ?\t) (gnus-soup-field)) - (and (eq (preceding-char) ?\t) + (and (eq (char-before) ?\t) (string-to-int (gnus-soup-field)))) areas) - (when (eq (preceding-char) ?\t) + (when (eq (char-before) ?\t) (beginning-of-line 2))) (kill-buffer (current-buffer)))) areas)) @@ -403,7 +403,7 @@ file. The vector contain three strings, [prefix name encoding]." (push (vector (gnus-soup-field) (gnus-soup-field) (gnus-soup-field)) replies) - (when (eq (preceding-char) ?\t) + (when (eq (char-before) ?\t) (beginning-of-line 2))) (kill-buffer (current-buffer))) replies)) diff --git a/lisp/gnus-spec.el b/lisp/gnus-spec.el index 02acdda..2b06fa8 100644 --- a/lisp/gnus-spec.el +++ b/lisp/gnus-spec.el @@ -449,7 +449,7 @@ (push el flist))) (insert elem-type) (push (car elem) flist)))) - (setq fstring (buffer-substring (point-min) (point-max)))) + (setq fstring (buffer-string))) ;; Do some postprocessing to increase efficiency. (setq diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 2e378bb..d0dcc55 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -1101,7 +1101,7 @@ See `gnus-simplify-buffer-fuzzy' for details." (insert subject) (let ((gnus-simplify-subject-fuzzy-regexp fuzzy-regexp)) (inline (gnus-simplify-buffer-fuzzy))) - (buffer-substring (point-min) (point-max))))) + (buffer-string)))) (defsubst gnus-simplify-subject-fully (subject) "Simplify a subject string according to gnus-summary-gather-subject-limit." @@ -7363,7 +7363,7 @@ groups." (save-excursion (save-restriction (message-narrow-to-head) - (let ((head (buffer-substring (point-min) (point-max))) + (let ((head (buffer-string)) header) (nnheader-temp-write nil (insert (format "211 %d Article retrieved.\n" @@ -8184,14 +8184,15 @@ is non-nil or the Subject: of both articles are the same." (let (gnus-mark-article-hook) (gnus-summary-select-article t t nil current-article)) (set-buffer gnus-original-article-buffer) - (let ((buf (format "%s" (buffer-substring (point-min) (point-max))))) + (let ((buf (format "%s" (buffer-string)))) (nnheader-temp-write nil (insert buf) (goto-char (point-min)) (if (re-search-forward "^References: " nil t) (progn (re-search-forward "^[^ \t]" nil t) - (end-of-line 0) ;; Go to the end of the previous line. + (forward-line -1) + (end-of-line) (insert " " message-id)) (insert "References: " message-id "\n")) (unless (gnus-request-replace-article diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 7017aca..6c3400e 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -396,7 +396,7 @@ Cache the result as a text property stored in DATE." (goto-char (point-min)) (while (search-forward "%" nil t) (insert "%")) - (buffer-substring (point-min) (point-max)))) + (buffer-string))) ;; Make a hash table (default and minimum size is 256). ;; Optional argument HASHSIZE specifies the table size. diff --git a/lisp/gnus-xmas.el b/lisp/gnus-xmas.el index 2a2899a..26245b3 100644 --- a/lisp/gnus-xmas.el +++ b/lisp/gnus-xmas.el @@ -866,8 +866,7 @@ XEmacs compatibility workaround." (gnus-xmas-call-region "icontopbm") (gnus-xmas-call-region "ppmtoxpm") (make-glyph - (vector 'xpm :data - (buffer-substring (point-min) (point-max))))))) + (vector 'xpm :data (buffer-string)))))) (t (make-glyph [nothing])))) (ext (make-extent (progn diff --git a/lisp/gnus.el b/lisp/gnus.el index 94ac547..6c2812c 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -794,7 +794,7 @@ used to 899, you would say something along these lines: (set-buffer (gnus-get-buffer-create " *gnus nntp*")) (buffer-disable-undo (current-buffer)) (insert-file-contents gnus-nntpserver-file) - (let ((name (buffer-substring (point-min) (point-max)))) + (let ((name (buffer-string))) (prog1 (if (string-match "^[ \t\n]*$" name) nil diff --git a/lisp/md5.el b/lisp/md5.el index e68afe7..3fabf29 100644 --- a/lisp/md5.el +++ b/lisp/md5.el @@ -391,7 +391,7 @@ hash of a portion of OBJECT." (if (<= (point-max) md5-maximum-internal-length) (mapconcat (function (lambda (node) (format "%02x" node))) - (md5-encode (buffer-substring (point-min) (point-max))) + (md5-encode (buffer-string)) "") (call-process-region (point-min) (point-max) (or shell-file-name "/bin/sh") diff --git a/lisp/message.el b/lisp/message.el index aac2fa2..d00851b 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1204,11 +1204,14 @@ Return the number of headers removed." ;; There might be a continuation header, so we have to search ;; until we find a new non-continuation line. (progn - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (point)))) - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))))) + (forward-line 1) + (if (re-search-forward "^[^ \t]" nil t) + (goto-char (match-beginning 0)) + (point-max))))) + (forward-line 1) + (if (re-search-forward "^[^ \t]" nil t) + (goto-char (match-beginning 0)) + (point-max)))) number)) (defun message-narrow-to-headers () @@ -1255,9 +1258,11 @@ Return the number of headers removed." (defun message-next-header () "Go to the beginning of the next header." - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (not (eobp))) + (beginning-of-line) + (or (eobp) (forward-char 1)) + (not (if (re-search-forward "^[^ \t]" nil t) + (beginning-of-line) + (goto-char (point-max))))) (defun message-sort-headers-1 () "Sort the buffer as headers using `message-rank' text props." @@ -2307,7 +2312,7 @@ This sub function is for exclusive use of `message-send-mail'." (message-remove-header message-ignored-mail-headers t)) (goto-char (point-max)) ;; require one newline at the end. - (or (bolp) + (or (eq (char-before) ?\n) (insert ?\n)) (when (and news (or (message-fetch-field "cc") @@ -2337,7 +2342,7 @@ This sub function is for exclusive use of `message-send-mail'." (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (forward-char -1) + (backward-char 1) (setq delimline (point-marker)) (run-hooks 'message-send-mail-hook) ;; Insert an extra newline if we need it to work around @@ -2464,7 +2469,7 @@ to find out how to use this." (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (forward-char -1) + (backward-char 1) (run-hooks 'message-send-mail-hook) (if recipients (let ((result (smtp-via-smtp user-mail-address @@ -2543,7 +2548,7 @@ This sub function is for exclusive use of `message-send-news'." (message-remove-header message-ignored-news-headers t)) (goto-char (point-max)) ;; require one newline at the end. - (or (bolp) + (or (eq (char-before) ?\n) (insert ?\n)) (setq result (message-maybe-split-and-send-news method))) (kill-buffer tembuf)) @@ -2563,7 +2568,7 @@ This sub function is for exclusive use of `message-send-news'." (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (forward-char -1) + (backward-char 1) (run-hooks 'message-send-news-hook) ;;(require (car method)) ;;(funcall (intern (format "%s-open-server" (car method))) @@ -3083,7 +3088,7 @@ This sub function is for exclusive use of `message-send-news'." (while (re-search-forward "[\t\n]+" nil t) (replace-match "" t t)) (unless (zerop (buffer-size)) - (buffer-substring (point-min) (point-max)))))) + (buffer-string))))) (defun message-make-lines () "Count the number of lines and return numeric string." @@ -3201,7 +3206,7 @@ This sub function is for exclusive use of `message-send-news'." (replace-match "\\1(\\3)" t) (goto-char fullname-start))) (insert ")"))) - (buffer-substring (point-min) (point-max))))) + (buffer-string)))) (defun message-make-sender () "Return the \"real\" user address. @@ -3787,8 +3792,7 @@ OTHER-HEADERS is an alist of header/value pairs." (while (re-search-forward "[ \t]+" nil t) (replace-match " " t t)) ;; Remove addresses that match `rmail-dont-reply-to-names'. - (insert (prog1 (rmail-dont-reply-to (buffer-substring - (point-min) (point-max))) + (insert (prog1 (rmail-dont-reply-to (buffer-string)) (erase-buffer))) (goto-char (point-min)) ;; Perhaps Mail-Copies-To: never removed the only address? @@ -3798,8 +3802,7 @@ OTHER-HEADERS is an alist of header/value pairs." (mapcar (lambda (addr) (cons (mail-strip-quoted-names addr) addr)) - (message-tokenize-header (buffer-substring - (point-min) (point-max))))) + (message-tokenize-header (buffer-string)))) (let ((s ccalist)) (while s (setq ccalist (delq (assoc (car (pop s)) s) ccalist)))) @@ -4090,7 +4093,7 @@ header line with the old Message-ID." (while (re-search-backward "[ \t]+$" nil t) (replace-match "")) - (buffer-substring (point-min) (point-max)))) + (buffer-string))) ;;; Forwarding messages. diff --git a/lisp/nndb.el b/lisp/nndb.el index fd26cb1..007d8e5 100644 --- a/lisp/nndb.el +++ b/lisp/nndb.el @@ -287,7 +287,7 @@ Optional LAST is ignored." (nntp-send-buffer "^[23].*\n")) (set-buffer nntp-server-buffer) - (setq msg (buffer-substring (point-min) (point-max))) + (setq msg (buffer-string (point-min) (point-max))) (or (string-match "^\\([0-9]+\\)" msg) (error "nndb: %s" msg)) (setq art (substring msg (match-beginning 1) (match-end 1))) @@ -314,7 +314,7 @@ with the contents of the BUFFER." (deffoo nndb-status-message (&optional server) "Return server status as a string." (set-buffer nntp-server-buffer) - (buffer-substring (point-min) (point-max))) + (buffer-string (point-min) (point-max))) ;; Import stuff from nntp diff --git a/lisp/nnheader.el b/lisp/nnheader.el index ba0ef2f..2267749 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -538,7 +538,7 @@ If FILE is t, return the buffer contents as a string." ;; Return the buffer contents. ((eq ,temp-file t) (set-buffer ,temp-buffer) - (buffer-substring (point-min) (point-max))) + (buffer-string)) ;; Save a file. (t (set-buffer ,temp-buffer) diff --git a/lisp/nnmail.el b/lisp/nnmail.el index a6b2f2e..04478b0 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -740,9 +740,8 @@ If this variable is `t', do not use password cache.") (delete-region (point-min) (match-end 0))) (unless (yes-or-no-p (format "movemail: %s (%d return). Continue? " - (buffer-substring - (point-min) (point-max)) result)) - (error "%s" (buffer-substring (point-min) (point-max)))) + (buffer-string))) + (error "%s" (buffer-string))) (setq tofile nil))) )))) (nnmail-set-password inbox nnmail-internal-password) @@ -1802,10 +1801,9 @@ If ARGS, PROMPT is used as an argument to `format'." ;; Narrow to the status. (narrow-to-region (point) - (progn - (while (and (zerop (forward-line 1)) - (memq (char-after) '(?\t ?\ )))) - (point))) + (if (re-search-forward "^[^ \t]" nil t) + (1- (point)) + (point-max))) ;; Go through all elements and add them to the list. (goto-char (point-min)) (while (re-search-forward "[^ \t=]+" nil t) diff --git a/lisp/nnsoup.el b/lisp/nnsoup.el index bc12423..76160f9 100644 --- a/lisp/nnsoup.el +++ b/lisp/nnsoup.el @@ -687,7 +687,7 @@ backend for the messages.") (message-remove-header message-ignored-mail-headers t)) (goto-char (point-max)) ;; require one newline at the end. - (or (bolp) + (or (eq (char-before) ?\n) (insert ?\n)) (let ((case-fold-search t)) ;; Change header-delimiter to be what sendmail expects. @@ -695,7 +695,7 @@ backend for the messages.") (re-search-forward (concat "^" (regexp-quote real-header-separator) "\n")) (replace-match "\n") - (forward-char -1) + (backward-char 1) (setq delimline (point-marker)) ;; Insert an extra newline if we need it to work around ;; Sun's bug that swallows newlines. diff --git a/lisp/nnspool.el b/lisp/nnspool.el index b6b9ad5..a1154b6 100644 --- a/lisp/nnspool.el +++ b/lisp/nnspool.el @@ -342,8 +342,7 @@ there.") ;; Make status message by folding lines. (while (re-search-forward "[ \t\n]+" nil t) (replace-match " " t t)) - (nnheader-report 'nnspool "%s" (buffer-substring - (point-min) (point-max))) + (nnheader-report 'nnspool "%s" (buffer-string)) (nnheader-message 5 "nnspool: %s" nnspool-status-string) (ding) (run-hooks 'nnspool-rejected-article-hook)))) diff --git a/lisp/nntp.el b/lisp/nntp.el index a123a33..9f2be03 100644 --- a/lisp/nntp.el +++ b/lisp/nntp.el @@ -906,7 +906,7 @@ password contained in '~/.nntp-authinfo'." (defun nntp-read-server-type () "Find out what the name of the server we have connected to is." ;; Wait for the status string to arrive. - (setq nntp-server-type (buffer-substring (point-min) (point-max))) + (setq nntp-server-type (buffer-string)) (let ((alist nntp-server-action-alist) (case-fold-search t) entry) @@ -956,7 +956,7 @@ password contained in '~/.nntp-authinfo'." (defun nntp-snarf-error-message () "Save the error message in the current buffer." - (let ((message (buffer-substring (point-min) (point-max)))) + (let ((message (buffer-string))) (while (string-match "[\r\n]+" message) (setq message (replace-match " " t t message))) (nnheader-report 'nntp message) diff --git a/lisp/pop3-fma.el b/lisp/pop3-fma.el index 89a05a1..96a82c0 100644 --- a/lisp/pop3-fma.el +++ b/lisp/pop3-fma.el @@ -248,7 +248,7 @@ If there is any problem , please set this variable to nil(default). pop3-fma-movemail-program) nil movemail-output-buffer nil pop3-fma-commandline-arguments) - (let ((string (buffer-substring (point-min) (point-max)))) + (let ((string (buffer-string))) (if (> (length string) 0) (progn (if (y-or-n-p -- 1.7.10.4