Merge from emacs-23
[bpt/emacs.git] / lisp / mh-e / mh-search.el
index 2750c50..1c60a1a 100644 (file)
@@ -1,7 +1,8 @@
 ;;; mh-search  ---  MH-Search mode
 
 ;; Copyright (C) 1993, 1995,
-;;  2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+;;   Free Software Foundation, Inc.
 
 ;; Author: Indexed search by Satyaki Das <satyaki@theforce.stanford.edu>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -716,7 +717,7 @@ parsed."
               ((equal token "and") (push 'and op-stack))
               ((equal token ")")
                (multiple-value-setq (op-stack operand-stack)
-                 (mh-index-evaluate op-stack operand-stack))
+                 (values-list (mh-index-evaluate op-stack operand-stack)))
                (when (eq (car op-stack) 'not)
                  (setq op-stack (cdr op-stack))
                  (push `(not ,(pop operand-stack)) operand-stack))
@@ -766,7 +767,7 @@ parsed."
       (while op-stack
         (setq op (pop op-stack))
         (cond ((eq op 'paren)
-               (return-from mh-index-evaluate (values op-stack operand-stack)))
+               (return-from mh-index-evaluate (list op-stack operand-stack)))
               ((eq op 'not)
                (push `(not ,(pop operand-stack)) operand-stack))
               ((or (eq op 'and) (eq op 'or))
@@ -1023,8 +1024,8 @@ following contents:
      # are subfolders within the folder
      mh=archive...:inbox:drafts:news:sent:trash
 
-     vfolder_format=raw
-     database=/home/user/Mail/mairix/database
+     vfolder_format=mh
+     database=/home/user/Mail/.mairix/database
 
 Use the following command line to generate the mairix index. Run
 this daily from cron:
@@ -1171,7 +1172,7 @@ Use the following command line to generate the namazu index. Run this
 daily from cron:
 
      mknmz -f /home/user/Mail/.namazu/mknmzrc -O /home/user/Mail/.namazu \\
-              /home/user/Mail
+           -q /home/user/Mail
 
 In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
 is used to search."
@@ -1274,12 +1275,12 @@ is used to search."
       (when (cdr pattern)
         (setq result `(,@result "-and" "-lbrace"
                        ,@(mh-pick-construct-regexp
-                          (if (and (mh-variant-p 'mu-mh) (car pattern))
+                          (if (and (mh-variant-p 'gnu-mh) (car pattern))
                               (format "--pattern=%s" (cdr pattern))
                             (cdr pattern))
                           (if (car pattern)
                               (cond
-                               ((mh-variant-p 'mu-mh)
+                               ((mh-variant-p 'gnu-mh)
                                 (format "--component=%s" (car pattern)))
                                ((member (car pattern) mh-pick-single-dash)
                                 (format "-%s" (car pattern)))
@@ -1462,8 +1463,7 @@ user has marked in the index buffer."
              ;; If source folder not open, just delete the messages...
              (apply #'mh-exec-cmd "rmm" folder (mh-coalesce-msg-list msgs))
            ;; Otherwise delete the messages in the source buffer...
-           (save-excursion
-             (set-buffer folder)
+           (with-current-buffer folder
              (let ((old-refile-list mh-refile-list)
                    (old-delete-list mh-delete-list))
                (setq mh-refile-list nil
@@ -1511,7 +1511,7 @@ construct the base name."
       (delete-char 1))
     (goto-char (point-max))
     (while (and (not (bobp)) (memq (char-before) '(?  ?\t ?\n ?\r ?_)))
-      (delete-backward-char 1))
+      (delete-char -1))
     (subst-char-in-region (point-min) (point-max) ?  ?_ t)
     (subst-char-in-region (point-min) (point-max) ?\t ?_ t)
     (subst-char-in-region (point-min) (point-max) ?\n ?_ t)
@@ -1641,8 +1641,7 @@ attempt to update the source folder buffer if we have it open."
                                   (mh-coalesce-msg-list msgs)))
                    ;; Update source folder buffer if we have it open...
                    (when (get-buffer folder)
-                     (save-excursion
-                       (set-buffer folder)
+                     (with-current-buffer folder
                        (mh-put-msg-in-seq msgs seq))))
                  (mh-index-matching-source-msgs msgs))
         folders))))
@@ -1666,8 +1665,7 @@ attempt to update the source folder buffer if present."
                                   (mh-coalesce-msg-list msgs)))
                    ;; Update source folder buffer if we have it open...
                    (when (get-buffer folder)
-                     (save-excursion
-                       (set-buffer folder)
+                     (with-current-buffer folder
                        (mh-delete-msg-from-seq msgs seq t))))
                  (mh-index-matching-source-msgs msgs))
         folders))))
@@ -1852,9 +1850,8 @@ index folder to the original folder and message from whence it
 was copied. If present the checksum -> (origin-folder,
 origin-index) map is updated too."
   (clrhash mh-index-msg-checksum-map)
-  (save-excursion
-    ;; Clear temp buffer
-    (set-buffer (get-buffer-create mh-temp-checksum-buffer))
+  ;; Clear temp buffer
+  (with-current-buffer (get-buffer-create mh-temp-checksum-buffer)
     (erase-buffer)
     ;; Run scan to check if any messages needs MD5 annotations at all
     (with-temp-buffer
@@ -1894,8 +1891,7 @@ origin-index) map is updated too."
             (mh-exec-cmd "anno" folder msg "-component" "X-MHE-Checksum"
                          "-nodate" "-text" checksum "-inplace")
             ;; update maps
-            (save-excursion
-              (set-buffer folder)
+            (with-current-buffer folder
               (mh-index-update-single-msg msg checksum origin-map)))
           (forward-line)))))
   (mh-index-write-data))