Anonymous committed 67170a8

2003-02-10 Steve Youngs <>

* Sync to upstream version 7.2.

* Makefile (AUTHOR_VERSION): Bump to version 7.2.

* (provides): Add missing provides.

Comments (0)

Files changed (18)

+2003-02-10  Steve Youngs  <>
+	* Sync to upstream version 7.2.
+	* Makefile (AUTHOR_VERSION): Bump to version 7.2.
+	* (provides): Add missing provides.
 2003-01-13  Rendhalver [Peter Brown]  <>
 	* Makefile (VERSION): XEmacs package 1.17 released.


+2003-02-03  Bill Wohler  <>
+	* Released MH-E version 7.2.
+	* MH-E-NEWS, README: Updated for release 7.2.
+	* mh-e.el (Version, mh-version): Updated for release 7.2.
+2003-02-03  Bill Wohler  <>
+	* Makefile (dist): mkdir needs to happen *before* files are
+	copied.
+	* MH-E-NEWS: Fixed some awkward verbiage.
+2003-02-02  Bill Wohler  <>
+	* mh-customize.el (mh-invisible-headers): Surround regexp-opt
+	expression in parens to avoid problems viewing certain messages.
+2003-01-30  Satyaki Das  <>
+	* mh-speed.el (mh-speed-flists): Search for flists in mh-progs.
+	The original was inadvertently searching for flists in the user's
+	path.
+2003-01-27  Bill Wohler  <>
+	* mh-customize.el (mh-default-folder-must-exist-flag): Changed
+	default to t according to the principle of least surprise.
+2003-01-26  Bill Wohler  <>
+	* mh-utils.el: Checkdoc fixes.
+	* mh-pick.el (mh-do-search, mh-search-folder): Checkdoc fixes.
+	* mh-loaddefs.el: Regenerated (lm-verify fixes).
+	* mh-index.el (mh-mairix-next-result): Checkdoc fixes.	
+	* mh-alias.el: lm-verify fix.
+	* Makefile (MH-E-SRC): Added ChangeLog, now that Emacs has a
+	lisp/mh-e directory.
+	(MH-E-ETC-ETC): Removed ChangeLog.
+	(dist): Moved creation of mail directory next to copy of files
+	into mail directory.
+	(install-emacs): Copy $(MH-E-SRC) into new directory
+	$(EMACS_HOME/lisp/mh-e.
+	(MH-E-SRC): Moved ChangeLog into new variable MH-E-OTHERS and
+	include MH-E-LOADDEFS there too.
+	(mh-loaddefs.el): Added lines so that lm-verify passes.
+	(dist, install-emacs): Use MH-E-OTHERS instead of MH-E-LOADDEFS.
+2003-01-26  Jeffrey C Honig  <>
+	* mh-comp.el (mh-tidy-draft-buffer, mh-compose-and-send-mail):
+	Rename mh-kill-draft-hook to mh-tidy-draft-buffer.
+2003-01-25  Jeffrey C Honig  <>
+	* mh-utils.el (mh-exec-cmd, mh-exec-cmd-daemon)
+	(mh-process-daemon): Use mh-log-buffer for the output of commands
+	from mh-exec-cmd.
+	* mh-utils.el (mh-temp-folders-buffer): Sequences and folders
+	loose the -temp from their buffer names as they are interesting to
+	the user.
+	* mh-seq.el (mh-list-sequences): New name, mh-sequences-buffer as
+	it is intended to be interesting to the user.
+	* mh-funcs.el (mh-list-folders): New name, mh-folders-buffer as it
+	is intended to be interesting to the user.
+	* mh-comp.el (mh-check-whom, mh-compose-and-send-mail): Use
+	mh-recipients-buffer constant.  Add a kill buffer hook to delete
+	the recipients buffer when a draft buffer is killed.
+2003-01-25  Satyaki Das  <>
+	* mh-customize.el (mh-customize): New interactive argument
+	deletes other windows.
+	(mh-tool-bar-show-set, mh-tool-bar-letter-set)
+	(mh-tool-bar-folder-set): Modified so that clicking the customize
+	and help buttons deletes the other windows in the frame.
+	* mh-mime.el (mh-mm-inline-message): Remove unused code.
+	* mh-seq.el (mh-notate-deleted-and-refiled): Fix a small bug where
+	the wrong notation was being used.
+	(mh-toggle-threads): The function had a bug if you did the
+	following starting from an unthreaded wide folder:
+	  (1) Create a sequence with S p
+	  (2) Narrow to new sequence with S n
+	  (3) Thread narrowed folder with T t
+	  (4) Kill sequence with S k
+	  (5) Unthread narrowed folder with T t
+	At this point we would have an empty folder. The change fixes
+	this.
+	(mh-toggle-threads): Fix documentation.
+	* mh-customize.el (mh-invisible-header-fields): Add
+	X-MHE-Checksum to invisible headers.
+	* mh-comp.el (mh-insert-x-mailer): Slightly more informative
+	X-Mailer header.
+2003-01-24  Satyaki Das  <>
+	* mh-e.el (mh-header-display): Modified so that quoted-printable
+	or base64 encoded messages are left untouched.
+	* mh-utils.el (mh-decode-content-transfer-encoded-message): Munge
+	the Content-Transfer-Encoding header so that the MIME decoding
+	routines of Gnus doesn't get confused.
+	(mh-display-msg): Use insert-file-contents-literally so that
+	display will work for non-ascii.
+	* mh-mime.el (mh-mime-display): Use charset info to decode
+	message file (closes SF #655123).
+2003-01-24  Bill Wohler  <>
+	* mh-alias.el (mh-alias-add-alias-to-file): Removed period from
+	error message and added parens around error function.
+2003-01-24  Satyaki Das  <>
+	* mh-customize.el (mh-decode-quoted-printable-flag): Removed.
+	(mh-decode-content-transfer-encoded-message-flag): This replaces
+	mh-decode-quoted-printable-flag.
+	* mh-utils.el (mh-decode-content-transfer-encoded-message): New
+	function which handles messages that are encoded as base64 or
+	quoted-printable (closes SF #674190).
+	(mh-decode-quoted-printable): Removed.
+	(mh-display-msg): Use mh-decode-content-transfer-encoded-message
+	instead of mh-decode-quoted-printable.
+2003-01-23  Satyaki Das  <>
+	* mh-seq.el (mh-thread-generate-scan-lines): Fix a little bug
+	that would occasionally cause angles ('<' and '>') to appear at
+	root level.
+2003-01-21  Satyaki Das  <>
+	* mh-seq.el (mh-notate-cur): Enable overlay arrow display in text
+	mode too.
+	* mh-e.el (mh-folder-mode): Initialize overlay-arrow-string so
+	that a '>' is displayed in text mode.
+2003-01-20  Satyaki Das  <>
+	* mh-utils.el (mh-scan-msg-overflow-regexp): Change the variable
+	so that a space is always maintained in the beginning of the scan
+	line.
+	* mh-seq.el (mh-notate-seq, mh-notate-cur): Make the functions
+	faster by cutting down on the use of mh-goto-msg.
+	(mh-toggle-threads): Add call to mh-notate-cur, since inserting
+	the folder names in a search results folder screws up the
+	location of the overlay arrow.
+	* mh-index.el (mh-index-delete-folder-headers): Position the
+	point on a message line if possible.
+	* mh-funcs.el (mh-copy-msg): Use the mh-iterate macro to make the
+	function faster.
+	* mh-e.el (mh-scan-folder): Reuse mh-notate-deleted-and-refiled.
+	* mh-loaddefs.el: Regenerated.
+	* mh-utils.el (mh-add-msgs-to-seq): Add a new parameter that
+	suppresses the annotation of the sequence since it is
+	inefficient.
+	* mh-seq.el (mh-delete-seq): Speed up the part of the function
+	that removes the sequence notation.
+	(mh-put-msg-in-seq, mh-notate-deleted-and-refiled): Use
+	mh-iterate-on-messages-in-region to make the function fasters when
+	operating on regions. The key idea is to loop over the folder
+	buffer exactly once and do all annotations. The existing algo
+	would walk over the buffer multiple times thereby slowing things
+	down.
+	(mh-iterate-on-messages-in-region): Added an extra parameter which
+	is bound to the message index as the loop is executed.
+	(mh-region-to-msg-list, mh-thread-delete, mh-thread-refile): Use
+	the new mh-iterate-on-messages-in-region macro.
+	* mh-e.el (mh-delete-msg-no-motion, mh-refile-msg, mh-undo): Same
+	as above.
+	(mh-notate-user-sequences): Change algorithm to make notating of
+	user sequences fast.
+2003-01-19  Satyaki Das  <>
+	* mh-logo.xpm: New image file that contains the MH-E logo.
+	Change foreground color to the blue in the MH-E logo.
+	* Makefile (MH-E-IMG): Add mh-logo.xpm to list of image files.
+	* mh-utils.el (mh-show-buffer-mode-line-buffer-id): Adjust it to
+	keep space in the beginning for the logo.
+	(mh-logo-cache): New variable that caches the logo image file
+	location.
+	(mh-logo-display): Display the MH-E logo on the mode line.
+	(mh-display-msg): Display logo in mh-show-mode.
+	* mh-e.el (mh-make-folder-mode-line): Display logo in
+	mh-folder-mode.
+	* mh-comp.el (mh-compose-and-send-mail): Display logo in
+	mh-letter-mode.
+	* mh-loaddefs.el: Regenerated.
+	* mh-seq.el (mh-iterate-on-messages-in-region): New macro to
+	iterate on all messages in a region.
+	(mh-region-to-msg-list): Simplified since it uses
+	mh-iterate-on-messages-in-region now.
+	* mh-e.el (mh-delete-msg, mh-refile-msg): Change interactive spec
+	to pass the region that is to be deleted when appropriate.
+	(mh-delete-msg-no-motion, mh-refile-msg, mh-undo): Operate on
+	regions directly without creating the list of messages to be
+	deleted/refiled.
+	(mh-delete-a-msg, mh-refile-a-msg, mh-undo-msg): The msg
+	parameter in these functions can now be nil. If so, the current
+	message is deleted, refiled or undone respectively. Avoids the
+	use of mh-goto-msg in this case and speeds up operations on
+	regions quite a bit.
+2003-01-19  Peter S Galbraith  <>
+	* mh-alias.el (mh-read-address): Bug Fix. In XEmacs and Emacs20,
+	it would always prompt using "To: " instead of using the command
+	argument (closes SF #670913).
+2003-01-19  Satyaki Das  <>
+	* mh-utils.el (mh-folder-completion-function): If there is a
+	+foo/bar folder and the user types foo//bar then the completion
+	function would say a match happened without showing the
+	normalized folder name. This change fixes that.
+2003-01-18  Satyaki Das  <>
+	* mh-e.el (mh-rmail): Modified so that new and unseen messages
+	are shown (closes SF #667542).
+2003-01-17  Satyaki Das  <>
+	* mh-index.el (mh-index-generate-pretty-name): Generate nicer
+	names. In particular all '-' characters are removed.
+2003-01-16  Satyaki Das  <>
+	* mh-customize.el (mh-index-program): Documentation fix.
+	* mh-loaddefs.el: Regenerated.
+	* mh-customize.el (mh-index-program): Add choices for mairix and
+	pick.
+	* mh-index.el (mh-indexer-choices): Add search interfaces for
+	mairix and pick.
+	(mh-index-search): Add links for mairix and pick.
+	(mh-index-pick-folder, mh-pick-binary): Variables needed to
+	implement pick support.
+	(mh-pick-execute-search, mh-pick-next-result): New functions to
+	implement pick support.
+	(mh-mairix-binary, mh-mairix-directory, mh-mairix-folder): New
+	variables for mairix support.
+	(mh-mairix-execute-search, mh-mairix-next-result)
+	(mh-mairix-regexp-builder, mh-mairix-convert-to-sop*): New
+	functions for mairix.
+	* mh-funcs.el (mh-kill-folder): Move message to the end.
+	* mh-e.el (mh-folder-mode): Make overlay-arrow-position and
+	overlay-arrow-string local variables so that the arrow will
+	remain even if some other folder is visited.
+	(mh-remove-cur-notation, mh-remove-all-notation): The test isn't
+	required any more since overlay-arrow-position is local.
+	(mh-goto-cur-msg): Remove overlay arrow if current message
+	doesn't exist.
+	* mh-seq.el (mh-notate-cur): Don't need to set
+	overlay-arrow-string any more since it is local and has been set
+	at initialization.
+2003-01-15  Satyaki Das  <>
+	* mh-speed.el (mh-speed-current-folder): Keep track of current
+	folder when flists is called.
+	(mh-speed-flists, mh-speed-parse-flists-output): Try to avoid
+	ambiguity when folders are present with + at the end of the name.
+	Unfortunately it can't always be avoided.
+	* mh-e.el (mh-folder-size): Remove the unnecessary error check.
+	(mh-parse-flist-output-line): Add extra argument which
+	occasionally avoid problems with folder names that end with '+'.
+	* mh-utils.el (mh-sub-folders-actual): Fix the folder name
+	parsing so that it doesn't get confused by trailing '+' chars in
+	the folder name.
+2003-01-14  Satyaki Das  <>
+	* mh-utils.el (mh-normalize-folder-name): Enhanced so that it can
+	now handle ".." and "." correctly during folder name completion.
+	(mh-normalize-folder-name): Avoid error in boundary condition
+	where the folder string is empty.
+2003-01-14  Mark D. Baushke  <>
+	* mh-e.el (mh-visit-folder): Pass `current-prefix-arg' to
+	the `mh-read-msg-range' function as the optional
+	always-prompt-flag.
+2003-01-14  Satyaki Das  <>
+	* mh-utils.el (mh-normalize-folder-name): New function that
+	normalizes folder names.
+	(mh-sub-folders): Use mh-normalize-folder-name. Also the function
+	has been modified so that a trailing slash is only added if the
+	folder potentially has subfolders.
+	(mh-sub-folders-actual): Simplified since the folder has already
+	been normalized in mh-sub-folders.
+	(mh-remove-from-sub-folders-cache): Modified so that the cached
+	results of two of the folders ancestors are invalidated.
+	(mh-folder-completion-map): Ugly hack to make the error go away
+	when minibuffer-complete-word is called.
+	(mh-folder-completion-function): The completion function will now
+	be more selective in adding '/' at the end of completed folder
+	names.
+	(mh-folder-completing-read): The folder name is normalized before
+	return. The minibuffer-local-completion-map is shadowed to avoid
+	error with SPC (bound to minibuffer-complete-word). We really
+	need a better solution.
+2003-01-13  Bill Wohler  <>
+	* mh-seq.el: Edited comment and docstring text to conform with RFC
+	2822 terminology. Message-ID is the header field. It contains a
+	message identifier.
+2003-01-13  Satyaki Das  <>
+	* mh-utils.el (mh-sub-folders): Add an argument that returns
+	sub-folders with a / character appended at the end.
+	(mh-folder-completion-function): Modify the function so that one
+	tab is now sufficient to complete the folder name and add a
+	trailing /.
+	(mh-folder-completing-read): Remove the trailing / that the
+	completion function now adds to the folder name. Also multiple /
+	characters in the folder input are removed. So if the user inputs
+	+foo///bar//baz///// then that will be converted to +foo/bar/baz.
+	This will improve the performance of caching.
+	* mh-seq.el (mh-notate-cur): Check that a valid current message
+	exists before trying to notate (closes SF #667331).
+	(mh-message-id-regexp): New variable to store regexp to recognize
+	message-ids.
+	(mh-thread-generate): Use mh-message-id-regexp to filter out non
+	message-id's from the References: header.
+2003-01-12  Satyaki Das  <>
+	* mh-seq.el (mh-notate-cur): Disable overlay-arrow display if we
+	aren't on a graphic display.
+2003-01-11  Satyaki Das  <>
+	* mh-seq.el (mh-notate-cur): New function to notate the current
+	message. The marker in the fringe is updated too.
+	(mh-narrow-to-seq, mh-widen, mh-thread-inc, mh-thread-folder): Use
+	the specialized function mh-notate-cur instead of mh-notate-seq.
+	* mh-e.el (mh-arrow-marker): New buffer local variable to store
+	the position where the marker in the fringe is going to be
+	displayed (closes SF #664824).
+	(mh-folder-mode): Create a marker for the fringe.
+	(mh-update-sequences, mh-get-new-mail, mh-goto-cur-msg): Call the
+	specialized function mh-notate-cur instead of mh-notate-seq or
+	mh-notate.
+	(mh-remove-cur-notation, mh-remove-all-notation): Reset the
+	overlay-arrow-position if needed.
+	* mh-loaddefs.el: Regenerated.
+2003-01-10  Satyaki Das  <>
+	* mh-utils.el (mh-remove-from-sub-folders-cache): Modified so that
+	creating nested folders doesn't produce inconsistent results.
+	(mh-prompt-for-folder): Remove call of mh-folder-list-change-hook.
+	* mh-funcs.el (mh-kill-folder): Don't ask for confirmation if
+	called on a folder holding index search results. Also the now
+	removed mh-folder-list-change-hook is called no more.
+	* mh-customize.el (mh-auto-folder-collect-flag) 
+	(mh-folder-list-change-hook): Removed.
+	* mh-loaddefs.el: Regenerated.
+2003-01-10  Bill Wohler  <>
+	* mh-customize.el (mh-default-folder-must-exist-flag): New
+	variable to suppress suggested folder if the folder doesn't
+	already exist (closes SF #657096).
+	(mh-default-folder-list): New variable that
+	holds mapping between an address and the desired folder for
+	filing (closes SF #657096).
+	(mh-default-folder-prefix, mh-default-folder-must-exist-flag): In
+	docstring, refer to documentation for mh-prompt-for-refile-folder
+	and mh-folder-from-address.
+	(mh-highlight-citation-p, mh-compose-insertion,
+	(mh-insert-mail-followup-to-list, mh-index-program,
+	(mh-identity-default): Fixed case of tags.
+	* mh-e.el (mh-folder-from-address): Use new variable
+	mh-default-folder-must-exist-flag to return nil if this variable
+	is t and the folder doesn't already exist. In addition, can now
+	look up a default folder in the new variable
+	mh-default-folder-list (closes SF #657096).
+	(mh-prompt-for-refile-folder): In docstring, refer to
+	documentation in mh-folder-from-address.
+	* mh-index.el (mh-swish-execute-search): Changed \..* to \\..* in
+	the FileRules filename in the sample config file. Otherwise, the
+	users don't see the backslash at all, and no files are indexed!
+	(closes SF #665888).
+2003-01-10  Satyaki Das  <>
+	* mh-seq.el (mh-thread-folder): Get headers for exactly the
+	messages that are present. If only messages 1-10 and 3800-3900
+	are being shown then we will now scan exactly those messages and
+	not the full range from 1-3900 as was being done earlier.
+	(mh-toggle-threads): When converting from threaded to normal view
+	only the messages present in the buffer are scanned. Earlier all
+	messages from the minimum to the maximum would be scanned (closes
+	SF #626117).
+	* mh-pick.el (mh-search-folder): Fix typo.
+	(mh-pick-do-search): Fix bug from cut and paste. Also set window
+	config properly.
+	* mh-utils.el (mh-prompt-for-folder): Add new argument to allow
+	it to accept + as a folder name. This allows the user to search
+	all folders when "Fs" is used.
+	* mh-pick.el (mh-search-folder): Fix interactive spec of function.
+	(mh-pick-do-search): Rewritten to call pick in one go. This will
+	make adding pick as a default index search program easier. Also
+	pick now accepts the same query syntax as the index search
+	programs (closes SF #664816).
+	(mh-next-pick-field): Removed.
+	(mh-pick-parse-search-buffer): New function to parse the search
+	buffer.
+	(mh-pick-construct-regexp, mh-pick-regexp-builder): New function
+	to produce a pick query from the parsed representation.
+	* mh-index.el (mh-index-do-search): Refactor the search pattern
+	parser into a new function and use that instead.
+	* mh-loaddefs.el: Regenerated.
+2003-01-10  Satyaki Das  <>
+	* mh-loaddefs.el: Regenerated.
+	* mh-utils.el (mh-remove-from-sub-folders-cache)
+	(mh-prompt-for-folder): Replace mh-update-sub-folders-cache with
+	mh-remove-from-sub-folders-cache.
+	(mh-exec-cmd-daemon): Mention set-process-filter in documentation.
+	* mh-pick.el (mh-searching-function): New buffer local variable
+	that keeps track of the default searching function to be used.
+	(mh-pick-mode): Make mh-searching-function buffer local.
+	(mh-search-folder): Set mh-searching-function to use pick.
+	(mh-search-folder, mh-pick-menu, mh-pick-mode-help-messages) 
+	(mh-pick-mode, mh-do-pick-search, mh-pick-do-search): Rename
+	mh-do-pick-search to mh-pick-do-search. But keep
+	mh-do-pick-search as a deprecated function.
+	(mh-do-search): New interactive function that performs the
+	default search.
+	(mh-pick-mode-map): Update keymap.
+	* mh-index.el (mh-index-search): Set mh-searching-function to do
+	index search.
+	(mh-index-new-folder): Replace mh-update-sub-folders-cache with
+	mh-remover-from-sub-folders-cache.
+	* mh-funcs.el (mh-kill-folder): Same as above.
+	* mh-index.el (mh-index-evaluate, mh-swish++-regexp-builder):
+	Checkdoc fixes.
+	* mh-customize.el: Fixes to make byte compiler in CVS Emacs
+	perfectly happy.
+2003-01-09  Bill Wohler  <>
+	* mh-e.el (mh-folder-from-address): New function that proposes the
+	name of a folder with an alias for the address in the current message.
+	(mh-prompt-for-refile-folder): Use it (closes SF #657096).
+	* mh-customize.el (mh-default-folder-prefix): New variable used by
+	mh-folder-from-address.
+	(mh-invisible-header-fields): Edited docstring.
+	* mh-alias.el (mh-alias-address-to-alias): Added ;;;###mh-autoload
+	cookie (used by mh-folder-from-address in mh-e.el). Edited text in
+	comment.
+	* mh-utils.el: Provided naming conventions for buffer and buffer
+	variable names.
+	(mh-temp-folders-buffer): Renamed buffer to " *mh-folders*".
+	(mh-temp-sequences-buffer): Renamed buffer to " *mh-sequences*".
+	(mh-info-buffer): Renamed from mh-temp-info-buffer.
+	(mh-log-buffer): New buffer variable to hold name of "*MH-E Log*"
+	buffer which is expected to be used for the output of MH commands.
+	Perhaps we always create this buffer at initialization and append
+	to it rather than erase it each time?
+	* mh-e.el (mh-quit): Loop over all buffers and delete MH-E
+	temporary and working buffers. As long as the buffer naming
+	conventions are followed, new buffers will be automatically
+	killed.
+	(mh-version): Renamed mh-temp-info-buffer to mh-info-buffer.
+	* mh-comp.el (mh-insert-x-mailer): Renamed mh-temp-info-buffer to
+	mh-info-buffer.
+2003-01-09  Satyaki Das  <>
+	* mh-e.el (mh-folder-size): If the user doesn't have a
+	Unseen-Sequence definition in .mh_profile then an error was
+	produced. This change fixes that.
+	* mh-seq.el (mh-thread-generate): Replace the *mh-thread* buffer
+	with a temporary buffer which is cleaned up when the function
+	exits.
+	* mh-e.el (mh-prompt-for-refile-folder): New function which
+	refactors out the intelligent folder guessing code from
+	mh-refile-msg.
+	(mh-refile-msg): Use mh-prompt-for-refile-folder.
+	* mh-seq.el (mh-thread-refile): Use mh-prompt-for-refile-folder to
+	do the same intelligent destination folder guessing as
+	mh-refile-msg (closes SF #664829).
+	* mh-utils.el (mh-folder-list, mh-make-folder-list-process)
+	(mh-folder-list-temp, mh-folder-list-partial-line)
+	(mh-set-folder-list): Removed.
+	(mh-sub-folders-cache, mh-sub-folders, mh-sub-folders-actual):
+	Moved over from mh-speed.el to implement hierarchical completion.
+	(mh-update-sub-folders-cache): Utility function called when
+	new folders are created or folders are removed.
+	(mh-folder-completion-function): New function is the folder name
+	completion function used in completing-read.
+	(mh-folder-completing-read): A thin wrapper function that is used
+	instead of completing-read directly. In the future we might want
+	to allow the user a customizable variable which will turn off
+	folders based completion.
+	(mh-prompt-for-folder): Use mh-folder-completing-read to read in
+	the folder name with hierachical completion (closes SF #664821).
+	* mh-speed.el (mh-speed-folders, mh-speed-folders-cache)
+	(mh-speed-folders-actual): Moved to mh-utils.el as mh-sub-folders,
+	mh-sub-folders-cache and mh-sub-folders-actual respectively.
+	(mh-speed-invalidate-map, mh-speed-invalidate-map) 
+	(mh-speed-add-folder): Use the new names.
+	* mh-funcs.el (mh-kill-folder): Remove code that used to update
+	mh-folder-list which is no longer present. Instead
+	mh-update-sub-folders-cache is called.
+	* mh-index.el (mh-index-new-folder): Same as above.
+2003-01-08  Satyaki Das  <>
+	* mh-utils.el (mh-exec-cmd-daemon): An argument was added which
+	controls what is done with the process output.
+	* mh-funcs.el (mh-kill-folder): Use mh-previous-window-config to
+	restore window configuration. Also the call to mh-exec-cmd-daemon
+	only displays output if an error happened (closes SF #664828).
+	(mh-rmf-daemon): Check rmf output and display it only if
+	something went wrong.
+	(mh-print-msg): Pass in nil argument to mh-exec-cmd-daemon.
+	* mh-comp.el (mh-redistribute, mh-send-letter): Pass in nil
+	argument to mh-exec-cmd-daemon so that the functions will behave
+	as before.
+	* mh-pick.el (mh-search-folder): The current window config is
+	stored.
+	(mh-make-pick-template): Make the message headers read-only.
+	(mh-pick-mode-help-messages): Update help message.
+	(mh-do-pick-search): Fix problem when buffer isn't showing any
+	messages.
+	(mh-next-pick-field): Use buffer-substring-no-properties is
+	better.
+	(mh-pick-mode-map): Add key bindings (partially addresses
+	SF #664816)
+	* mh-index.el (mh-indexer-choices): Add a new field for each
+	index program choice. If it is non-nil then it is the name of a
+	function that given a lisp expression to search for generates a
+	pattern that is acceptable to the search program.
+	(mh-index-regexp-builder): New variable that stores the function
+	to be used to convert from the lisp expression syntax to
+	something that the search program understands.
+	(mh-index-generate-pretty-name): Generalized so that it can take
+	a list of strings as input.
+	(mh-index-search): Modified so that if the configured program has
+	a corresponding regexp-builder then a search buffer like pick
+	search is produced. Otherwise the previous behavior is maintained.
+	(mh-index-do-search): New interactive function that takes the
+	contents of the search buffer, generates an appropriate query and
+	produces the search results buffer by calling mh-index-search.
+	(mh-replace-string, mh-index-parse-search-regexp) 
+	(mh-index-add-implicit-ops, mh-index-evaluate): New functions
+	which parses the infix search expression that the user enters. A
+	parse tree from which queries for different search programs can
+	be produced is produced.
+	(mh-swish++-regexp-builder, mh-swish++-print-regexp): Takes the
+	internal form of the query and produces input suitable for
+	swish++.
+	* mh-loaddefs.el: Regenerated.
+2003-01-08  Bill Wohler  <>
+	* Makefile (emacs-logs): New target for viewing CVS Emacs logs.
+	Useful to see if an Emacs developer has changed MH-E.
+	* MH-E-NEWS: Fixed case of MH-E in the "Changes" title.	
+	* mh-utils.el (mh-temp-info-buffer): New variable to hold name of
+	buffer that contains version info.
+	* mh-e.el (mh-version): Use mh-temp-info-buffer instead of
+	mh-temp-buffer since version information was getting clobbered by
+	the aliasing code before it could be seen (closes SF #664467).
+	(mh-quit): Delete mh-temp-info-buffer.
+	* mh-comp.el (mh-insert-x-mailer): Use mh-temp-info-buffer to find
+	version info instead of mh-temp-buffer. You kind of need this
+	patch to send mail.
+2003-01-07  Bill Wohler  <>
+	* mh-e.el (Version, mh-version): Set to 7.1+cvs.
 2003-01-07  Bill Wohler  <>
 	* Released MH-E version 7.1.
 	mh-mime.el, mh-pick.el, mh-seq.el, mh-speed.el, mh-utils.el:
 	Ran indent-region, reformatted long lines, ran untabify.
 	(indent-tabs-mode): Set file local variable to nil.
 2002-11-29  Bill Wohler  <>
 	* Released MH-E version 7.0.
 	for which a Mail-Followup-To field is inserted.
 	(mh-re-search-to-cc): New function. Search for REGEXP in To: and
 	Cc: fields.
-	(mh-insert-mail-followup-to): New function. Insert
+	(mh-insert-mail-followup-to): New function.Insert
 	Mail-Followup-To: if To or Cc match `mh-insert-mail-followup-to-list'.
 	(mh-compose-and-send-mail): Call mh-insert-mail-followup-to if
 	mh-insert-mail-followup-to-flag is true.
 	(install): $MH-E-SRC is copied to $(EMACS_HOME)/lisp/mail, not
 	(dist): Leave release in current directory.
-* Changes in mh-e 7.1
+* Changes in MH-E 7.2
+This release includes the new features of filing hints, hierarchical
+file name completion, indexed search and pick integration, unification
+between `mh-visit-folder' and the speedbar, a displayed message
+indicator, buffer name organization, support for mairix indexed
+search, and last but not least, the MH-E logo has been added to the
+mode line. Code that handles sequences and message regions runs
+faster. Bugs have been fixed.
+** New Features in MH-E 7.2
+*** Filing Hints
+When you file a message, MH-E now looks for an alias corresponding to
+the address of the sender and offers that as a default folder (closes
+SF #657096). The new variable `mh-default-folder-prefix' can be used
+to put these folders in a sub-folder. The new variable
+`mh-default-folder-must-exist-flag' means to suppress the suggested
+folder (thereby providing the previous folder used) if the folder
+doesn't already exist. The new variable `mh-default-folder-list' can
+be used to map additional addresses and folders.
+*** Hierarchical File Name Completion
+When you completed filenames in the past, you were presented with a
+list of all your folders at all depths in the tree. Now you are
+presented with only one level at a time (closes SF #664821).
+As a result, the variables `mh-auto-folder-collect-flag' and
+`mh-folder-list-change-hook' are obsolete.
+*** Indexed Search and Pick Integration
+The indexed and pick searches have been integrated (closes SF
+#664816). Both "F s (mh-search-folder)" and "F i (mh-index-search)"
+use the pick template for forming queries. To submit the query, use
+"C-c C-c (mh-do-search)" which will use the query method you selected.
+If you change your mind while forming the query, you can use "C-c C-i
+(mh-index-do-search)" or "C-c C-p (mh-pick-do-search)" to submit the
+query using the respective method.
+Second, the results from a pick search are now saved in a sub-folder
+of +mhe-index like an indexed search.
+Third, `pick' is now a valid choice for `mh-index-program'.
+*** mh-visit-folder Metamorphosis Continues
+When visiting a folder from the speedbar, only the unseen messages are
+shown if there are unseen messages. If there aren't any unseen
+messages, all of the messages are shown if there are fewer than
+`mh-large-folder' messages; otherwise, the user is prompted for the
+range of messages to display. The "F v (mh-visit-folder)" command has
+been modified to mimic this behavior. Use a prefix arg to force the
+message range prompt.
+*** Displayed Message Indicator
+In graphical Emacs, the message that is shown is marked by a triangle
+in the fringe. In textual Emacs, there is a ">" in the first column
+(closes SF #664824).
+*** Buffer Name Organization
+All ephemeral buffer names start with " *mh" while all interesting
+buffers start with "*MH-E ". The "*Folders*", "*Sequences*", and
+"*Recipients*" buffers were therefore renamed to "*MH-E Folders*",
+"*MH-E Sequences*" and "*MH-E Recipients*" respectively (programmers
+should see mh-utils.el for the names of the new constants). Also, the
+output of MH commands is saved in the "*MH-E Log*" buffer.
+*** mh-index-program
+Add choices for `mairix' and `pick'.
+*** Logo Displayed on Mode Line
+** New Variables in MH-E 7.2
+The new variables have been discussed elsewhere.
+** Bug Fixes in MH-E 7.2
+*** mh-decode-content-transfer-encoded-message
+Messages that had been encoded with base64 were not decoded. This has
+been fixed with this new function (closes SF #674190). As a result,
+the variable `mh-decode-quoted-printable-flag' has been renamed to
+*** mh-kill-folder
+Now restores previous window configuration (closes SF #664828).
+*** mh-mime-display
+MH-E was not using the charset defined in the content-type
+header. This meant that mail in a different charset would not
+be properly displayed. This has been fixed (closes SF #655123).
+*** mh-read-address
+In XEmacs and Emacs20, this function would always prompt using "To: "
+instead of using the command argument. This has been fixed (closes SF
+*** mh-rmail
+Unseen messages are now shown in addition to new ones (closes SF
+*** mh-scan-msg-overflow-regexp
+Change the variable so that a space is always maintained in the
+beginning of the scan line.
+*** mh-swish-execute-search
+The example configuration file in the docstring didn't show the
+backslash in the FileRules filename. If the example had been used
+literally by the user, no files would be indexed! This has been fixed
+(closes SF #665888).
+*** mh-thread-refile
+The "T o (mh-thread-refile)" command did not provide refiling hints
+like `mh-refile-msg'. This has been fixed (closes SF #664829).
+*** mh-toggle-threads
+If the threaded view was modified and then toggled, the standard view
+may not have been accurate (as it contained a potentially old first
+message to last message range). This has been fixed (closes SF
+*** mh-tool-bar-show-set, mh-tool-bar-letter-set, mh-tool-bar-folder-set
+Clicking the customize and help buttons now deletes the other windows
+in the frame.
+*** mh-version
+The "M-x mh-version" command displayed "Aliasfile: aliases". This has
+been fixed (closes SF #664467). See Buffer Name Organization above.
+* Changes in MH-E 7.1
 This release includes the new features of multiple identities and
 alias completion. In addition, indexed searching has been revamped.
-* Changes in mh-e 7.0
+* Changes in MH-E 7.0
 This is a major release which includes a lot of new features including
 improved MIME handling, speedbar folder browsing, and indexed
 # Boston, MA 02111-1307, USA.
 VERSION = 1.17
 MAINTAINER = Steve Youngs <>
 PACKAGE = mh-e
 PKG_TYPE = regular
 files, run the command "M-x mh-version" within Emacs. If this package
 contains a more recent version of MH-E, read on.
-This version of MH-E will appear in GNU Emacs 21.4. It is supported in
-GNU Emacs 21, as well as XEmacs 21 and GNU Emacs 20.7.
+This version of MH-E will appear in GNU Emacs 21.4 (unless it is
+superseded by a newer version). It is supported in GNU Emacs 20.7 and
+21, as well as XEmacs 21 (except for 21.5.9). It is compatible with MH
+versions 6.8.4 and higher and all versions of nmh.
 If you don't have GNU tar, use gzip to uncompress the tarball and drop
 the `z' option.
-	tar xzf mh-e-7.1.tgz
+	tar xzf mh-e-7.2.tgz
 ** Compile.
 It is suggested, but not required, to compile MH-E. To do so, run
 `make' in the distribution directory:
-	cd mh-e-7.1
+	cd mh-e-7.2
 If you run Emacs by any name other than `emacs', use the following
-	cd mh-e-7.1
+	cd mh-e-7.2
 	make EMACS=myemacs
 Note that the Makefile assumes an XEmacs variant if `xemacs' appears
 load path, or you could add something like the following to your
-	(add-to-list 'load-path (expand-file-name "~/mh-e-7.1"))
+	(add-to-list 'load-path (expand-file-name "~/mh-e-7.2"))
 ** Read the commentary at the top of mh-e.el.
 ;;  `mh-alias-insert-file').  In particular, there is a tool-bar icon to grab
 ;;  an alias from the From line of the current message.
+;;; Change Log:
+;; $Id$
 ;;; Code:
 (require 'mh-e)
                   (multi-prompt "," nil prompt mh-alias-alist nil nil))
-                   (completing-read "To: " mh-alias-alist nil nil)
+                   (completing-read prompt mh-alias-alist nil nil)
       (if (not mh-alias-expand-aliases-flag)
           (mapconcat 'identity the-answer ", ")
             (completing-read "Alias file [press Tab]: "
                              (mapcar 'list autolist) nil t))))))))
 (defun mh-alias-address-to-alias (address)
   "Return the ADDRESS alias if defined, or nil."
   (let* ((aliases (mh-alias-ali address t)))
     (if (string-equal aliases address)
         nil                             ; ali returned same string -> no.
-      ;; For the comma-separated aliases reyurned by ali, check that one of
-      ;; them doesn't expand into a list.  e.g. we do have an individual
-      ;; alias for that adress.
+      ;; Double-check that we have an individual alias. This means that the
+      ;; alias doesn't expand into a list (of which this address is part).
       (car (delq nil (mapcar
                        (lambda (alias)
                 ((string-match "^a" answer)
                  (forward-line 1))
-                 error "Quitting."))))
+                 (error "Quitting")))))
        ;; No, so sort-in at the right place
        ;; search for "^alias", then "^alia", etc.
        ((eq mh-alias-insertion-location 'sorted)
                        "-component" "Resent:"
                        "-text" (format "\"%s %s\"" to cc))
       (if mh-redist-background
-          (mh-exec-cmd-daemon "/bin/sh" "-c"
+          (mh-exec-cmd-daemon "/bin/sh" nil "-c"
                               (format "mhdist=1 mhaltmsg=%s %s %s %s"
                                       (if mh-redist-full-contents
   (let ((file-name buffer-file-name))
     (message "Checking recipients...")
-    (mh-in-show-buffer ("*Recipients*")
+    (mh-in-show-buffer (mh-recipients-buffer)
       (bury-buffer (current-buffer))
       (mh-exec-cmd-output "whom" t file-name))
     (message "Checking recipients...done")))
+(defun mh-tidy-draft-buffer ()
+  "Run when a draft buffer is destroyed."
+  (let ((buffer (get-buffer mh-recipients-buffer)))
+    (if buffer
+	(kill-buffer buffer))))
 ;;; Routines to compose and send a letter.
   ;; Lazily initialize mh-x-mailer-string.
   (when (null mh-x-mailer-string)
-      (mh-version)
-      (set-buffer mh-temp-buffer)
-      (if mh-nmh-flag
-          (search-forward-regexp "^nmh-\\(\\S +\\)")
-        (search-forward-regexp "^MH \\(\\S +\\)" nil t))
-      (let ((x-mailer-mh (buffer-substring (match-beginning 1) (match-end 1))))
-        (setq mh-x-mailer-string
-              (format "MH-E %s; %s %s; %s %d.%d"
-                      mh-version (if mh-nmh-flag "nmh" "MH") x-mailer-mh
-                      (if mh-xemacs-flag
-                          "XEmacs"
-                        "Emacs")
-                      emacs-major-version emacs-minor-version)))
-      (kill-buffer mh-temp-buffer)))
+      ;; User would be confused if version info buffer disappeared magically,
+      ;; so don't delete buffer if it already existed.
+      (let ((info-buffer-exists-p (get-buffer mh-info-buffer)))
+        (mh-version)
+        (set-buffer mh-info-buffer)
+        (if mh-nmh-flag
+            (search-forward-regexp "^nmh-\\(\\S +\\)")
+          (search-forward-regexp "^MH \\(\\S +\\)" nil t))
+        (let ((x-mailer-mh (buffer-substring (match-beginning 1)
+                                             (match-end 1))))
+          (setq mh-x-mailer-string
+                (format "MH-E %s; %s %s; %sEmacs %s"
+                        mh-version (if mh-nmh-flag "nmh" "MH") x-mailer-mh
+                        (if mh-xemacs-flag "X" "GNU ")
+                        (cond ((not mh-xemacs-flag) emacs-version)
+                              ((string-match "[0-9.]*\\( +\([ a-z]+[0-9]+\)\\)?"
+                                             emacs-version)
+                               (match-string 0 emacs-version))
+                              (t (format "%s.%s"
+                                         emacs-major-version
+                                         emacs-minor-version))))))
+        (if (not info-buffer-exists-p)
+            (kill-buffer mh-info-buffer)))))
   ;; Insert X-Mailer, but only if it doesn't already exist.
     (when (null (mh-goto-header-field "X-Mailer"))
   (setq mh-annotate-char annotate-char)
   (setq mh-annotate-field annotate-field)
   (setq mh-previous-window-config config)
-  (setq mode-line-buffer-identification (list "{%b}"))
+  (setq mode-line-buffer-identification (list "    {%b}"))
+  (mh-logo-display)
+  (add-hook 'kill-buffer-hook 'mh-tidy-draft-buffer nil t)
   (if (and (boundp 'mh-compose-letter-function)
       ;; run-hooks will not pass arguments.
            (recenter -1)
            (set-buffer draft-buffer))   ; for annotation below
-           (mh-exec-cmd-daemon mh-send-prog "-nodraftfolder" "-noverbose"
+           (mh-exec-cmd-daemon mh-send-prog nil "-nodraftfolder" "-noverbose"
                                mh-send-args file-name)))
     (if mh-annotate-char
         (mh-annotate-msg mh-sent-from-msg
 ;; $Id$
 ;;; Code:
+(provide 'mh-customize)
+(require 'mh-e)
-(defun mh-customize ()
-  "Customize MH-E variables."
-  (interactive)
-  (customize-group 'mh))
+(defun mh-customize (&optional delete-other-windows-flag)
+  "Customize MH-E variables.
+With optional argument DELETE-OTHER-WINDOWS-FLAG, other windows in the frame
+are removed."
+  (interactive "P")
+  (customize-group 'mh)
+  (when delete-other-windows-flag
+    (delete-other-windows)))
 ;;; MH-E Customization Groups
        (if (member mh-tool-bar-item-prefs mh-tool-bar-folder-buttons)
            (tool-bar-add-item "preferences" (lambda ()
-                                              (customize-group "mh"))
+                                              (mh-customize t))
                               :help mh-tool-bar-item-prefs))
        (if (member mh-tool-bar-item-help mh-tool-bar-folder-buttons)
            (tool-bar-add-item "help" (lambda ()
-                                       (Info-goto-node "(mh-e)Top"))
+                                       (Info-goto-node "(mh-e)Top")
+                                       (delete-other-windows))
                               :help mh-tool-bar-item-help))
        (if (member mh-tool-bar-item-comp-prefs mh-tool-bar-letter-buttons)
           (tool-bar-add-item "preferences" (lambda ()
-                                             (customize-group "mh-compose"))
+                                             (mh-customize t))
                              :help mh-tool-bar-item-comp-prefs))
        (if (member mh-tool-bar-item-help mh-tool-bar-letter-buttons)
           (tool-bar-add-item "help" (lambda ()
-                                      (Info-goto-node "(mh-e)Draft Editing"))
+                                      (Info-goto-node "(mh-e)Draft Editing")
+                                      (delete-other-windows))
                              :help mh-tool-bar-item-help))
        (if (member mh-tool-bar-item-prefs mh-tool-bar-folder-buttons)
            (tool-bar-add-item "preferences" (lambda ()
-                                              (customize-group "mh"))
+                                              (mh-customize t))
                               :help mh-tool-bar-item-prefs))
        (if (member mh-tool-bar-item-help mh-tool-bar-folder-buttons)
            (tool-bar-add-item "help" (lambda ()
-                                       (Info-goto-node "(mh-e)Top"))
+                                       (Info-goto-node "(mh-e)Top")
+                                       (delete-other-windows))
                               :help mh-tool-bar-item-help))
   :type 'boolean
   :group 'mh-speed)
 ;;; Options for controlling scan listing (:group 'mh-folder)
 (defcustom mh-adaptive-cmd-note-flag t
   :type 'boolean
   :group 'mh-folder)
-(defcustom mh-auto-folder-collect-flag t
-  "*Non-nil means to collect all folder names at startup in the background.
-Otherwise, the internal list of folder names is built as folders are
+(defcustom mh-default-folder-list nil
+  "*Alist of addresses and folders.
+When refiling messages, these folders are the default that is provided if the
+sender has the associated address. You do not need to list your aliases here
+as that lookup is already performed.
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
+  :type '(repeat (list (string :tag "Address")
+                       (string :tag "Folder")))
+  :group 'mh-folder)
+(defcustom mh-default-folder-must-exist-flag t
+  "*Non-nil means guessed folder name must exist to be used.
+If this variable is t, then the guessed name is only used if the folder
+already exists\; if the folder doesn't exist, then the last folder name used
+is suggested. This is useful if you get mail from various people for whom you
+have an alias, but file them all in the same project folder.
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
   :type 'boolean
   :group 'mh-folder)
+(defcustom mh-default-folder-prefix ""
+  "*Prefix used for guessed folder names.
+This can be used to put folders associated with your aliases in a sub-folder
+so as to not clutter your mail directory.
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
+  :type 'string
+  :group 'mh-folder)
 (defcustom mh-inc-prog "inc"
   "*Program to run to incorporate new mail into a folder.
 Normally \"inc\".  This file is searched for relative to
   :type 'boolean
   :group 'mh-folder)
 ;;; Message display (:group 'mh-show)
 (defcustom mh-bury-show-buffer-flag t
   :type 'boolean
   :group 'mh-show)
-(defcustom mh-decode-quoted-printable-flag
-  (not (null (and (fboundp 'executable-find)(executable-find "mimedecode"))))
-  "Non-nil means decode quoted-printable MIME part with `mimedecode'.
+(defcustom mh-decode-content-transfer-encoded-message-flag
+  (and (fboundp 'executable-find) (executable-find "mimencode") t)
+  "Non-nil means decode messages with `mimencode', if necessary.
-Quoted-printable message parts are translated to 8-bit characters by the
-`mimedecode' command. However, unless there is only one quoted-printable body
-part, Gnus will have already decoded the quoted-printable parts.
+Messages which are encoded as quoted-printable or base64 are translated into
+8-bit characters by the `mimencode' command.
-This variable is initialized t if `mimedecode' is available.
+This variable is initialized to t if `mimencode' is available.
-The source code for `mimedecode' can be obtained from
+The `mimencode' program is part of the metamail package. The source can be
+obtained from
   :type 'boolean
   :group 'mh-show)
 (defcustom mh-highlight-citation-p 'gnus
   "How to highlight citations in show buffers.
 The gnus method uses a different color for each indentation."
-  :type '(choice (const :tag "Use gnus" gnus)
+  :type '(choice (const :tag "Use Gnus" gnus)
                  (const :tag "Use font-lock" font-lock)
                  (const :tag "Don't fontify" nil))
   :group 'mh-show)
   (setq mh-invisible-headers
-         (let ((max-specpdl-size 1000)) ;workaround for insufficient default
-           (regexp-opt
-            (append
-             (if (not mh-show-use-xface-flag)
-                 '("X-Face: "))
-             mh-invisible-header-fields))))))
+         (let ((max-specpdl-size 1000) ;workaround for insufficient default
+               (fields (append (if (not mh-show-use-xface-flag)
+                                   '("X-Face: "))
+                               mh-invisible-header-fields)))
+           (regexp-opt fields t)))))
 (defun mh-invisible-header-fields-set (symbol value)
   "Update `mh-invisible-header-fields'.
     "X-Mailing-List: "                  ; Unknown mailing list managers
     "X-Mailman-Version: "               ; Mailman mailing list manager
+    "X-MHE-Checksum"                    ; Checksum added during index search
     "X-MimeOLE: "                       ; MS Outlook
     "X-Mozilla-Status: "                ; Netscape/Mozilla
     "X-Msmail-"                         ; MS Outlook
     "X400-"                             ; X400
     "Xref: ")
 "*List of header fields that are not to be shown.
-Regexps are not allowed. Unique fields should have a \": \" suffix;
-otherwise, the element can be used to render an entire class of fields
-that start with the same prefix invisible.
+Regexps are not allowed. Unique fields should have a \": \" suffix; otherwise,
+the element can be used to render invisible an entire class of fields that
+start with the same prefix.
 This variable is ignored if `mh-visible-headers' is set."
   :type '(repeat (string :tag "Header field"))
   :set 'mh-invisible-header-fields-set
   :group 'mh-show)
 ;;; Composing messages (:group 'mh-letter)
 (defcustom mh-compose-insertion (if (locate-library "mml") 'gnus 'mhn)
   "Use either 'gnus or 'mhn to insert MIME message directives in messages."
-  :type '(choice (const :tag "Use gnus" gnus)
+  :type '(choice (const :tag "Use Gnus" gnus)
                  (const :tag "Use mhn"  mhn))
   :group 'mh-letter)
 While it might be tempting to add a descriptive name to the mailing list
 address, consider that this field will appear in other people's outgoing
 mail in their To: field.  It might be best to keep it simple."
-  :type '(repeat (list (string :tag "regexp") (string :tag "address")))
+  :type '(repeat (list (string :tag "Regexp")
+                       (string :tag "Address")))
   :group 'mh-letter)
 (defcustom mh-insert-x-mailer-flag t
   :type '(choice function (const nil))
   :group 'mh-letter)
 ;;; Alias handling (:group 'mh-alias)
 (defcustom mh-alias-system-aliases
                  (const :tag "At the bottom of file" bottom))
   :group 'mh-alias)
 ;;; Indexed searching (:group 'mh-index)
 (defcustom mh-index-program nil
   "Indexing program that MH-E shall use.
-The possible choices are swish++, swish-e, namazu, glimpse and grep. By
-default this variable is nil which means that the programs are tried in order
-and the first one found is used."
-  :type '(choice (const :tag "auto-detect" nil)
+The possible choices are swish++, swish-e, mairix, namazu, glimpse, pick and
+grep. By default this variable is nil which means that the programs are tried
+in order and the first one found is used.
+More information about setting up an indexing program to use with MH-E can be
+found in the documentation of `mh-index-search'."
+  :type '(choice (const :tag "Auto-detect" nil)
                  (const :tag "swish++" swish++)
                  (const :tag "swish-e" swish)
+                 (const :tag "mairix" mairix)
                  (const :tag "namazu" namazu)
                  (const :tag "glimpse" glimpse)
+                 (const :tag "pick" pick)
                  (const :tag "grep" grep))
   :group 'mh-index)
 ;;; Multiple personalities (:group 'mh-identity)
 (defcustom mh-identity-list nil
   ;;                (const "work"))
   :type (append
-         (cons '(const :tag "none" nil)
+         (cons '(const :tag "None" nil)
                (mapcar (function (lambda (arg) `(const ,arg)))
                        (mapcar 'car mh-identity-list))))
   :group 'mh-identity)
 ;;; Hooks (:group 'mh-hooks + group where hook defined)
 ;;; These are alphabetized. All hooks should be placed in the 'mh-hook group;
   :group 'mh-hooks
   :group 'mh-folder)
-(defcustom mh-folder-list-change-hook nil
-  "Invoked whenever the cached folder list `mh-folder-list' is changed."
-  :type 'hook
-  :group 'mh-hooks
-  :group 'mh-folder)
 (defcustom mh-folder-mode-hook nil
   "Invoked in `mh-folder-mode' on a new folder."
   :type 'hook
   "Face used for the current folder when it has unread messages."
   :group 'mh-speed-faces)
 ;;; Faces used in scan listing (:group mh-folder-faces)
 (defvar mh-folder-body-face 'mh-folder-body-face
   "Face for highlighting the To: string in MH-Folder buffers."
   :group 'mh-folder-faces)
 ;;; Faces used in message display (:group mh-show-faces)
 (defvar mh-show-cc-face 'mh-show-cc-face
   "Face for highlighting the Subject header field.")
 (copy-face 'mh-folder-subject-face 'mh-show-subject-face)
 ;;; Faces used in indexed searches (:group mh-index-faces)
 (defvar mh-index-folder-face 'mh-index-folder-face
   "Face for highlighting folders in MH-Index buffers."
   :group 'mh-index-faces)
-(provide 'mh-customize)
 ;;; Local Variables:
 ;;; indent-tabs-mode: nil
 ;;; sentence-end-double-space: nil
 ;; Author: Bill Wohler <>
 ;; Maintainer: Bill Wohler <>
-;; Version: 7.1
+;; Version: 7.2
 ;; Keywords: mail
 ;; This file is part of GNU Emacs.
 (defvar font-lock-auto-fontify)
 (defvar font-lock-defaults)
-(defconst mh-version "7.1" "Version number of MH-E.")
+(defconst mh-version "7.2" "Version number of MH-E.")
 ;;; Autoloads
 (autoload 'Info-goto-node "info")
 (defvar mh-folder-mode-map (make-keymap)
   "Keymap for MH folders.")
+(defvar mh-arrow-marker nil)            ;Marker for arrow display in fringe.
 (defvar mh-delete-list nil)             ;List of msg numbers to delete.
 (defvar mh-refile-list nil)             ;List of folder names in mh-seq-list.
   (if arg
       (call-interactively 'mh-visit-folder)
+    (unless (get-buffer mh-inbox)
+      (mh-visit-folder mh-inbox (symbol-name mh-unseen-seq)))
 and the mark is active, then the selected region is marked for deletion."
   (interactive (list (cond
                       ((mh-mark-active-p t)
-                       (mh-region-to-msg-list (region-beginning) (region-end)))
+                       (cons (region-beginning) (region-end)))
                        (mh-read-seq-default "Delete" t))
-                       (mh-get-msg-num t)))))
+                       (cons (line-beginning-position) (line-end-position))))))
   (mh-delete-msg-no-motion msg-or-seq)
   (interactive (list (if current-prefix-arg
                          (mh-read-seq-default "Delete" t)
                        (mh-get-msg-num t))))
-  (if (numberp msg-or-seq)
-      (mh-delete-a-msg msg-or-seq)
-    (mh-map-to-seq-msgs 'mh-delete-a-msg msg-or-seq)))
+  (cond ((numberp msg-or-seq)
+         (mh-delete-a-msg msg-or-seq))
+        ((and (consp msg-or-seq)
+              (numberp (car msg-or-seq)) (numberp (cdr msg-or-seq)))
+         (mh-iterate-on-messages-in-region () (car msg-or-seq) (cdr msg-or-seq)
+           (mh-delete-a-msg nil)))
+        (t (mh-map-to-seq-msgs 'mh-delete-a-msg msg-or-seq))))
 (defun mh-execute-commands ()
   "Process outstanding delete and refile requests."
   (let ((mh-decode-mime-flag nil)
         (mhl-formfile nil)
+        (mh-decode-content-transfer-encoded-message-flag nil)
         (mh-clean-message-header-flag nil))
     (mh-show-msg nil)
     (mh-in-show-buffer (mh-show-buffer)
         (t (forward-line -1)
            (message "No more undeleted messages"))))
+(defun mh-folder-from-address ()
+  "Determine folder name from address in From field.
+Takes the address in the From: header field, and returns one of:
+  a) The folder name associated with the address in the alist
+     `mh-default-folder-list'.
+  b) The address' corresponding alias from the user's personal
+     aliases file prefixed by `mh-default-folder-prefix'.
+Returns nil if the address was not found in either place or if the variable
+`mh-default-folder-must-exist-flag' is nil and the folder does not exist."
+  ;; Is address in mh-default-folder-list?
+  (let* ((address
+          (nth 1 (mail-extract-address-components
+                  (mh-extract-from-header-value))))
+         (folder-name
+          (nth 1 (assoc-ignore-case address mh-default-folder-list))))
+    ;; If not, is there an alias for the address?
+    (if (not folder-name)
+        (let* ((alias (mh-alias-address-to-alias address)))
+          (setq folder-name
+                (and alias (concat "+" mh-default-folder-prefix alias)))))
+    ;; If mh-default-folder-must-exist-flag set, check that folder exists.
+    (if (and folder-name
+             (or (not mh-default-folder-must-exist-flag)
+                 (file-exists-p (mh-expand-file-name folder-name))))
+        folder-name)))
+(defun mh-prompt-for-refile-folder ()
+  "Prompt the user for a folder in which the message should be filed.
+The folder is returned as a string.
+If `mh-default-folder-for-message-function' is a function then the message
+being refiled is yanked into a temporary buffer and the function is called to
+intelligently guess where the message is to be refiled.
+Otherwise, a default folder name is generated by `mh-folder-from-address'."
+  (mh-prompt-for-folder
+   "Destination"
+   (let ((refile-file (mh-msg-filename (mh-get-msg-num t))))
+     (save-excursion
+       (set-buffer (get-buffer-create mh-temp-buffer))
+       (erase-buffer)
+       (insert-file-contents refile-file)
+       (or (and mh-default-folder-for-message-function
+                (let ((buffer-file-name refile-file))
+                  (funcall mh-default-folder-for-message-function)))
+           (mh-folder-from-address)
+           (and (eq 'refile (car mh-last-destination-folder))
+                (symbol-name (cdr mh-last-destination-folder)))
+           "")))
+   t))
 (defun mh-refile-msg (msg-or-seq folder)
   "Refile MSG-OR-SEQ (default: displayed message) into FOLDER.
 If optional prefix argument provided, then prompt for message sequence.
    (list (cond
           ((mh-mark-active-p t)
-           (mh-region-to-msg-list (region-beginning) (region-end)))
+           (cons (region-beginning) (region-end)))
            (mh-read-seq-default "Refile" t))
-           (mh-get-msg-num t)))
-         (intern
-          (mh-prompt-for-folder
-           "Destination"
-           (or (and mh-default-folder-for-message-function
-                    (let ((refile-file (mh-msg-filename (mh-get-msg-num t))))
-                      (save-excursion
-                        (set-buffer (get-buffer-create mh-temp-buffer))
-                        (erase-buffer)
-                        (insert-file-contents refile-file)
-                        (let ((buffer-file-name refile-file))
-                          (funcall mh-default-folder-for-message-function)))))
-               (and (eq 'refile (car mh-last-destination-folder))
-                    (symbol-name (cdr mh-last-destination-folder)))
-               "")
-           t))))
+           (cons (line-beginning-position) (line-end-position))))
+         (intern (mh-prompt-for-refile-folder))))
   (setq mh-last-destination (cons 'refile folder)
         mh-last-destination-folder mh-last-destination)
-  (if (numberp msg-or-seq)
-      (mh-refile-a-msg msg-or-seq folder)
-    (mh-map-to-seq-msgs 'mh-refile-a-msg msg-or-seq folder))
+  (cond ((numberp msg-or-seq)
+         (mh-refile-a-msg msg-or-seq folder))
+        ((and (consp msg-or-seq)
+              (numberp (car msg-or-seq)) (numberp (cdr msg-or-seq)))
+         (mh-iterate-on-messages-in-region () (car msg-or-seq) (cdr msg-or-seq)
+           (mh-refile-a-msg nil folder)))
+        (t (mh-map-to-seq-msgs 'mh-refile-a-msg msg-or-seq folder)))
 (defun mh-refile-or-write-again (message)
 The value of `mh-before-quit-hook' is a list of functions to be called, with
 no arguments, immediately upon entry to this function.
 The value of `mh-quit-hook' is a list of functions to be called, with no
-arguments, upon exit of this function."
+arguments, upon exit of this function.
+MH-E working buffers (whose name begins with \" *mh-\" or \"*MH-E \") are
   (run-hooks 'mh-before-quit-hook)
   (let ((show-buffer (get-buffer mh-show-buffer)))
   (bury-buffer (current-buffer))
-  (if (get-buffer mh-temp-buffer)
-      (kill-buffer mh-temp-buffer))
-  (if (get-buffer mh-temp-folders-buffer)
-      (kill-buffer mh-temp-folders-buffer))
-  (if (get-buffer mh-temp-sequences-buffer)
-      (kill-buffer mh-temp-sequences-buffer))
+  ;; Delete all MH-E temporary and working buffers.
+  (dolist (buffer (buffer-list))
+    (when (or (string-match "^ \\*mh-" (buffer-name buffer))
+              (string-match "^\\*MH-E " (buffer-name buffer)))
+      (kill-buffer buffer)))
   (if mh-previous-window-config
       (set-window-configuration mh-previous-window-config))
   (run-hooks 'mh-quit-hook))
 selected region is unmarked."
   (interactive (list (cond
                       ((mh-mark-active-p t)
-                       (mh-region-to-msg-list (region-beginning) (region-end)))
+                       (cons (region-beginning) (region-end)))
                        (mh-read-seq-default "Undo" t))
              (goto-char original-position)
              (error "Nothing to undo"))))
+        ((and (consp msg-or-seq)
+              (numberp (car msg-or-seq)) (numberp (cdr msg-or-seq)))
+         (mh-iterate-on-messages-in-region () (car msg-or-seq) (cdr msg-or-seq)
+           (mh-undo-msg nil)))
          (mh-map-to-seq-msgs 'mh-undo-msg msg-or-seq)))
   (if (not (mh-outstanding-commands-p))
   "Display version information about MH-E and the MH mail handling system."
-  (set-buffer (get-buffer-create mh-temp-buffer))
+  (set-buffer (get-buffer-create mh-info-buffer))
   ;; MH-E version.
   (insert "MH-E " mh-version "\n\n")
       (call-process "uname" nil t nil "-a")
   (goto-char (point-min))
-  (display-buffer mh-temp-buffer))
+  (display-buffer mh-info-buffer))
-(defun mh-parse-flist-output-line (line)
-  "Parse LINE to generate folder name, unseen messages and total messages."
+(defun mh-parse-flist-output-line (line &optional current-folder)
+  "Parse LINE to generate folder name, unseen messages and total messages.
+If CURRENT-FOLDER is non-nil then it contains the current folder name and it is
+used to avoid problems in corner cases involving folders whose names end with a
+'+' character."
     (insert line)
     (goto-char (point-max))
           (when (search-backward " has " (point-min) t)
             (setq unseen (read-from-string (buffer-substring-no-properties
                                             (match-end 0) p)))
-            (while (or (eq (char-after) ?+) (eq (char-after) ? ))
+            (while (eq (char-after) ? )
             (setq folder (buffer-substring-no-properties
                           (point-min) (1+ (point))))
+            (when (and (equal (aref folder (1- (length folder))) ?+)
+                       (equal current-folder folder))
+              (setq folder (substring folder 0 (1- (length folder)))))
             (values (format "+%s" folder) (car unseen) (car total))))))))
 (defun mh-folder-size (folder)
   "Find size of FOLDER."
     (call-process (expand-file-name "flist" mh-progs) nil t nil
-                  "-norecurse" folder)
+                  "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))
     (goto-char (point-min))
     (multiple-value-bind (folder1 unseen total)
          (buffer-substring (point) (line-end-position)))
-      (unless (equal folder folder1)
-        (error "Call to flist failed on folder %s" folder))
       (values total unseen))))
 (defun mh-visit-folder (folder &optional range index-data)
 then all messages in FOLDER are displayed.
 If an index buffer is being created then INDEX-DATA is used to initialize the
-index buffer specific data structures."
+index buffer specific data structures.
+A prefix argument will cause a prompt for the RANGE of messages
+regardless of the size of the `mh-large-folder' variable."
   (interactive (let ((folder-name (mh-prompt-for-folder "Visit" mh-inbox t)))
-                 (list folder-name (mh-read-msg-range folder-name))))
+                 (list folder-name
+                       (mh-read-msg-range folder-name current-prefix-arg))))
   (let ((config (current-window-configuration))
         (threaded-view-flag mh-show-threads-flag))
           (mh-define-sequence 'cur (list new-cur))
           (if (looking-at mh-scan-good-msg-regexp)
-              (mh-notate nil mh-note-cur mh-cmd-note)))
+              (mh-notate-cur)))
       (or folder-set
             ;; psg - mh-current-folder is nil if mh-summary-height < 4 !
 (defun mh-delete-a-msg (msg)
   "Delete the MSG.
+If MSG is nil then the message at point is deleted.
 The value of `mh-delete-msg-hook' is a list of functions to be called, with no
 arguments, after the message has been deleted."
-    (mh-goto-msg msg nil t)
+    (if (numberp msg)
+        (mh-goto-msg msg nil t)
+      (beginning-of-line)
+      (setq msg (mh-get-msg-num t)))
     (if (looking-at mh-scan-refiled-msg-regexp)
         (error "Message %d is refiled.  Undo refile before deleting" msg))
     (if (looking-at mh-scan-deleted-msg-regexp)
       (mh-set-folder-modified-p t)
       (setq mh-delete-list (cons msg mh-delete-list))
-      (mh-notate msg mh-note-deleted mh-cmd-note)
+      (mh-notate nil mh-note-deleted mh-cmd-note)
       (run-hooks 'mh-delete-msg-hook))))
 (defun mh-refile-a-msg (msg folder)
   "Refile MSG in FOLDER.
+If MSG is nil then the message at point is refiled.
 Folder is a symbol, not a string.
 The value of `mh-refile-msg-hook' is a list of functions to be called, with no
 arguments, after the message has been refiled."
-    (mh-goto-msg msg nil t)
+    (if (numberp msg)
+        (mh-goto-msg msg nil t)
+      (beginning-of-line)
+      (setq msg (mh-get-msg-num t)))
     (cond ((looking-at mh-scan-deleted-msg-regexp)
            (error "Message %d is deleted.  Undo delete before moving" msg))
           ((looking-at mh-scan-refiled-msg-regexp)
                   (push (list folder msg) mh-refile-list))
                  ((not (member msg (cdr (assoc folder mh-refile-list))))
                   (push msg (cdr (assoc folder mh-refile-list)))))
-           (mh-notate msg mh-note-refiled mh-cmd-note)
+           (mh-notate nil mh-note-refiled mh-cmd-note)
            (run-hooks 'mh-refile-msg-hook)))))
 (defun mh-next-msg ()
       (mh-recenter nil)))
 (defun mh-undo-msg (msg)
-  "Undo the deletion or refile of one MSG."
-  (cond ((memq msg mh-delete-list)
-         (setq mh-delete-list (delq msg mh-delete-list)))
-        (t
-         (dolist (folder-msg-list mh-refile-list)
-           (setf (cdr folder-msg-list) (remove msg (cdr folder-msg-list))))
-         (setq mh-refile-list (loop for x in mh-refile-list
-                                    unless (null (cdr x)) collect x))))
-  (mh-notate msg ?  mh-cmd-note))
+  "Undo the deletion or refile of one MSG.
+If MSG is nil then act on the message at point"
+  (save-excursion
+    (if (numberp msg)
+        (mh-goto-msg msg t t)
+      (beginning-of-line)
+      (setq msg (mh-get-msg-num t)))
+    (cond ((memq msg mh-delete-list)
+           (setq mh-delete-list (delq msg mh-delete-list)))
+          (t
+           (dolist (folder-msg-list mh-refile-list)
+             (setf (cdr folder-msg-list) (remove msg (cdr folder-msg-list))))
+           (setq mh-refile-list (loop for x in mh-refile-list
+                                      unless (null (cdr x)) collect x))))
+    (mh-notate nil ?  mh-cmd-note)))
    'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs
    'mh-folder-filename                  ; e.g. "/usr/foobar/Mail/inbox/"
    (file-name-as-directory (mh-expand-file-name (buffer-name)))
+   'mh-arrow-marker (make-marker)       ; Marker where arrow is displayed
+   'overlay-arrow-position nil          ; Allow for simultaneous display in
+   'overlay-arrow-string ">"            ;  different MH-E buffers.
    'mh-showing-mode nil                 ; Show message also?
    'mh-delete-list nil                  ; List of msgs nums to delete
    'mh-refile-list nil                  ; List of folder names in mh-seq-list
           (message "Folder %s is empty" folder)
         (message "No messages in %s, range %s" folder range))
-  (save-excursion
-    (when dont-exec-pending
-      ;; Re-annotate messages to be refiled...
-      (dolist (folder-msg-list mh-refile-list)
-        (dolist (msg (cdr folder-msg-list))
-          (mh-notate msg mh-note-refiled mh-cmd-note)))
-      ;; Re-annotate messages to be deleted...
-      (dolist (msg mh-delete-list)
-        (mh-notate msg mh-note-deleted mh-cmd-note)))))
+  (when dont-exec-pending
+    (mh-notate-deleted-and-refiled)))
 (defun mh-set-cmd-note (width)
   "Set `mh-cmd-note' to WIDTH characters (minimum of 2).
         (keep-lines mh-scan-valid-regexp) ; Flush random scan lines
         (setq mh-seq-list (mh-read-folder-sequences folder t))
         (when (equal (point-max) start-of-inc)
-          (mh-notate-seq 'cur mh-note-cur mh-cmd-note))
+          (mh-notate-cur))
         (if new-mail-flag
                              (count-lines (point-min) (point-max))
       (setq mode-line-buffer-identification
-            (list (format "{%%b%s} %s msg%s"
+            (list (format "    {%%b%s} %s msg%s"
                           (if mh-mode-line-annotation
                               (format "/%s" mh-mode-line-annotation)
                                    (format " (%d)" mh-first-msg-num))
-                                  ("")))))))))
+                                  (""))))))
+      (mh-logo-display))))
 (defun mh-unmark-all-headers (remove-all-flags)
   "Remove all '+' flags from the folder listing.
   "Remove old cur notation."
   (let ((cur-msg (car (mh-seq-to-msgs 'cur))))
-      (and cur-msg
-           (mh-goto-msg cur-msg t t)
-           (looking-at mh-scan-cur-msg-number-regexp)
-           (mh-notate nil ?  mh-cmd-note)))))
+      (when (and cur-msg
+                 (mh-goto-msg cur-msg t t)
+                 (looking-at mh-scan-cur-msg-number-regexp))
+        (mh-notate nil ?  mh-cmd-note)
+        (setq overlay-arrow-position nil)))))
 (defun mh-remove-all-notation ()
   "Remove all notations on all scan lines that MH-E introduces."
+    (setq overlay-arrow-position nil)
     (goto-char (point-min))
     (while (not (eobp))
       (unless (or (equal (char-after) ?+) (eolp))
     (cond ((and cur-msg
                 (mh-goto-msg cur-msg t t))
            (unless minimal-changes-flag
-             (mh-notate nil mh-note-cur mh-cmd-note)
+             (mh-notate-cur)
              (mh-recenter 0)
              (mh-maybe-show cur-msg)))
+           (setq overlay-arrow-position nil)
            (message "No current message")))))
 (defun mh-process-or-undo-commands (folder)
 (defun mh-notate-user-sequences ()
   "Mark the scan listing of all messages in user-defined sequences."
   (let ((seqs mh-seq-list)
-        name)
-    (while seqs
-      (setq name (mh-seq-name (car seqs)))
-      (if (not (mh-internal-seq name))
-          (mh-notate-seq name mh-note-seq (1+ mh-cmd-note)))
-      (setq seqs (cdr seqs)))))
+        (msg-hash (make-hash-table)))
+    (dolist (seq seqs)
+      (unless (mh-internal-seq (mh-seq-name seq))
+        (dolist (msg (mh-seq-msgs seq))
+          (setf (gethash msg msg-hash) t))))
+    (mh-iterate-on-messages-in-region msg (point-min) (point-max)
+      (when (gethash msg msg-hash)
+        (mh-notate nil mh-note-seq (1+ mh-cmd-note))))))
 (defun mh-internal-seq (name)
   "Return non-nil if NAME is the name of an internal MH-E sequence."
 then prompt for the message sequence."
   (interactive (list (cond
                       ((mh-mark-active-p t)
-                       (mh-region-to-msg-list (region-beginning) (region-end)))
+                       (cons (region-beginning) (region-end)))
                        (mh-read-seq-default "Copy" t))
-                       (mh-get-msg-num t)))
+                       (cons (line-beginning-position) (line-end-position))))
                      (mh-prompt-for-folder "Copy to" "" t)))
-  (mh-exec-cmd "refile"
-               (cond ((numberp msg-or-seq) msg-or-seq)
-                     ((listp msg-or-seq) msg-or-seq)
-                     (t (mh-coalesce-msg-list (mh-seq-to-msgs msg-or-seq))))
-               "-link" "-src" mh-current-folder folder)
-  (if (numberp msg-or-seq)
-      (mh-notate msg-or-seq mh-note-copied mh-cmd-note)
-    (mh-notate-seq msg-or-seq mh-note-copied mh-cmd-note)))
+  (let ((msg-list (cond ((numberp msg-or-seq) (list msg-or-seq))
+                        ((symbolp msg-or-seq) (mh-seq-to-msgs msg-or-seq))
+                        ((and (consp msg-or-seq) (numberp (car msg-or-seq))
+                              (numberp (cdr msg-or-seq)))
+                         (let ((result ()))
+                           (mh-iterate-on-messages-in-region msg
+                               (car msg-or-seq) (cdr msg-or-seq)
+                             (mh-notate nil mh-note-copied mh-cmd-note)
+                             (push msg result))
+                           result))
+                        (t msg-or-seq))))
+    (mh-exec-cmd "refile" (mh-coalesce-msg-list msg-list)
+                 "-link" "-src" mh-current-folder folder)
+    (cond ((numberp msg-or-seq)
+           (mh-notate msg-or-seq mh-note-copied mh-cmd-note))
+          ((symbolp msg-or-seq)
+           (mh-notate-seq msg-or-seq mh-note-copied mh-cmd-note)))))
 (defun mh-kill-folder ()
   "Remove the current folder and all included messages.
 Removes all of the messages (files) within the specified current folder,
-and then removes the folder (directory) itself.
-The value of `mh-folder-list-change-hook' is a list of functions to be called,
-with no arguments, after the folders has been removed."
+and then removes the folder (directory) itself."
-  (if (yes-or-no-p (format "Remove folder %s (and all included messages)?"
-                           mh-current-folder))
-      (let ((folder mh-current-folder))
-        (if (null mh-folder-list)
-            (mh-set-folder-list))
+  (if (or mh-index-data
+          (yes-or-no-p (format "Remove folder %s (and all included messages)?"
+                               mh-current-folder)))
+      (let ((folder mh-current-folder)
+            (window-config mh-previous-window-config))
         (mh-set-folder-modified-p t)    ; lock folder to kill it
-        (mh-exec-cmd-daemon "rmf" folder)
-        (setq mh-folder-list
-              (delq (assoc folder mh-folder-list) mh-folder-list))
+        (mh-exec-cmd-daemon "rmf" 'mh-rmf-daemon folder)
         (when (boundp 'mh-speed-folder-map)
           (mh-speed-invalidate-map folder))
-        (run-hooks 'mh-folder-list-change-hook)
-        (message "Folder %s removed" folder)
+        (mh-remove-from-sub-folders-cache folder)
         (mh-set-folder-modified-p nil)  ; so kill-buffer doesn't complain
-        (if (get-buffer mh-show-buffer)
+        (if (and mh-show-buffer (get-buffer mh-show-buffer))
             (kill-buffer mh-show-buffer))
         (if (get-buffer folder)
-            (kill-buffer folder)))
+            (kill-buffer folder))
+        (when window-config
+          (set-window-configuration window-config))
+        (message "Folder %s removed" folder))
     (message "Folder not removed")))
+(defun mh-rmf-daemon (process output)
+  "The rmf PROCESS puts OUTPUT in temporary buffer.
+Display the results only if something went wrong."
+  (set-buffer (get-buffer-create mh-temp-buffer))
+  (insert-before-markers output)
+  (when (save-excursion
+          (beginning-of-buffer)
+          (re-search-forward "^rmf: " (point-max) t))
+    (display-buffer mh-temp-buffer)))
 ;; Avoid compiler warning...
 (defvar view-exit-action)
 (defun mh-list-folders ()
   "List mail folders."
-  (let ((temp-buffer mh-temp-folders-buffer))
+  (let ((temp-buffer mh-folders-buffer))
     (with-output-to-temp-buffer temp-buffer
         (set-buffer temp-buffer)
                              (format "Sequence from %s"
     (if mh-print-background-flag
-        (mh-exec-cmd-daemon shell-file-name "-c" print-command)
+        (mh-exec-cmd-daemon shell-file-name nil "-c" print-command)
       (call-process shell-file-name nil nil nil "-c" print-command))
     (if (numberp msg-or-seq)
         (mh-notate msg-or-seq mh-note-printed mh-cmd-note)
 (require 'cl)
 (require 'mh-e)
 (require 'mh-mime)
+(require 'mh-pick)
 (autoload 'gnus-local-map-property "gnus-util")
 (autoload 'gnus-eval-format "gnus-spec")
 ;; Support different indexing programs
 (defvar mh-indexer-choices
-     mh-swish++-binary mh-swish++-execute-search mh-swish++-next-result)
+     mh-swish++-binary mh-swish++-execute-search mh-swish++-next-result
+     mh-swish++-regexp-builder)
-     mh-swish-binary mh-swish-execute-search mh-swish-next-result)
+     mh-swish-binary mh-swish-execute-search mh-swish-next-result nil)
+    (mairix
+     mh-mairix-binary mh-mairix-execute-search mh-mairix-next-result
+     mh-mairix-regexp-builder)
-     mh-namazu-binary mh-namazu-execute-search mh-namazu-next-result)
+     mh-namazu-binary mh-namazu-execute-search mh-namazu-next-result nil)
-     mh-glimpse-binary mh-glimpse-execute-search mh-glimpse-next-result)
+     mh-glimpse-binary mh-glimpse-execute-search mh-glimpse-next-result nil)
+    (pick
+     mh-pick-binary mh-pick-execute-search mh-pick-next-result
+     mh-pick-regexp-builder)
-     mh-grep-binary mh-grep-execute-search mh-grep-next-result))
+     mh-grep-binary mh-grep-execute-search mh-grep-next-result nil))
   "List of possible indexer choices.")
 (defvar mh-indexer nil
   "Chosen index program.")
   "Function which executes the search program.")
 (defvar mh-index-next-result-function nil
   "Function to parse the next line of output.")
+(defvar mh-index-regexp-builder nil
+  "Function used to construct search regexp.")
 ;; FIXME: This should be a defcustom...
 (defvar mh-index-folder "+mhe-index"
   "Given STRING generate a name which is suitable for use as a folder name.
 White space from the beginning and end are removed. All spaces in the name are
 replaced with underscores and all / are replaced with $. If STRING is longer
-than 20 it is truncated too."
+than 20 it is truncated too. STRING could be a list of strings in which case
+they are concatenated to construct the base name."
-    (insert string)
+    (if (stringp string)
+        (insert string)
+      (when (car string) (insert (car string)))
+      (dolist (s (cdr string))
+        (insert "_" s)))
+    (setq string (mh-replace-string "-lbrace" " "))
+    (setq string (mh-replace-string "-rbrace" " "))
+    (subst-char-in-region (point-min) (point-max) ?( ?  t)
+    (subst-char-in-region (point-min) (point-max) ?) ?  t)
+    (subst-char-in-region (point-min) (point-max) ?- ?  t)
     (goto-char (point-min))
-    (while (and (not (eobp)) (memq (char-after) '(?  ?\t ?\n ?\r)))
+    (while (and (not (eobp)) (memq (char-after) '(?  ?\t ?\n ?\r ?_)))
       (delete-char 1))
     (goto-char (point-max))
-    (while (and (not (bobp)) (memq (char-before) '(?  ?\t ?\n ?\r)))
+    (while (and (not (bobp)) (memq (char-before) '(?  ?\t ?\n ?\r ?_)))
       (delete-backward-char 1))
-    (subst-char-in-region (point-min) (point-max) ? ?_ t)
+    (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)
     (subst-char-in-region (point-min) (point-max) ?\r ?_ t)
     (truncate-string-to-width (buffer-substring (point-min) (point-max)) 20)))
-(defun mh-index-search (redo-search-flag folder search-regexp)
+(defun* mh-index-search (redo-search-flag folder search-regexp
+                        &optional window-config)
   "Perform an indexed search in an MH mail folder.
 If REDO-SEARCH-FLAG is non-nil and the current folder buffer was generated by a
 index search, then the search is repeated. Otherwise, FOLDER is searched with
 SEARCH-REGEXP and the results are presented in an MH-E folder. If FOLDER is
-\"+\" then mail in all folders are searched.
+\"+\" then mail in all folders are searched. Optional argument WINDOW-CONFIG
+stores the window configuration that will be restored after the user quits the
+folder containing the index search results.
 Four indexing programs are supported; if none of these are present, then grep
 is used. This function picks the first program that is available on your
     - `mh-swish++-execute-search'
     - `mh-swish-execute-search'
+    - `mh-mairix-execute-search'
     - `mh-namazu-execute-search'
     - `mh-glimpse-execute-search'
+If none of these programs are present then we use pick. If desired grep can be
+used instead. Details about these methods can be found in:
+    - `mh-pick-execute-search'
+    - `mh-grep-execute-search'
 This and related functions use an X-MHE-Checksum header to cache the MD5
 checksum of a message. This means that already present X-MHE-Checksum headers
 in the incoming email could result in messages not being found. The following
            (unless mh-find-path-run (mh-find-path))
            (or (and current-prefix-arg (car mh-index-previous-search))
-               (mh-prompt-for-folder "Search" "+" nil "all")))
+               (mh-prompt-for-folder "Search" "+" nil "all" t)))
            ;; Yes, we do want to call mh-index-choose every time in case the
            ;; user has switched the indexer manually.
            (unless (mh-index-choose) (error "No indexing program found"))
            (or (and current-prefix-arg (cadr mh-index-previous-search))
+               mh-index-regexp-builder
                (read-string (format "%s regexp: "
-                                     (symbol-name mh-indexer))))))))
+                                     (symbol-name mh-indexer))))))
+         (if (and (not
+                   (and current-prefix-arg (cadr mh-index-previous-search)))
+                  mh-index-regexp-builder)
+             (current-window-configuration)