From: yamaoka Date: Thu, 13 May 1999 12:35:52 +0000 (+0000) Subject: Speedups; see ChangeLog for fine details. X-Git-Tag: t-gnus-6_10_064-03~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=688636e75e02be0a1c319f546ec388ed9ec10a85;p=elisp%2Fgnus.git- Speedups; see ChangeLog for fine details. --- diff --git a/lisp/base64.el b/lisp/base64.el index 12b4ca9..cbbc58e 100644 --- a/lisp/base64.el +++ b/lisp/base64.el @@ -93,7 +93,8 @@ base64-encoder-program.") t) (t (save-excursion (set-buffer (find-file-noselect tempfile)) - (setq errstring (buffer-string)) + (setq errstring (buffer-substring + (point-min) (point-max))) (kill-buffer nil) (cons status errstring))))) (ignore-errors @@ -251,7 +252,7 @@ base64-encoder-program.") (skip-chars-backward " \t\r\n") (delete-region (point-max) (point)) (prog1 - (buffer-string) + (buffer-substring (point-min) (point-max)) (kill-buffer (current-buffer))))) (defun base64-decode (string) @@ -264,7 +265,7 @@ base64-encoder-program.") (skip-chars-backward " \t\r\n") (delete-region (point-max) (point)) (prog1 - (buffer-string) + (buffer-substring (point-min) (point-max)) (kill-buffer (current-buffer))))) (fset 'base64-decode-string 'base64-decode) diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index e2b30e4..20e2de4 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -119,7 +119,7 @@ Modify to suit your needs.")) (with-temp-buffer (let ((standard-output (current-buffer))) (Custom-make-dependencies ".")) - (message (buffer-string))) + (message (buffer-substring (point-min) (point-max)))) (require 'cus-load) (byte-compile-file "custom-load.el") diff --git a/lisp/format-spec.el b/lisp/format-spec.el index 8986dc0..241e9dc 100644 --- a/lisp/format-spec.el +++ b/lisp/format-spec.el @@ -52,7 +52,7 @@ to values." ;; Signal an error on bogus format strings. (t (error "Invalid format string")))) - (buffer-string))) + (buffer-substring (point-min) (point-max)))) (defun format-spec-make (&rest pairs) "Return an alist suitable for use in `format-spec' based on PAIRS. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 8902c90..d812a27 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -1083,8 +1083,9 @@ Initialized from `text-mode-syntax-table.") ;; `gnus-ignored-headers' and `gnus-visible-headers' to ;; select which header lines is to remain visible in the ;; article buffer. - (while (re-search-forward "^[^ \t]*:" nil t) - (beginning-of-line) + (while (memq (char-after) '(?\t ?\ )) + (forward-line 1)) + (while (not (eobp)) ;; Mark the rank of the header. (put-text-property (point) (1+ (point)) 'message-rank @@ -1093,7 +1094,9 @@ Initialized from `text-mode-syntax-table.") (not (looking-at ignored)))) (gnus-article-header-rank) (+ 2 max))) - (forward-line 1)) + (forward-line 1) + (while (memq (char-after) '(?\t ?\ )) + (forward-line 1))) (message-sort-headers-1) (when (setq beg (text-property-any (point-min) (point-max) 'message-rank (+ 2 max))) @@ -1130,12 +1133,11 @@ always hide." (while (re-search-forward "^[^: \t]+:[ \t]*\n[^ \t]" nil t) (forward-line -1) (gnus-article-hide-text-type - (progn (beginning-of-line) (point)) + (point) (progn - (end-of-line) - (if (re-search-forward "^[^ \t]" nil t) - (match-beginning 0) - (point-max))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (point)) 'boring-headers))) ;; Hide boring Newsgroups header. ((eq elem 'newsgroups) @@ -1191,10 +1193,9 @@ always hide." (gnus-article-hide-text-type (progn (beginning-of-line) (point)) (progn - (end-of-line) - (if (re-search-forward "^[^ \t]" nil t) - (match-beginning 0) - (point-max))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (point)) 'boring-headers)))) (defvar gnus-article-normalized-header-length 40 @@ -3843,7 +3844,7 @@ groups." "Exit the article editing without updating." (interactive) ;; We remove all text props from the article buffer. - (let ((buf (format "%s" (buffer-string))) + (let ((buf (format "%s" (buffer-substring (point-min) (point-max)))) (curbuf (current-buffer)) (p (point)) (window-start (window-start))) @@ -3941,7 +3942,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-string))) + (setq buf (format "%s" (buffer-substring (point-min) (point-max)))) (set-buffer (get-buffer-create gnus-original-article-buffer)) (erase-buffer) (insert buf) @@ -4154,9 +4155,11 @@ do the highlighting. See the documentation for those functions." (when (and field-face (not (memq (setq from (point)) fpoints))) (push from fpoints) - (if (re-search-forward "^[^ \t]" nil t) - (forward-char -2) - (goto-char (point-max))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (unless (eobp) + ;; Go to the end of the previous line. + (end-of-line 0)) (gnus-put-text-property from (point) 'face field-face)))))))) (defun gnus-article-highlight-signature () @@ -4247,9 +4250,9 @@ specified by `gnus-button-alist'." (while (re-search-forward (car entry) nil t) ;; Each header matching the entry. (setq beg (match-beginning 0)) - (setq end (or (and (re-search-forward "^[^ \t]" nil t) - (match-beginning 0)) - (point-max))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (setq end (point)) (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 6121552..73f8e16 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-string)) + (gnus-kill-file-apply-string (buffer-substring (point-min) (point-max))) (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 6fabb5c..0e73190 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-string))) + (message "%s" (buffer-substring (point-min) (point-max)))) (kill-buffer errbuf)))) (setq gnus-newsgroup-last-folder folder))) diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index 186810c..431a1cd 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -471,7 +471,7 @@ header line with the old Message-ID." (gnus-remove-text-with-property 'gnus-next) (insert (prog1 - (format "%s" (buffer-string)) + (format "%s" (buffer-substring (point-min) (point-max))) (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 38de8df..f3365ee 100644 --- a/lisp/gnus-picon.el +++ b/lisp/gnus-picon.el @@ -325,7 +325,7 @@ arguments necessary for the job.") (let ((article-goto-body-goes-to-point-min-p nil)) (article-goto-body)) (unless (bobp) - (backward-char 1))))) + (forward-char -1))))) (if (null gnus-picons-piconsearch-url) (gnus-picons-display-pairs (gnus-picons-lookup-pairs @@ -506,7 +506,8 @@ 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-string)))))) + (t (make-glyph (vector type :data (buffer-substring + (point-min) (point-max))))))) ;;; Parsing of piconsearch result page. diff --git a/lisp/gnus-spec.el b/lisp/gnus-spec.el index ca97b05..fb89ee2 100644 --- a/lisp/gnus-spec.el +++ b/lisp/gnus-spec.el @@ -467,7 +467,7 @@ by `gnus-xmas-redefine'." (push el flist))) (insert elem-type) (push (car elem) flist)))) - (setq fstring (buffer-string))) + (setq fstring (buffer-substring (point-min) (point-max)))) ;; Do some postprocessing to increase efficiency. (setq diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 4608511..247f262 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -1155,7 +1155,7 @@ See `gnus-simplify-buffer-fuzzy' for details." (setq subject (substring subject (match-end 0)))) (insert subject) (inline (gnus-simplify-buffer-fuzzy)) - (buffer-string)))) + (buffer-substring (point-min) (point-max))))) (defsubst gnus-simplify-subject-fully (subject) "Simplify a subject string according to gnus-summary-gather-subject-limit." @@ -7535,7 +7535,7 @@ groups." (save-excursion (save-restriction (message-narrow-to-head) - (let ((head (buffer-string)) + (let ((head (buffer-substring (point-min) (point-max))) header) (with-temp-buffer (insert (format "211 %d Article retrieved.\n" @@ -8352,8 +8352,7 @@ is non-nil or the Subject: of both articles are the same." (if (re-search-forward "^References: " nil t) (progn (re-search-forward "^[^ \t]" nil t) - (forward-line -1) - (end-of-line) + (end-of-line 0) ;; Go to the end of the previous line. (insert " " message-id)) (insert "References: " message-id "\n"))) (set-buffer gnus-summary-buffer) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index fd4f927..bf6315d 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -332,7 +332,7 @@ Cache the result as a text property stored in DATE." (goto-char (point-min)) (while (search-forward "%" nil t) (insert "%")) - (buffer-string))) + (buffer-substring (point-min) (point-max)))) ;; 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 bca3843..e804c7a 100644 --- a/lisp/gnus-xmas.el +++ b/lisp/gnus-xmas.el @@ -823,7 +823,8 @@ XEmacs compatibility workaround." (gnus-xmas-call-region "icontopbm") (gnus-xmas-call-region "ppmtoxpm") (make-glyph - (vector 'xpm :data (buffer-string)))))) + (vector 'xpm :data (buffer-substring + (point-min) (point-max))))))) (t (make-glyph [nothing])))) (ext (make-extent (progn diff --git a/lisp/gnus.el b/lisp/gnus.el index aacf8ae..d1bd765 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -267,7 +267,7 @@ is restarted, and sometimes reloaded." (defconst gnus-version-number "6.10.064" "Version number for this version of gnus.") -(defconst gnus-revision-number "02" +(defconst gnus-revision-number "03" "Revision number for this version of gnus.") (defconst gnus-original-version-number "0.84" @@ -876,7 +876,7 @@ used to 899, you would say something along these lines: (save-excursion (set-buffer (gnus-get-buffer-create " *gnus nntp*")) (insert-file-contents gnus-nntpserver-file) - (let ((name (buffer-string))) + (let ((name (buffer-substring (point-min) (point-max)))) (prog1 (if (string-match "\\'[ \t\n]*$" name) nil diff --git a/lisp/mail-source.el b/lisp/mail-source.el index acd758c..6bfd153 100644 --- a/lisp/mail-source.el +++ b/lisp/mail-source.el @@ -273,8 +273,9 @@ Pass INFO on to CALLBACK." (delete-region (point-min) (match-end 0))) (unless (yes-or-no-p (format "movemail: %s (%d return). Continue? " - (buffer-string) result)) - (error "%s" (buffer-string))) + (buffer-substring (point-min) (point-max)) + result)) + (error "%s" (buffer-substring (point-min) (point-max)))) (setq to nil))))))) (when (and errors (buffer-name errors)) diff --git a/lisp/md5.el b/lisp/md5.el index 91a3041..8823f30 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-string)) + (md5-encode (buffer-substring (point-min) (point-max))) "") (call-process-region (point-min) (point-max) (or shell-file-name "/bin/sh") diff --git a/lisp/message.el b/lisp/message.el index a040cc1..9a69178 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1330,14 +1330,11 @@ 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 - (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)) - (goto-char (point-max))))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (point)))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))))) number)) (defun message-remove-first-header (header) @@ -1412,11 +1409,9 @@ Point is left at the beginning of the narrowed-to region." (defun message-next-header () "Go to the beginning of the next header." - (beginning-of-line) - (or (eobp) (forward-char 1)) - (not (if (re-search-forward "^[^ \t]" nil t) - (beginning-of-line) - (goto-char (point-max))))) + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (not (eobp))) (defun message-sort-headers-1 () "Sort the buffer as headers using `message-rank' text props." @@ -2503,7 +2498,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 (= (preceding-char) ?\n) + (or (bolp) (insert ?\n)) (when (and news (or (message-fetch-field "cc") @@ -2533,7 +2528,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") - (backward-char 1) + (forward-char -1) (setq delimline (point-marker)) (run-hooks 'message-send-mail-hook) ;; Insert an extra newline if we need it to work around @@ -2591,7 +2586,7 @@ to find out how to use this." (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (backward-char 1) + (forward-char -1) (run-hooks 'message-send-mail-hook) ;; send the message (case @@ -2661,7 +2656,7 @@ to find out how to use this." (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (backward-char 1) + (forward-char -1) (run-hooks 'message-send-mail-hook) (if recipients (let ((result (smtp-via-smtp user-mail-address @@ -2737,7 +2732,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 (= (preceding-char) ?\n) + (or (bolp) (insert ?\n)) (setq result (message-maybe-split-and-send-news method))) (kill-buffer tembuf)) @@ -2757,7 +2752,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") - (backward-char 1) + (forward-char -1) (run-hooks 'message-send-news-hook) (gnus-open-server method) (gnus-request-post method) @@ -3280,7 +3275,7 @@ If NOW, use that time instead." (while (re-search-forward "[\t\n]+" nil t) (replace-match "" t t)) (unless (zerop (buffer-size)) - (buffer-string))))) + (buffer-substring (point-min) (point-max)))))) (defun message-make-lines () "Count the number of lines and return numeric string." @@ -3393,7 +3388,7 @@ If NOW, use that time instead." (replace-match "\\1(\\3)" t) (goto-char fullname-start))) (insert ")"))) - (buffer-string)))) + (buffer-substring (point-min) (point-max))))) (defun message-make-sender () "Return the \"real\" user address. @@ -4059,7 +4054,8 @@ that further discussion should take place only in " (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-string)) + (insert (prog1 (rmail-dont-reply-to (buffer-substring + (point-min) (point-max))) (erase-buffer))) (goto-char (point-min)) ;; Perhaps Mail-Copies-To: never removed the only address? @@ -4069,7 +4065,8 @@ that further discussion should take place only in " (mapcar (lambda (addr) (cons (mail-strip-quoted-names addr) addr)) - (message-tokenize-header (buffer-string)))) + (message-tokenize-header (buffer-substring + (point-min) (point-max))))) (let ((s ccalist)) (while s (setq ccalist (delq (assoc (car (pop s)) s) ccalist))))) @@ -4407,7 +4404,7 @@ header line with the old Message-ID." (while (re-search-backward "[ \t]+$" nil t) (replace-match "")) - (buffer-string))) + (buffer-substring (point-min) (point-max)))) ;;; Forwarding messages. diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 6f0045f..cf222cc 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1476,9 +1476,10 @@ See the documentation for the variable `nnmail-split-fancy' for documentation." ;; Narrow to the status. (narrow-to-region (point) - (if (re-search-forward "^[^ \t]" nil t) - (1- (point)) - (point-max))) + (progn + (while (and (zerop (forward-line 1)) + (memq (char-after) '(?\t ?\ )))) + (point))) ;; 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 031c0ac..8f4dd18 100644 --- a/lisp/nnsoup.el +++ b/lisp/nnsoup.el @@ -688,7 +688,7 @@ backend for the messages.") (message-remove-header message-ignored-mail-headers t)) (goto-char (point-max)) ;; require one newline at the end. - (or (= (preceding-char) ?\n) + (or (bolp) (insert ?\n)) (let ((case-fold-search t)) ;; Change header-delimiter to be what sendmail expects. @@ -696,7 +696,7 @@ backend for the messages.") (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") - (backward-char 1) + (forward-char -1) (setq delimline (point-marker)) (goto-char (1+ delimline)) (let ((msg-buf diff --git a/lisp/nnspool.el b/lisp/nnspool.el index 106aee0..2208af7 100644 --- a/lisp/nnspool.el +++ b/lisp/nnspool.el @@ -345,7 +345,8 @@ there.") ;; Make status message by folding lines. (while (re-search-forward "[ \t\n]+" nil t) (replace-match " " t t)) - (nnheader-report 'nnspool "%s" (buffer-string)) + (nnheader-report 'nnspool "%s" (buffer-substring + (point-min) (point-max))) (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 e60dd86..099054e 100644 --- a/lisp/nntp.el +++ b/lisp/nntp.el @@ -911,7 +911,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-string)) + (setq nntp-server-type (buffer-substring (point-min) (point-max))) (let ((alist nntp-server-action-alist) (case-fold-search t) entry) @@ -1022,7 +1022,7 @@ password contained in '~/.nntp-authinfo'." (defun nntp-snarf-error-message () "Save the error message in the current buffer." - (let ((message (buffer-string))) + (let ((message (buffer-substring (point-min) (point-max)))) (while (string-match "[\r\n]+" message) (setq message (replace-match " " t t message))) (nnheader-report 'nntp message)