* gnus-sum.el (gnus-highlight-selected-summary)
authorJesper Harder <harder@ifa.au.dk>
Mon, 3 Mar 2003 05:39:44 +0000 (05:39 +0000)
committerJesper Harder <harder@ifa.au.dk>
Mon, 3 Mar 2003 05:39:44 +0000 (05:39 +0000)
(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.

16 files changed:
lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-cache.el
lisp/gnus-cite.el
lisp/gnus-draft.el
lisp/gnus-group.el
lisp/gnus-score.el
lisp/gnus-sum.el
lisp/gnus-util.el
lisp/gnus-xmas.el
lisp/nnfolder.el
lisp/nnheader.el
lisp/nnmail.el
lisp/nnmbox.el
lisp/nnml.el
lisp/nntp.el

index 70a87aa..b566fdf 100644 (file)
@@ -1,3 +1,36 @@
+2003-03-03  Jesper Harder  <harder@ifa.au.dk>
+
+       * 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  <kgreiner@xpediantsolutions.com>
 
        * nntp.el (nntp-possibly-change-group): Avoid calling
index 59c40e9..85d619c 100644 (file)
@@ -1588,7 +1588,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)
@@ -1704,7 +1704,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)
@@ -4239,16 +4239,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
index e293a80..6431c81 100644 (file)
@@ -462,8 +462,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)
@@ -514,7 +513,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)
index 50ab6c1..3d9a1a2 100644 (file)
@@ -372,7 +372,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))
@@ -723,7 +723,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.
index 3dbcb7c..cbde8b0 100644 (file)
             (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
index bdb2df6..cf61197 100644 (file)
@@ -1450,7 +1450,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))
index 7733f9d..41adecb 100644 (file)
@@ -1818,7 +1818,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))
index cc9023b..790bc28 100644 (file)
@@ -5862,8 +5862,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)
@@ -10303,8 +10302,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?
@@ -11055,8 +11054,8 @@ If REVERSE, save parts that do not match TYPE."
   ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
   (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 <dugan@bucrf16.bu.edu>.
             (from (if (get-text-property beg gnus-mouse-face-prop)
                       beg
index 7756314..4242d0e 100644 (file)
 
 ;; 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)
index e5ae345..1806ceb 100644 (file)
@@ -728,7 +728,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
index e091843..ce3da7e 100644 (file)
@@ -202,7 +202,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
@@ -212,7 +212,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.
@@ -285,9 +285,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)
@@ -483,8 +482,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)
index e3cbb4a..f80f788 100644 (file)
@@ -497,8 +497,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)
@@ -600,7 +599,7 @@ the line could be found."
       ;; 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
index c4a347f..81b1b20 100644 (file)
@@ -1038,7 +1038,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))
@@ -1532,8 +1532,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.
index b3003cb..4569dbd 100644 (file)
        (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)
   (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
index 25b3913..e5dbd10 100644 (file)
@@ -418,8 +418,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...)
@@ -692,7 +691,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."
index dccd3ab..740cd43 100644 (file)
@@ -1074,7 +1074,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.