;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Thu Apr 14 16:19:21 1994 ;;; from file /gd/gnu/emacs/19.0/lisp/mh-utils.el ;;; emacs version 19.22.90.3. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/gd/gnu/emacs/19.0/lisp/mh-utils.el' was compiled for Emacs 19")) (defvar mh-progs nil "\ Directory containing MH commands, such as inc, repl, and rmm.") (defvar mh-lib nil "\ Directory containing the MH library. This directory contains, among other things, the mhl program and the components file.") (defvar mh-auto-folder-collect t "\ *Whether to start collecting MH folder names immediately in the background. Non-nil means start a background process collecting the names of all folders as soon as mh-e is loaded.") (defvar mh-recursive-folders nil "\ *If non-nil, then commands which operate on folders do so recursively.") (defvar mh-clean-message-header nil "\ *Non-nil means clean headers of messages that are displayed or inserted. The variables `mh-visible-headers' and `mh-invisible-headers' control what is removed.") (defvar mh-visible-headers nil "\ *If non-nil, contains a regexp specifying the headers to keep when cleaning. Only used if `mh-clean-message-header' is non-nil. Setting this variable overrides `mh-invisible-headers'.") (defvar mh-invisible-headers "^Received: \\|^Message-Id: \\|^Remailed-\\|^Via: \\|^Mail-from: \\|^Return-Path: \\|^In-Reply-To: \\|^Resent-" "\ Regexp matching lines in a message header that are not to be shown. If `mh-visible-headers' is non-nil, it is used instead to specify what to keep.") (defvar mh-bury-show-buffer t "\ *Non-nil means that the displayed show buffer for a folder is buried.") (defvar mh-summary-height 4 "\ *Number of lines in MH-Folder window (including the mode line).") (defvar mh-msg-number-regexp "^ *\\([0-9]+\\)" "\ Regexp to find the number of a message in a scan line. The message's number must be surrounded with \\( \\)") (defvar mh-msg-search-regexp "^[^0-9]*%d[^0-9]" "\ Format string containing a regexp matching the scan listing for a message. The desired message's number will be an argument to format.") (defvar mhl-formfile nil "\ *Name of format file to be used by mhl to show and print messages. A value of T means use the default format file. Nil means don't use mhl to format messages when showing; mhl is still used, with the default format file, to format messages when printing them. The format used should specify a non-zero value for overflowoffset so the message continues to conform to RFC 822 and mh-e can parse the headers.") (defvar mh-msg-folder-hook nil "\ Select a default folder for refiling or Fcc. Called by `\\[mh-refile-msg]' and `\\[mh-to-fcc]' to get a default when prompting the user for a folder. Called from within a save-excursion, with point at the start of the message. Should return the folder to offer as the refile or Fcc folder, as a string with a leading `+' sign.") (defvar mh-cmd-note 4 "\ Offset to insert notation.") (defvar mh-folder-list nil "\ List of folder names for completion.") (defvar mh-user-path nil "\ User's mail folder directory.") (defvar mh-draft-folder nil "\ Name of folder containing draft messages. NIL means do not use draft folder.") (defvar mh-previous-window-config nil "\ Window configuration before mh-e command.") (defvar mh-current-folder nil "\ Name of current folder, a string.") (defvar mh-folder-filename nil "\ Full path of directory for this folder.") (defvar mh-show-buffer nil "\ Buffer that displays mesage for this folder.") (defvar mh-unseen-seq nil "\ Name of the Unseen sequence.") (defvar mh-previous-seq nil "\ Name of the Previous sequence.") (defvar mh-seen-list nil "\ List of displayed messages.") (defvar mh-seq-list nil "\ Alist of (seq . msgs) numbers.") (defvar mh-showing nil "\ If non-nil, show the message in a separate window.") (defvar mh-showing-with-headers nil "\ If non-nil, show buffer contains message with all headers. If nil, show buffer contains message processed normally.") (byte-code "\"#\"#\"\"#" [defalias with-mh-folder-updating (macro . #[(save-modification-flag-p &rest body) "@ BBBE?BB" [save-modification-flag-p prog1 let ((mh-folder-updating-mod-flag (buffer-modified-p)) (buffer-read-only nil) (buffer-file-name nil)) progn body ((mh-set-folder-modified-p mh-folder-updating-mod-flag)) ((mh-set-folder-modified-p nil))] 6]) put lisp-indent-hook 1 mh-in-show-buffer (macro . #[(show-buffer &rest body) "@DBBB" [show-buffer let ((mh-in-show-buffer-saved-window (selected-window))) switch-to-buffer-other-window (if mh-bury-show-buffer (bury-buffer (current-buffer))) unwind-protect progn body ((select-window mh-in-show-buffer-saved-window))] 7]) mh-seq-name (macro . #[(pair) " D" [car pair] 2]) mh-seq-msgs (macro . #[(pair) " D" [cdr pair] 2]) mh-show-mode mode-class special] 4) (defalias 'mh-show-mode #[nil " !!" [kill-all-local-variables mh-show-mode major-mode mh-set-mode-name "MH-Show" run-hooks mh-show-mode-hook] 2 "\ Major mode for showing messages in mh-e. The value of mh-show-mode-hook is called when a new message is displayed."]) (defalias (quote mh-maybe-show) #[(&optional msg) "\n!" [mh-showing mh-show msg] 2]) (defalias 'mh-show #[(&optional msg) " \f\n !" [mh-showing-with-headers mhl-formfile mh-clean-message-header mh-invalidate-show-buffer mh-show-msg msg] 2 "\ Show MESSAGE (default: message at cursor). Force a two-window display with the folder window on top (size mh-summary-height) and the show buffer below it. If the message is already visible, display the start of the message. Display of the message is controlled by setting the variables `mh-clean-message-header' and `mhl-formfile'. The default behavior is to scroll uninteresting headers off the top of the window. Type \"\\[mh-header-display]\" to see the message with all its headers." nil]) (byte-code "\"\"\"\"\"\"\"\"\"\"\"" [defalias mh-show-msg #[(msg) "!\f ! \n ! =# !5p!ӎU\n\"Ueb [ [\n\"- T Um Z!!>~B!" [msg mh-get-msg-num t mh-showing mh-current-folder mh-clean-message-header get-buffer-window mh-show-buffer show-window clean-message-header folder next-window minibuffer-window selected-window delete-other-windows mh-in-show-buffer-saved-window switch-to-buffer-other-window mh-bury-show-buffer bury-buffer ((select-window mh-in-show-buffer-saved-window)) mh-msg-filename buffer-file-name mh-start-of-uncleaned-message mh-display-msg window-height screen-height shrink-window mh-summary-height mh-recenter nil mh-seen-list run-hooks mh-show-hook] 4] mh-display-msg #[(msg-num folder) "q \n \f! \n \f  !&\"q ?   Y ;R D %^ !eb\fte \n#ebw != ! $#C%qԉ&." [folder mhl-formfile mh-clean-message-header mh-invisible-headers mh-visible-headers mh-msg-filename msg-num mh-show-buffer show-buffer msg-filename visible-headers invisible-headers clean-message-header formfile file-exists-p error "Message %d does not exist" buffer-file-name clear-visited-file-modtime unlock-buffer nil erase-buffer mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" "-form" insert-file-contents mh-clean-msg-header mh-start-of-uncleaned-message set-buffer-modified-p buffer-undo-list t set-mark mh-show-mode format mh-show-buffer-mode-line-buffer-id mode-line-buffer-identification mh-showing-with-headers] 6] mh-start-of-uncleaned-message #[nil "#y!)" [t case-fold-search re-search-forward "^To:\\|^From:\\|^Subject:\\|^Date:" nil 0 mh-recenter] 4] mh-invalidate-show-buffer #[nil " ! q‰)" [get-buffer mh-show-buffer nil buffer-file-name] 2] mh-get-msg-num #[(error-if-no-message) "y\n!Ĕĕ{! !)" [0 looking-at mh-msg-number-regexp string-to-int 1 error-if-no-message error "Cursor not pointing to message" nil] 3] mh-msg-filename #[(msg &optional folder) "\n!  ! \"" [expand-file-name int-to-string msg folder mh-expand-file-name mh-folder-filename] 4] mh-clean-msg-header #[(start invisible-headers visible-headers) "\nb#!\n`}eb K`dWh !:y!y.!!!>#hy!!K![ *" [t case-fold-search start search-forward "\n\n" nil move backward-char 1 visible-headers looking-at "[ ]" mh-delete-line re-search-forward invisible-headers 0 unlock-buffer] 4] mh-recenter #[(arg) "p! =  !" [get-buffer-window selected-window recenter arg (t)] 2] mh-delete-line #[(lines) "`y`)|" [lines] 2] mh-get-field #[(field) "eb \"#ǂ=!ǂ=#˔\fy!7y+\f`S{))" [t case-fold-search re-search-forward format "^%s" field nil "" looking-at "[ ]*$" "[ ]*\\([^ \n].*\\)$" 1 start "[ ]"] 4] mh-notate #[(msg notation offset) " ‰#* ĉy u!\fc!+)" [msg mh-goto-msg t buffer-modified-p nil buffer-file-name buffer-read-only mh-folder-updating-mod-flag 0 offset delete-char 1 notation mh-set-folder-modified-p] 4]] 3) (defalias 'mh-goto-msg #[(number &optional no-error-if-no-message dont-show) "!` ! UI* W*\f#I> V>\f#Idb\f#Yy U !Ȃg b f \"+" [mh-get-msg-num nil mh-msg-search-pat number msg-pattern starting-place cur-msg re-search-forward t re-search-backward 0 dont-show mh-maybe-show no-error-if-no-message error "No message %d"] 5 "\ Position the cursor at message NUMBER. Non-nil second argument means do not signal an error if message does not exist. Non-nil third argument means not to show the message. Return non-nil if cursor is at message." "NJump to message: "]) (byte-code "\"\"\"\"\"" [defalias mh-msg-search-pat #[(n) " \n\"" [format mh-msg-search-regexp n] 3] mh-find-path #[nil " !\f!!q ͏!њ/=!=\"!њK!\"!l!!l!\"!њ}!!#њȉ##!#*" [mh-find-progs expand-file-name getenv "MH" "~/.mh_profile" profile get-buffer-create " *mh-temp*" nil buffer-offer-save erase-buffer err (insert-file-contents profile) ((file-error (mh-install profile err))) mh-get-field "Draft-Folder:" mh-draft-folder "" mh-folder-name-p format "+%s" "Path:" mh-user-path "Mail" file-name-as-directory "~" file-exists-p mh-expand-file-name error "Draft folder \"%s\" not found. Create it and try again." "Unseen-Sequence:" mh-unseen-seq unseen intern "Previous-Sequence:" mh-previous-seq] 6] mh-find-progs #[nil " \"! \"\" \"!5\"2 \"2ˉ " [file-exists-p expand-file-name "inc" mh-progs mh-path-search exec-path ("/usr/local/bin/mh/" "/usr/local/mh/" "/usr/bin/mh/" "/usr/new/mh/" "/usr/contrib/mh/bin") "/usr/local/bin/" "mhl" mh-lib ("/usr/local/lib/mh/" "/usr/lib/mh/" "/usr/new/lib/mh/" "/usr/contrib/mh/lib") "/usr/local/bin/mh/"] 4] mh-path-search #[(path file) " @\"!A@" [path file-exists-p expand-file-name file] 5] mh-install #[(profile error-val) "!\f ! AA@#\n\"\" Ϗ" [getenv "MH" file-exists-p profile error "Cannot read MH profile \"%s\": %s" error-val mh-exec-cmd expand-file-name "install-mh" mh-lib "-auto" erase-buffer err (insert-file-contents profile) ((file-error (byte-code "\n AA@#" [error "Cannot read MH profile \"%s\": %s" profile err] 4)))] 4]] 3) (defalias 'mh-set-folder-modified-p #[(flag) " !" [set-buffer-modified-p flag] 2 "\ Mark current folder as modified or unmodified according to FLAG."]) (byte-code "\"\"" [defalias mh-find-seq #[(name) " \n\"" [assoc name mh-seq-list] 3] mh-make-seq #[(name msgs) " B" [name msgs] 2]] 3) (defalias 'mh-seq-to-msgs #[(seq) " !A" [mh-find-seq seq] 2 "\ Return a list of the messages in SEQUENCE."]) (byte-code "\"\"\"\"\"\"\"" [defalias mh-add-msgs-to-seq #[(msgs seq &optional internal-flag) " !  : C\n \" B* *\n \nA\"?< \"  T#)" [mh-find-seq seq entry msgs mh-make-seq mh-seq-list append internal-flag mh-add-to-sequence mh-notate-seq 37 mh-cmd-note] 4] autoload mh-add-to-sequence "mh-seq" mh-notate-seq mh-read-seq-default mh-map-to-seq-msgs mh-set-mode-name #[(mode-name-string) " q) !" [mode-name-string mode-name other-buffer set-buffer-modified-p buffer-modified-p] 2] mh-prompt-for-folder #[(prompt default can-create) "\fł\"# \n' \f\nlj%BB'P͚Vd!d\" GV GSH= O  !!? \"! \"lj !% \"C\nB\n \"\n\"P\n\"C\nB\n) +" [default "" format "%s folder%s" prompt "? " " [%s]? " nil read-name folder-name mh-folder-list mh-set-folder-list completing-read "+" mh-folder-name-p "+%s" 0 47 -1 file-exists-p mh-expand-file-name new-file-p y-or-n-p "Folder %s does not exist. Create it? " message "Creating %s" call-process "mkdir" "Creating %s...done" error "Folder %s is not created" assoc "/"] 8]] 3) (defvar mh-make-folder-list-process nil "\ The background process collecting the folder list.") (defvar mh-folder-list-temp nil "\ mh-folder-list as it is being built.") (defvar mh-folder-list-partial-line "" "\ Start of last incomplete line from folder process.") (defalias 'mh-set-folder-list #[nil "!\n \n!=\n! \n!!" [message "Collecting folder names..." mh-make-folder-list-process mh-make-folder-list-background process-status run accept-process-output mh-folder-list-temp mh-folder-list nil delete-process "Collecting folder names...done"] 2 "\ Sets mh-folder-list correctly. A useful function for the command line or for when you need to sync by hand. Format is in a form suitable for completing read."]) (defalias 'mh-make-folder-list-background #[nil "?( \" ʂ%\"!)" [mh-make-folder-list-process mh-find-progs nil process-connection-type start-process "folders" expand-file-name mh-progs "-fast" mh-recursive-folders "-recurse" "-norecurse" set-process-filter mh-make-folder-list-filter process-kill-without-query] 6 "\ Start a background process to compute a list of the user's folders. Call mh-set-folder-list to wait for the result."]) (byte-code "\"\"\"\"\"\"\"\"\"\"" [defalias mh-make-folder-list-filter #[(process output) "\fV #  \fO#  I @@P! \"I C @@PC ABB P C B \fT O +" [0 t nil new-folder line-end position string-match "\n" output format "+%s%s" mh-folder-list-partial-line "" mh-folder-list-temp regexp-quote "/"] 7] mh-folder-name-p #[(name) "9 !H=GVH=" [name symbol-name 0 43] 2] mh-exec-cmd #[(command &rest args) "!q \" !& V$΋)" [get-buffer-create " *mh-temp*" erase-buffer apply call-process expand-file-name command mh-progs nil t mh-list-to-string args buffer-size 0 ((byte-code "!!" [switch-to-buffer-other-window " *mh-temp*" sit-for 5] 2))] 8] mh-exec-cmd-error #[(env command &rest args) "!q )  \"# !& : \"!& \"*" [get-buffer-create " *mh-temp*" erase-buffer env apply call-process "/bin/sh" nil t "-c" format "%s %s ${1+\"$@\"}" expand-file-name command mh-progs mh-list-to-string args status mh-handle-process-error] 13] mh-exec-cmd-daemon #[(command &rest args) "!q ) \" !%\f\f\"*" [get-buffer-create " *mh-temp*" erase-buffer nil process-connection-type apply start-process command expand-file-name mh-progs mh-list-to-string args process set-process-filter mh-process-daemon] 7] mh-process-daemon #[(process output) "!q !!" [get-buffer-create " *mh-temp*" insert-before-markers output display-buffer] 2] mh-exec-cmd-quiet #[(raise-error command &rest args) "!q \"\n& eb\f* \", )" [get-buffer-create " *mh-temp*" erase-buffer apply call-process expand-file-name command mh-progs nil t args value raise-error mh-handle-process-error] 7] mh-exec-cmd-output #[(command display &rest args) "`\" \"\n!& " [push-mark t apply call-process expand-file-name command mh-progs nil display mh-list-to-string args exchange-point-and-mark] 8] mh-exec-lib-cmd-output #[(command &rest args) " \f\"$" [apply mh-exec-cmd-output expand-file-name command mh-lib nil args] 5] mh-handle-process-error #[(command status) "=; #! U$ #!! W@m@ˉb`{!p! #!" [status 0 error format "%s: %s" command buffer-size "%s: exit code %d" goto-line 2 screen-width 1 nil display-buffer "%s failed with status %d. See error message in other window."] 5]] 3) (defalias 'mh-expand-file-name #[(filename &optional default) " ! O \" \"" [mh-folder-name-p filename expand-file-name 1 nil mh-user-path default] 4 "\ Just like `expand-file-name', but also handles MH folder names. Assumes that any filename that starts with '+' is a folder name."]) (byte-code "\"\"! " [defalias mh-list-to-string #[(l) " !" [mh-list-to-string-1 l] 2] mh-list-to-string-1 #[(l) "\n]\n@V\n@9\n@! BV\n@+\n@! BV\n@ŚV\n@;@\n@ BV\n@