From d1a0a596d0dea53552b13d39262763dedc3380fe Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 3 Mar 2003 05:34:38 +0000 Subject: [PATCH] Synch to Oort Gnus. --- lisp/ChangeLog | 33 +++++++++++++++++++++++++++++++++ lisp/gnus-art.el | 10 ++++------ lisp/gnus-cache.el | 5 ++--- lisp/gnus-cite.el | 4 ++-- lisp/gnus-draft.el | 3 +-- lisp/gnus-group.el | 2 +- lisp/gnus-score.el | 2 +- lisp/gnus-sum.el | 11 +++++------ lisp/gnus-util.el | 2 +- lisp/gnus-xmas.el | 2 +- lisp/nnfolder.el | 12 +++++------- lisp/nnheader.el | 5 ++--- lisp/nnmail.el | 5 ++--- lisp/nnmbox.el | 7 ++----- lisp/nnml.el | 5 ++--- lisp/nntp.el | 2 +- 16 files changed, 65 insertions(+), 45 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70a87aa..b566fdf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,36 @@ +2003-03-03 Jesper Harder + + * gnus-sum.el (gnus-highlight-selected-summary) + (gnus-article-get-xrefs, gnus-summary-show-thread): Use + `gnus-point-at-bol' and `gnus-point-at-eol' instead of + `(progn (beginning-of-line) (point))'. It's shorter, faster, + and makes it clear that we don't need the side effect. + * gnus-util.el (gnus-delete-line): do. + * gnus-xmas.el (gnus-group-add-icon): do. + * nnmail.el (nnmail-article-group, nnmail-cache-fetch-group): do. + * nntp.el (nntp-send-authinfo-from-file): do. + * nnml.el (nnml-header-value): do. + * nnheader.el (nnheader-insert-references): do. + * gnus-cite.el (gnus-article-highlight-citation) + (gnus-cite-parse): do. + * gnus-score.el (gnus-score-followup): do. + * gnus-draft.el (gnus-draft-send): do. + * gnus-group.el (gnus-group-highlight-line): do. + * gnus-cache.el (gnus-cache-braid-nov): do. + * nnfolder.el (nnfolder-retrieve-headers) + (nnfolder-request-article): do. + * gnus-art.el (article-hide-boring-headers) + (gnus-article-hide-header): do. + + * nnheader.el (nnheader-find-nov-line): Use gnus-delete-line. + * nnml.el (nnml-request-replace-article): do. + * nnmbox.el (nnmbox-request-move-article, nnmbox-delete-mail): do. + * nnfolder.el (nnfolder-request-move-article): do. + * gnus-cache.el (gnus-cache-possibly-remove-article): do. + * gnus-art.el (gnus-mm-display-part): do. + + * gnus-art.el (gnus-article-goto-part): Use gnus-goto-char. + 2003-03-02 Kevin Greiner * nntp.el (nntp-possibly-change-group): Avoid calling diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 6be9b98..b7e9051 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -1704,7 +1704,7 @@ 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)) + (gnus-point-at-bol) (progn (end-of-line) (if (re-search-forward "^[^ \t]" nil t) @@ -1820,7 +1820,7 @@ always hide." (goto-char (point-min)) (when (re-search-forward (concat "^" header ":") nil t) (gnus-article-hide-text-type - (progn (beginning-of-line) (point)) + (gnus-point-at-bol) (progn (end-of-line) (if (re-search-forward "^[^ \t]" nil t) @@ -4608,16 +4608,14 @@ If no internal viewer is available, use an external viewer." (if (window-live-p window) (select-window window))))) (goto-char point) - (delete-region (gnus-point-at-bol) (progn (forward-line 1) (point))) + (gnus-delete-line) (gnus-insert-mime-button handle id (list (mm-handle-displayed-p handle))) (goto-char point)))) (defun gnus-article-goto-part (n) "Go to MIME part N." - (let ((point (text-property-any (point-min) (point-max) 'gnus-part n))) - (when point - (goto-char point)))) + (gnus-goto-char (text-property-any (point-min) (point-max) 'gnus-part n))) (defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed) (let ((gnus-tmp-name diff --git a/lisp/gnus-cache.el b/lisp/gnus-cache.el index 60e78fe..e9733a2 100644 --- a/lisp/gnus-cache.el +++ b/lisp/gnus-cache.el @@ -467,8 +467,7 @@ Returns the list of articles removed." (when (or (looking-at (concat (int-to-string number) "\t")) (search-forward (concat "\n" (int-to-string number) "\t") (point-max) t)) - (delete-region (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point))))) + (gnus-delete-line))) (unless (setq gnus-newsgroup-cached (delq article gnus-newsgroup-cached)) (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb) @@ -518,7 +517,7 @@ Returns the list of articles removed." (set-buffer cache-buf) (if (search-forward (concat "\n" (int-to-string (car cached)) "\t") nil t) - (setq beg (progn (beginning-of-line) (point)) + (setq beg (gnus-point-at-bol) end (progn (end-of-line) (point))) (setq beg nil)) (set-buffer nntp-server-buffer) diff --git a/lisp/gnus-cite.el b/lisp/gnus-cite.el index 8a9f141..1697a79 100644 --- a/lisp/gnus-cite.el +++ b/lisp/gnus-cite.el @@ -373,7 +373,7 @@ Lines matching `gnus-cite-attribution-suffix' and perhaps (goto-char (point-min)) (forward-line (1- number)) (when (re-search-forward gnus-cite-attribution-suffix - (save-excursion (end-of-line 1) (point)) + (gnus-point-at-eol) t) (gnus-article-add-button (match-beginning 1) (match-end 1) 'gnus-cite-toggle prefix)) @@ -724,7 +724,7 @@ See also the documentation for `gnus-article-highlight-citation'." ;; Each line. (setq begin (point) guess-limit (progn (skip-chars-forward "^> \t\r\n") (point)) - end (progn (beginning-of-line 2) (point)) + end (gnus-point-at-bol 2) start end) (goto-char begin) ;; Ignore standard Supercite attribution prefix. diff --git a/lisp/gnus-draft.el b/lisp/gnus-draft.el index 3b29cc8..4d0bbf0 100644 --- a/lisp/gnus-draft.el +++ b/lisp/gnus-draft.el @@ -151,8 +151,7 @@ (concat "^" (regexp-quote gnus-agent-target-move-group-header) ":") nil t) (skip-syntax-forward "-") - (setq move-to (buffer-substring (point) (progn (end-of-line) - (point)))) + (setq move-to (buffer-substring (point) (gnus-point-at-eol))) (message-remove-header gnus-agent-target-move-group-header)) (goto-char (point-min)) (when (re-search-forward diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index 77c41a5..09d7a92 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -1491,7 +1491,7 @@ if it is a string, only list groups matching REGEXP." "Highlight the current line according to `gnus-group-highlight'." (let* ((list gnus-group-highlight) (p (point)) - (end (progn (end-of-line) (point))) + (end (gnus-point-at-eol)) ;; now find out where the line starts and leave point there. (beg (progn (beginning-of-line) (point))) (group (gnus-group-group-name)) diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el index abb791e..4a6bea4 100644 --- a/lisp/gnus-score.el +++ b/lisp/gnus-score.el @@ -1853,7 +1853,7 @@ score in `gnus-newsgroup-scored' by SCORE." (goto-char (point-min)) (if (= dmt ?e) (while (funcall search-func match nil t) - (and (= (progn (beginning-of-line) (point)) + (and (= (gnus-point-at-bol) (match-beginning 0)) (= (progn (end-of-line) (point)) (match-end 0)) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 9096da3..7538791 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -5871,8 +5871,7 @@ This is meant to be called in `gnus-article-internal-prepare-hook'." (looking-at "Xref:")) (search-forward "\nXref:" nil t)) (goto-char (1+ (match-end 0))) - (setq xref (buffer-substring (point) - (progn (end-of-line) (point)))) + (setq xref (buffer-substring (point) (gnus-point-at-eol))) (mail-header-set-xref headers xref))))))) (defun gnus-summary-insert-subject (id &optional old-header use-old-header) @@ -10393,8 +10392,8 @@ Returns nil if no thread was there to be shown." (interactive) (let ((buffer-read-only nil) (orig (point)) - ;; first goto end then to beg, to have point at beg after let - (end (progn (end-of-line) (point))) + (end (gnus-point-at-eol)) + ;; Leave point at bol (beg (progn (beginning-of-line) (point)))) (prog1 ;; Any hidden lines here? @@ -11145,8 +11144,8 @@ If REVERSE, save parts that do not match TYPE." ;; Added by Per Abrahamsen . (when gnus-summary-selected-face (save-excursion - (let* ((beg (progn (beginning-of-line) (point))) - (end (progn (end-of-line) (point))) + (let* ((beg (gnus-point-at-bol)) + (end (gnus-point-at-eol)) ;; Fix by Mike Dugan . (from (if (get-text-property beg gnus-mouse-face-prop) beg diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 3c93af5..e7ffc74 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -174,7 +174,7 @@ ;; Delete the current line (and the next N lines). (defmacro gnus-delete-line (&optional n) - `(delete-region (progn (beginning-of-line) (point)) + `(delete-region (gnus-point-at-bol) (progn (forward-line ,(or n 1)) (point)))) (defun gnus-byte-code (func) diff --git a/lisp/gnus-xmas.el b/lisp/gnus-xmas.el index ac2219b..7387944 100644 --- a/lisp/gnus-xmas.el +++ b/lisp/gnus-xmas.el @@ -805,7 +805,7 @@ XEmacs compatibility workaround." (defun gnus-group-add-icon () "Add an icon to the current line according to `gnus-group-icon-list'." (let* ((p (point)) - (end (progn (end-of-line) (point))) + (end (gnus-point-at-eol)) ;; now find out where the line starts and leave point there. (beg (progn (beginning-of-line) (point)))) (save-restriction diff --git a/lisp/nnfolder.el b/lisp/nnfolder.el index eb3a75d..448ada4 100644 --- a/lisp/nnfolder.el +++ b/lisp/nnfolder.el @@ -204,7 +204,7 @@ the group. Then the marks file will be regenerated properly by Gnus.") (goto-char (match-end 0)) (setq num (string-to-int (buffer-substring - (point) (progn (end-of-line) (point))))) + (point) (gnus-point-at-eol)))) (goto-char start) (< num article))) ;; Check that we are before an article with a @@ -214,7 +214,7 @@ the group. Then the marks file will be regenerated properly by Gnus.") (progn (setq num (string-to-int (buffer-substring - (point) (progn (end-of-line) (point))))) + (point) (gnus-point-at-eol)))) (> num article)) ;; Discard any article numbers before the one we're ;; now looking at. @@ -287,9 +287,8 @@ the group. Then the marks file will be regenerated properly by Gnus.") (cons nnfolder-current-group (if (search-forward (concat "\n" nnfolder-article-marker) nil t) - (string-to-int - (buffer-substring - (point) (progn (end-of-line) (point)))) + (string-to-int (buffer-substring + (point) (gnus-point-at-eol))) -1)))))))) (deffoo nnfolder-request-group (group &optional server dont-check) @@ -485,8 +484,7 @@ the group. Then the marks file will be regenerated properly by Gnus.") (concat "^" nnfolder-article-marker) (save-excursion (and (search-forward "\n\n" nil t) (point))) t) - (delete-region (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point)))) + (gnus-delete-line)) (setq result (eval accept-form)) (kill-buffer buf) result) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 3a8a179..3367820 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -888,8 +888,7 @@ the line could be found." (setq prev (point)) (while (and (not (numberp (setq num (read cur)))) (not (eobp))) - (delete-region (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point)))) + (gnus-delete-line)) (cond ((> num article) (setq max (point))) ((< num article) @@ -1176,7 +1175,7 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')." ;; This is invalid, but not all articles have Message-IDs. () (mail-position-on-field "References") - (let ((begin (save-excursion (beginning-of-line) (point))) + (let ((begin (gnus-point-at-bol)) (fill-column 78) (fill-prefix "\t")) (when references diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 19de868..79e8415 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -1039,7 +1039,7 @@ FUNC will be called with the group name to determine the article number." (while (not (eobp)) (unless (< (move-to-column nnmail-split-header-length-limit) nnmail-split-header-length-limit) - (delete-region (point) (progn (end-of-line) (point)))) + (delete-region (point) (gnus-point-at-eol))) (forward-line 1)) ;; Allow washing. (goto-char (point-min)) @@ -1533,8 +1533,7 @@ See the documentation for the variable `nnmail-split-fancy' for details." (skip-chars-forward "^\n\r\t") (unless (looking-at "[\r\n]") (forward-char 1) - (buffer-substring (point) - (progn (end-of-line) (point)))))))) + (buffer-substring (point) (gnus-point-at-eol))))))) ;; Function for nnmail-split-fancy: look up all references in the ;; cache and if a match is found, return that group. diff --git a/lisp/nnmbox.el b/lisp/nnmbox.el index fe4a30b..3cb586f 100644 --- a/lisp/nnmbox.el +++ b/lisp/nnmbox.el @@ -299,8 +299,7 @@ (while (re-search-forward "^X-Gnus-Newsgroup:" (save-excursion (search-forward "\n\n" nil t) (point)) t) - (delete-region (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point)))) + (gnus-delete-line)) (setq result (eval accept-form)) (kill-buffer buf) result) @@ -425,9 +424,7 @@ (if (not force) (nnmbox-record-deleted-article (nnmbox-article-group-number t))) (or force - (delete-region - (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point)))) + (gnus-delete-line)) ;; Beginning of the article. (save-excursion (save-restriction diff --git a/lisp/nnml.el b/lisp/nnml.el index 60595dd..d2f985e 100644 --- a/lisp/nnml.el +++ b/lisp/nnml.el @@ -424,8 +424,7 @@ marks file will be regenerated properly by Gnus.") (if (or (looking-at art) (search-forward (concat "\n" art) nil t)) ;; Delete the old NOV line. - (delete-region (progn (beginning-of-line) (point)) - (progn (forward-line 1) (point))) + (gnus-delete-line) ;; The line isn't here, so we have to find out where ;; we should insert it. (This situation should never ;; occur, but one likes to make sure...) @@ -699,7 +698,7 @@ marks file will be regenerated properly by Gnus.") (nnheader-insert-nov headers))) (defsubst nnml-header-value () - (buffer-substring (match-end 0) (progn (end-of-line) (point)))) + (buffer-substring (match-end 0) (gnus-point-at-eol))) (defun nnml-parse-head (chars &optional number) "Parse the head of the current buffer." diff --git a/lisp/nntp.el b/lisp/nntp.el index fb1bca6..bad9fa1 100644 --- a/lisp/nntp.el +++ b/lisp/nntp.el @@ -1141,7 +1141,7 @@ password contained in '~/.nntp-authinfo'." (nntp-send-command "^3.*\r?\n" "AUTHINFO USER" (user-login-name)) (nntp-send-command "^2.*\r?\n" "AUTHINFO PASS" - (buffer-substring (point) (progn (end-of-line) (point))))))) + (buffer-substring (point) (gnus-point-at-eol)))))) ;;; Internal functions. -- 1.7.10.4