diff lisp/mh-e/mh-search.el @ 90291:d6f8fe3307c8

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-11 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 34-42) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 14-17) - Update from CVS - Merge from emacs--devo--0
author Miles Bader <miles@gnu.org>
date Sat, 04 Feb 2006 01:01:38 +0000
parents 52ef8d8ecd83
children 156eafa22e3e
line wrap: on
line diff
--- a/lisp/mh-e/mh-search.el	Fri Feb 03 07:38:00 2006 +0000
+++ b/lisp/mh-e/mh-search.el	Sat Feb 04 01:01:38 2006 +0000
@@ -51,7 +51,6 @@
 
 (require 'gnus-util)
 (require 'imenu)
-(require 'which-func nil t)
 
 (defvar mh-searcher nil
   "Cached value of chosen search program.")
@@ -358,12 +357,13 @@
   (goto-char (point-min))
   (dotimes (i 5)
     (add-text-properties (point) (1+ (point)) '(front-sticky t))
-    (add-text-properties (- (line-end-position) 2) (1- (line-end-position))
+    (add-text-properties (- (mh-line-end-position) 2)
+                         (1- (mh-line-end-position))
                          '(rear-nonsticky t))
-    (add-text-properties (point) (1- (line-end-position)) '(read-only t))
+    (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t))
     (forward-line))
   (add-text-properties (point) (1+ (point)) '(front-sticky t))
-  (add-text-properties (point) (1- (line-end-position)) '(read-only t))
+  (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t))
   (goto-char (point-max)))
 
 ;; Sequence Searches
@@ -526,9 +526,10 @@
       (cond ((and (bolp) (eolp))
              (ignore-errors (forward-line -1))
              (setq msg (mh-get-msg-num t)))
-            ((equal (char-after (line-beginning-position)) ?+)
+            ((equal (char-after (mh-line-beginning-position)) ?+)
              (setq folder (buffer-substring-no-properties
-                           (line-beginning-position) (line-end-position))))
+                           (mh-line-beginning-position)
+                           (mh-line-end-position))))
             (t (setq msg (mh-get-msg-num t)))))
     (when (not folder)
       (setq folder (car (gethash (gethash msg mh-index-msg-checksum-map)
@@ -655,13 +656,13 @@
           start begin)
       (goto-char (point-min))
       (while (not (eobp))
-        (if (search-forward "--------" (line-end-position) t)
+        (if (search-forward "--------" (mh-line-end-position) t)
             (setq in-body-flag t)
           (beginning-of-line)
           (setq begin (point))
           (setq start (if in-body-flag
                           (point)
-                        (search-forward ":" (line-end-position) t)
+                        (search-forward ":" (mh-line-end-position) t)
                         (point)))
           (push (cons (and (not in-body-flag)
                            (intern (downcase
@@ -669,7 +670,7 @@
                                      begin (1- start)))))
                       (mh-index-parse-search-regexp
                        (buffer-substring-no-properties
-                        start (line-end-position))))
+                        start (mh-line-end-position))))
                 pattern-list))
         (forward-line))
       pattern-list)))
@@ -979,8 +980,8 @@
           (return nil))
         (when (equal (char-after (point)) ?#)
           (return 'error))
-        (let* ((start (search-forward " " (line-end-position) t))
-               (end (search-forward " " (line-end-position) t)))
+        (let* ((start (search-forward " " (mh-line-end-position) t))
+               (end (search-forward " " (mh-line-end-position) t)))
           (unless (and start end)
             (return 'error))
           (setq end (1- end))
@@ -1058,7 +1059,7 @@
           (return 'error))
         (let ((start (point))
               end msg-start)
-          (setq end (line-end-position))
+          (setq end (mh-line-end-position))
           (unless (search-forward mh-mairix-folder end t)
             (return 'error))
           (goto-char (match-beginning 0))
@@ -1191,7 +1192,7 @@
       (block nil
         (when (eobp) (return nil))
         (let ((file-name (buffer-substring-no-properties
-                          (point) (line-end-position))))
+                          (point) (mh-line-end-position))))
           (unless (equal (string-match mh-namazu-folder file-name) 0)
             (return 'error))
           (unless (file-exists-p file-name)
@@ -1239,17 +1240,17 @@
   (prog1
       (block nil
         (when (eobp) (return nil))
-        (when (search-forward-regexp "^\+" (line-end-position) t)
+        (when (search-forward-regexp "^\+" (mh-line-end-position) t)
           (setq mh-index-pick-folder
-                (buffer-substring-no-properties (line-beginning-position)
-                                                (line-end-position)))
+                (buffer-substring-no-properties (mh-line-beginning-position)
+                                                (mh-line-end-position)))
           (return 'error))
-        (unless (search-forward-regexp "^[1-9][0-9]*$" (line-end-position) t)
+        (unless (search-forward-regexp "^[1-9][0-9]*$" (mh-line-end-position) t)
           (return 'error))
         (list mh-index-pick-folder
               (string-to-number
-               (buffer-substring-no-properties (line-beginning-position)
-                                               (line-end-position)))
+               (buffer-substring-no-properties (mh-line-beginning-position)
+                                               (mh-line-end-position)))
               nil))
     (forward-line)))
 
@@ -1326,8 +1327,8 @@
       (block nil
         (when (eobp)
           (return nil))
-        (let ((eol-pos (line-end-position))
-              (bol-pos (line-beginning-position))
+        (let ((eol-pos (mh-line-end-position))
+              (bol-pos (mh-line-beginning-position))
               folder-start msg-end)
           (goto-char bol-pos)
           (unless (search-forward mh-user-path eol-pos t)
@@ -1408,8 +1409,12 @@
     (when cur-msg (mh-goto-msg cur-msg t t))
     (set-buffer-modified-p old-buffer-modified-flag)))
 
+(mh-require 'which-func nil t)
+
 ;; Shush compiler.
-(eval-when-compile (mh-do-in-xemacs (defvar which-func-mode)))
+(eval-when-compile
+  (if (or mh-xemacs-flag (< emacs-major-version 22))
+      (defvar which-func-mode)))
 
 ;;;###mh-autoload
 (defun mh-index-create-imenu-index ()
@@ -1423,7 +1428,7 @@
         (save-excursion
           (beginning-of-line)
           (push (cons (buffer-substring-no-properties
-                       (point) (line-end-position))
+                       (point) (mh-line-end-position))
                       (set-marker (make-marker) (point)))
                 alist)))
       (setq imenu--index-alist (nreverse alist)))))
@@ -1696,7 +1701,8 @@
     (mh-exec-cmd-output mh-scan-prog nil "-width" "80"
                         "-format" "%{x-mhe-checksum}\n" folder msg)
     (goto-char (point-min))
-    (string-equal (buffer-substring-no-properties (point) (line-end-position))
+    (string-equal (buffer-substring-no-properties
+                   (point) (mh-line-end-position))
                   checksum)))
 
 
@@ -1805,8 +1811,8 @@
 
 (defun mh-md5sum-parser ()
   "Parse md5sum output."
-  (let ((begin (line-beginning-position))
-        (end (line-end-position))
+  (let ((begin (mh-line-beginning-position))
+        (end (mh-line-end-position))
         first-space last-slash)
     (setq first-space (search-forward " " end t))
     (goto-char end)
@@ -1819,8 +1825,8 @@
 
 (defun mh-openssl-parser ()
   "Parse openssl output."
-  (let ((begin (line-beginning-position))
-        (end (line-end-position))
+  (let ((begin (mh-line-beginning-position))
+        (end (mh-line-end-position))
         last-space last-slash)
     (goto-char end)
     (setq last-space (search-backward " " begin t))
@@ -1854,7 +1860,7 @@
       (let (msg checksum)
         (while (not (eobp))
           (setq msg (buffer-substring-no-properties
-                     (point) (line-end-position)))
+                     (point) (mh-line-end-position)))
           (forward-line)
           (save-excursion
             (cond ((not (string-match "^[0-9]*$" msg)))
@@ -1865,7 +1871,7 @@
                   (t
                    ;; update maps
                    (setq checksum (buffer-substring-no-properties
-                                   (point) (line-end-position)))
+                                   (point) (mh-line-end-position)))
                    (let ((msg (string-to-number msg)))
                      (set-buffer folder)
                      (mh-index-update-single-msg msg checksum origin-map)))))