emacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-commit] emacs/lisp/mh-e mh-utils.el mh-seq.el mh-e.el m...


From: Bill Wohler
Subject: [Emacs-commit] emacs/lisp/mh-e mh-utils.el mh-seq.el mh-e.el m...
Date: Fri, 13 Jan 2006 06:40:14 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Bill Wohler <address@hidden>    06/01/13 06:40:14

Modified files:
        lisp/mh-e      : mh-utils.el mh-seq.el mh-e.el mh-customize.el 
                         ChangeLog 
Added files:
        lisp/mh-e      : mh-search.el 
Removed files:
        lisp/mh-e      : mh-pick.el mh-index.el 

Log message:
        * mh-search.el: New file containing contents of mh-index.el and
        mh-pick.el. C-c C-c launches your mh-index-program; C-c C-p runs pick.
        Pick no longer sets the "search" sequence. Instead, it brings up a
        folder view that we're accustomed to. (closes SF #829207).
        (mh-index-search): Rename to mh-search.
        (mh-pick-menu): Rename menu from Pick to Search. Rename Execute the
        Search to Perform Search and call mh-do-search. Add Search with Pick
        menu item.
        (mh-do-search): Delete.
        (mh-search-mode): Rename from mh-pick-mode.
        (MH-Search): Rename mode from MH-Pick.
        (mh-search-mode-map): Rename from mh-pick-mode-map.
        (mh-search-mode-help-messages): Rename from
        mh-pick-mode-help-messages.
        (mh-index-choose): Don't reuse the last value of mh-indexer; when
        mh-pick-do-search sets it to 'pick, we don't necessarily want to stay
        with that choice!
        
        * mh-index.el: mh-pick.el: Merge into mh-search.el and delete.
        
        * mh-customize.el (mh-index-program): Change mh-index-search to
        mh-search in docstring.
        (mh-tool-bar-search-function): Change default from mh-search-folder to
        mh-search. Remove mh-search-folder as choice and rename
        mh-index-search choice to mh-search. Fix docstring.
        (mh-pick-mode-hook): Rename to mh-search-mode-hook and change
        mh-search-folder to mh-search in docstring.
        
        * mh-e.el (mh-folder-folder-menu): Delete Search a Folder. Change
        Indexed Search to Search. Use mh-search instead of mh-index-search.
        (mh-folder-map): Delete i (mh-index-search) keybinding. Change s from
        mh-show-search-folder to mh-search.
        
        * mh-seq.el (mh-put-msg-in-seq): Fix docstring now that
        mh-search-folder no longer creates the search sequence.
        
        * mh-utils.el (mh-show-search-folder): Delete.
        (mh-show-folder-map): Delete i (mh-index-search) keybinding. Change s
        from mh-show-search-folder to mh-search.
        (mh-show-folder-menu): Delete Search a Folder. Change Indexed Search
        to Search. Use mh-search instead of mh-index-search.
        (mh-index-max-cmdline-args, mh-xargs, mh-quote-for-shell): Move here
        from deleted mh-index.el.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-utils.el.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-seq.el.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-search.el?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-e.el.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-customize.el.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.112&tr2=1.113&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.112 emacs/lisp/mh-e/ChangeLog:1.113
--- emacs/lisp/mh-e/ChangeLog:1.112     Wed Jan 11 21:02:35 2006
+++ emacs/lisp/mh-e/ChangeLog   Fri Jan 13 06:40:14 2006
@@ -1,3 +1,52 @@
+2006-01-12  Bill Wohler  <address@hidden>
+
+       * mh-search.el: New file containing contents of mh-index.el and
+       mh-pick.el. C-c C-c launches your mh-index-program; C-c C-p runs
+       pick. Pick no longer sets the "search" sequence. Instead, it
+       brings up a folder view that we're accustomed to. (closes SF
+       #829207).
+       (mh-index-search): Rename to mh-search.
+       (mh-pick-menu): Rename menu from Pick to Search. Rename Execute
+       the Search to Perform Search and call mh-do-search. Add Search
+       with Pick menu item.
+       (mh-do-search): Delete.
+       (mh-search-mode): Rename from mh-pick-mode.
+       (MH-Search): Rename mode from MH-Pick.
+       (mh-search-mode-map): Rename from mh-pick-mode-map.
+       (mh-search-mode-help-messages): Rename from
+       mh-pick-mode-help-messages.
+       (mh-index-choose): Don't reuse the last value of mh-indexer; when
+       mh-pick-do-search sets it to 'pick, we don't necessarily want to
+       stay with that choice!
+
+       * mh-index.el:
+       * mh-pick.el: Merge into mh-search.el and delete.
+
+       * mh-customize.el (mh-index-program): Change mh-index-search to
+       mh-search in docstring.
+       (mh-tool-bar-search-function): Change default from
+       mh-search-folder to mh-search. Remove mh-search-folder as choice
+       and rename mh-index-search choice to mh-search. Fix docstring.
+       (mh-pick-mode-hook): Rename to mh-search-mode-hook and change
+       mh-search-folder to mh-search in docstring.
+
+       * mh-e.el (mh-folder-folder-menu): Delete Search a Folder. Change
+       Indexed Search to Search. Use mh-search instead of
+       mh-index-search.
+       (mh-folder-map): Delete i (mh-index-search) keybinding. Change s
+       from mh-show-search-folder to mh-search.
+
+       * mh-seq.el (mh-put-msg-in-seq): Fix docstring now that
+       mh-search-folder no longer creates the search sequence.
+
+       * mh-utils.el (mh-show-search-folder): Delete.
+       (mh-show-folder-map): Delete i (mh-index-search) keybinding.
+       Change s from mh-show-search-folder to mh-search.
+       (mh-show-folder-menu): Delete Search a Folder. Change Indexed
+       Search to Search. Use mh-search instead of mh-index-search.
+       (mh-index-max-cmdline-args, mh-xargs, mh-quote-for-shell): Move
+       here from deleted mh-index.el.
+
 2006-01-11  Bill Wohler  <address@hidden>
 
        * mh-acros.el (mh-defun-compat, mh-defmacro-compat): Move here
Index: emacs/lisp/mh-e/mh-customize.el
diff -u emacs/lisp/mh-e/mh-customize.el:1.58 
emacs/lisp/mh-e/mh-customize.el:1.59
--- emacs/lisp/mh-e/mh-customize.el:1.58        Tue Jan 10 23:52:34 2006
+++ emacs/lisp/mh-e/mh-customize.el     Fri Jan 13 06:40:14 2006
@@ -725,7 +725,7 @@
 mairix, then you can set this option to \"mairix\".
 
 More information about setting up an indexing program to use with
-MH-E can be found in the documentation of `mh-index-search'."
+MH-E can be found in the documentation of `mh-search'."
   :type '(choice (const :tag "Auto-detect" nil)
                  (const :tag "swish++" swish++)
                  (const :tag "swish-e" swish)
@@ -1879,14 +1879,13 @@
 
 ;;; The Tool Bar (:group 'mh-tool-bar)
 
-(defcustom mh-tool-bar-search-function 'mh-search-folder
+(defcustom mh-tool-bar-search-function 'mh-search
   "*Function called by the tool bar search button.
 
-Available functions include `mh-search-folder', the default, and
-`mh-index-search'. You can also choose \"Other Function\" from
-the \"Value Menu\" and enter a function of your own choosing."
-  :type '(choice (const mh-search-folder)
-                 (const mh-index-search)
+By default, this is set to `mh-search'. You can also choose
+\"Other Function\" from the \"Value Menu\" and enter a function
+of your own choosing."
+  :type '(choice (const mh-search)
                  (function :tag "Other Function"))
   :group 'mh-tool-bar)
 
@@ -2436,13 +2435,13 @@
   :group 'mh-hooks
   :group 'mh-letter)
 
-(defcustom mh-pick-mode-hook nil
-  "Hook run upon entry to `mh-pick-mode'\\<mh-folder-mode-map>.
+(defcustom mh-search-mode-hook nil
+  "Hook run upon entry to `mh-search-mode'\\<mh-folder-mode-map>.
 
 If you find that you do the same thing over and over when editing
 the search template, you may wish to bind some shortcuts to keys.
 This can be done with this hook which is called when
-\\[mh-search-folder] is run on a new pattern."
+\\[mh-search] is run on a new pattern."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-index)
Index: emacs/lisp/mh-e/mh-e.el
diff -u emacs/lisp/mh-e/mh-e.el:1.52 emacs/lisp/mh-e/mh-e.el:1.53
--- emacs/lisp/mh-e/mh-e.el:1.52        Wed Jan 11 19:50:07 2006
+++ emacs/lisp/mh-e/mh-e.el     Fri Jan 13 06:40:13 2006
@@ -1735,8 +1735,7 @@
     ["List Folders"                     mh-list-folders t]
     ["Visit a Folder..."                mh-visit-folder t]
     ["View New Messages"                mh-index-new-messages t]
-    ["Search a Folder..."               mh-search-folder t]
-    ["Indexed Search..."                mh-index-search t]
+    ["Search..."                        mh-search t]
     "--"
     ["Quit MH-E"                        mh-quit t]))
 
@@ -1862,9 +1861,9 @@
    'mh-folder-view-stack ()             ; Stack of previous views of the
                                         ; folder.
    'mh-index-data nil                   ; If the folder was created by a call
-                                        ; to mh-index-search this contains info
+                                        ; to mh-search, this contains info
                                         ; about the search results.
-   'mh-index-previous-search nil        ; Previous folder and search-regexp
+   'mh-index-previous-search nil        ; folder, indexer, search-regexp
    'mh-index-msg-checksum-map nil       ; msg -> checksum map
    'mh-index-checksum-origin-map nil    ; checksum -> ( orig-folder, orig-msg )
    'mh-index-sequence-search-flag nil   ; folder resulted from sequence search
@@ -2705,7 +2704,6 @@
   "S"           mh-sort-folder
   "c"           mh-catchup
   "f"           mh-alt-visit-folder
-  "i"           mh-index-search
   "k"           mh-kill-folder
   "l"           mh-list-folders
   "n"           mh-index-new-messages
@@ -2713,7 +2711,7 @@
   "p"           mh-pack-folder
   "q"           mh-index-sequenced-messages
   "r"           mh-rescan-folder
-  "s"           mh-search-folder
+  "s"           mh-search
   "u"           mh-undo-folder
   "v"           mh-visit-folder)
 
Index: emacs/lisp/mh-e/mh-seq.el
diff -u emacs/lisp/mh-e/mh-seq.el:1.24 emacs/lisp/mh-e/mh-seq.el:1.25
--- emacs/lisp/mh-e/mh-seq.el:1.24      Wed Jan 11 19:50:07 2006
+++ emacs/lisp/mh-e/mh-seq.el   Fri Jan 13 06:40:13 2006
@@ -291,11 +291,6 @@
 (defun mh-put-msg-in-seq (range sequence)
   "Add RANGE to SEQUENCE\\<mh-folder-mode-map>.
 
-To place a message in a sequence, use this command to do it
-manually, or use the MH command \"pick\" or the MH-E version of
-\"pick\", \\[mh-search-folder], which create a sequence
-automatically.
-
 Give this command a RANGE and you can add all the messages in a
 sequence to another sequence (for example,
 \"\\[universal-argument] \\[mh-put-msg-in-seq] SourceSequence RET
Index: emacs/lisp/mh-e/mh-utils.el
diff -u emacs/lisp/mh-e/mh-utils.el:1.38 emacs/lisp/mh-e/mh-utils.el:1.39
--- emacs/lisp/mh-e/mh-utils.el:1.38    Wed Jan 11 21:02:35 2006
+++ emacs/lisp/mh-e/mh-utils.el Fri Jan 13 06:40:13 2006
@@ -847,7 +847,6 @@
 (mh-defun-show-buffer mh-show-pack-folder mh-pack-folder)
 (mh-defun-show-buffer mh-show-kill-folder mh-kill-folder t)
 (mh-defun-show-buffer mh-show-list-folders mh-list-folders t)
-(mh-defun-show-buffer mh-show-search-folder mh-search-folder t)
 (mh-defun-show-buffer mh-show-undo-folder mh-undo-folder)
 (mh-defun-show-buffer mh-show-delete-msg-from-seq
                       mh-delete-msg-from-seq)
@@ -952,14 +951,13 @@
   "S"    mh-show-sort-folder
   "c"    mh-show-catchup
   "f"    mh-show-visit-folder
-  "i"    mh-index-search
   "k"    mh-show-kill-folder
   "l"    mh-show-list-folders
   "n"    mh-index-new-messages
   "o"    mh-show-visit-folder
   "q"    mh-show-index-sequenced-messages
   "r"    mh-show-rescan-folder
-  "s"    mh-show-search-folder
+  "s"    mh-search
   "t"    mh-show-toggle-threads
   "u"    mh-show-undo-folder
   "v"    mh-show-visit-folder)
@@ -1098,8 +1096,7 @@
     ["List Folders"                     mh-show-list-folders t]
     ["Visit a Folder..."                mh-show-visit-folder t]
     ["View New Messages"                mh-show-index-new-messages t]
-    ["Search a Folder..."               mh-show-search-folder t]
-    ["Indexed Search..."                mh-index-search t]
+    ["Search..."                        mh-search t]
     "--"
     ["Quit MH-E"                        mh-quit t]))
 
@@ -2393,7 +2390,44 @@
 
 
 
-;;; Issue commands to MH.
+;;; Issue shell and MH commands.
+
+(defvar mh-index-max-cmdline-args 500
+  "Maximum number of command line args.")
+
+(defun mh-xargs (cmd &rest args)
+  "Partial imitation of xargs.
+The current buffer contains a list of strings, one on each line.
+The function will execute CMD with ARGS and pass the first
+`mh-index-max-cmdline-args' strings to it. This is repeated till
+all the strings have been used."
+  (goto-char (point-min))
+  (let ((current-buffer (current-buffer)))
+    (with-temp-buffer
+      (let ((out (current-buffer)))
+        (set-buffer current-buffer)
+        (while (not (eobp))
+          (let ((arg-list (reverse args))
+                (count 0))
+            (while (and (not (eobp)) (< count mh-index-max-cmdline-args))
+              (push (buffer-substring-no-properties (point) 
(line-end-position))
+                    arg-list)
+              (incf count)
+              (forward-line))
+            (apply #'call-process cmd nil (list out nil) nil
+                   (nreverse arg-list))))
+        (erase-buffer)
+        (insert-buffer-substring out)))))
+
+;; XXX This should be applied anywhere MH-E calls out to /bin/sh.
+(defun mh-quote-for-shell (string)
+  "Quote STRING for /bin/sh.
+Adds double-quotes around entire string and quotes the characters
+\\, `, and $ with a backslash."
+  (concat "\""
+          (loop for x across string
+                concat (format (if (memq x '(?\\ ?` ?$)) "\\%c" "%c") x))
+          "\""))
 
 (defun mh-exec-cmd (command &rest args)
   "Execute mh-command COMMAND with ARGS.
@@ -2498,21 +2532,6 @@
 ;; Shush compiler.
 (eval-when-compile (defvar mark-active))
 
-(defun mh-exchange-point-and-mark-preserving-active-mark ()
-  "Put the mark where point is now, and point where the mark is now.
-This command works even when the mark is not active, and
-preserves whether the mark is active or not."
-  (interactive nil)
-  (let ((is-active (and (boundp 'mark-active) mark-active)))
-    (let ((omark (mark t)))
-      (if (null omark)
-          (error "No mark set in this buffer"))
-      (set-mark (point))
-      (goto-char omark)
-      (if (boundp 'mark-active)
-          (setq mark-active is-active))
-      nil)))
-
 (defun mh-exec-cmd-output (command display &rest args)
   "Execute MH command COMMAND with DISPLAY flag and ARGS.
 Put the output into buffer after point.
@@ -2530,6 +2549,21 @@
   ;; The bug wasn't seen in emacs21 but still occurred in XEmacs21.4.
   (mh-exchange-point-and-mark-preserving-active-mark))
 
+(defun mh-exchange-point-and-mark-preserving-active-mark ()
+  "Put the mark where point is now, and point where the mark is now.
+This command works even when the mark is not active, and
+preserves whether the mark is active or not."
+  (interactive nil)
+  (let ((is-active (and (boundp 'mark-active) mark-active)))
+    (let ((omark (mark t)))
+      (if (null omark)
+          (error "No mark set in this buffer"))
+      (set-mark (point))
+      (goto-char omark)
+      (if (boundp 'mark-active)
+          (setq mark-active is-active))
+      nil)))
+
 (defun mh-exec-lib-cmd-output (command &rest args)
   "Execute MH library command COMMAND with ARGS.
 Put the output into buffer after point.
@@ -2552,6 +2586,10 @@
     (error "%s failed, check buffer %s for error message"
            command mh-log-buffer)))
 
+
+
+;;; List and string manipulation
+
 (defun mh-list-to-string (l)
   "Flatten the list L and make every element of the new list into a string."
   (nreverse (mh-list-to-string-1 l)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]