;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Tue Apr 25 19:10:46 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/mh-utils.el ;;; emacs version 19.28.90.40. ;;; 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")) #@63 Directory containing MH commands, such as inc, repl, and rmm. (defvar mh-progs nil (#$ . 485)) #@124 Directory containing the MH library. This directory contains, among other things, the mhl program and the components file. (defvar mh-lib nil (#$ . 587)) (byte-code "##" [put mh-progs risky-local-variable t mh-lib] 4) #@181 *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-auto-folder-collect t (#$ . -822)) #@72 *If non-nil, then commands which operate on folders do so recursively. (defvar mh-recursive-folders nil (#$ . -1054)) #@161 *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-clean-message-header nil (#$ . -1179)) #@186 *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-visible-headers nil (#$ . -1396)) #@149 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-invisible-headers "^Received: \\|^Message-Id: \\|^Remailed-\\|^Via: \\|^Mail-from: \\|^Return-Path: \\|^Delivery-Date: \\|^In-Reply-To: \\|^Resent-" (#$ . 1633)) #@71 *Non-nil means that the displayed show buffer for a folder is buried. (defvar mh-bury-show-buffer t (#$ . -1960)) #@65 *Number of lines in MH-Folder window (including the mode line). (defvar mh-summary-height 4 (#$ . -2080)) #@107 Regexp to find the number of a message in a scan line. The message's number must be surrounded with \( \) (defvar mh-msg-number-regexp "^ *\\([0-9]+\\)" (#$ . 2193)) #@136 Format string containing a regexp matching the scan listing for a message. The desired message's number will be an argument to format. (defvar mh-msg-search-regexp "^[^0-9]*%d[^0-9]" (#$ . 2366)) #@407 *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 mhl-formfile nil (#$ . -2569)) #@598 Function to select a default folder for refiling or Fcc. If set to a function, that function is called with no arguments by `\[mh-refile-msg]' and `\[mh-to-fcc]' to get a default when prompting the user for a folder. The function is called from within a save-excursion, with point at the start of the message. It should return the folder to offer as the refile or Fcc folder, as a string with a leading `+' sign. It can also return an empty string to use no default, or NIL to calculate the default the usual way. NOTE: This variable is not an ordinary hook; It may not be a list of functions. (defvar mh-default-folder-for-message-function nil (#$ . 3021)) #@62 Invoked by mh-find-path while reading the user's MH profile. (defvar mh-find-path-hook nil (#$ . 3688)) #@70 Invoked whenever the cached folder list `mh-folder-list' is changed. (defvar mh-folder-list-change-hook nil (#$ . 3798)) #@136 Format string to produce `mode-line-buffer-identification' for show buffers. First argument is folder name. Second is message number. (defvar mh-show-buffer-mode-line-buffer-id "{show-%s} %d" (#$ . 3926)) #@28 Offset to insert notation. (defvar mh-cmd-note 4 (#$ . 4138)) #@72 String whose first character is used to notate messages in a sequence. (defvar mh-note-seq "%" (#$ . 4206)) (byte-code "! B! B!  B!- B!: B!G B\n B![ B!h\f B!u B! B! B‡" [boundp mh-folder-list nil current-load-list mh-user-path mh-draft-folder mh-unseen-seq mh-previous-seq mh-inbox " *mh-temp*" mh-temp-buffer mh-previous-window-config mh-current-folder mh-show-buffer mh-folder-filename mh-showing] 2) #@92 When moving to a new message in the Folder window, also show it in a separate Show window. (defalias 'mh-showing #[nil "" [nil] 1 (#$ . 4719)]) (byte-code "! B! B!  B‡" [boundp mh-seq-list nil current-load-list mh-seen-list mh-showing-with-headers] 2) (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 (quote with-mh-folder-updating) (quote lisp-indent-hook) 1) (defalias '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])) (put (quote mh-in-show-buffer) (quote lisp-indent-hook) 1) (defalias 'mh-make-seq '(macro . #[(name msgs) " \nE" [cons name msgs] 3])) (defalias 'mh-seq-name '(macro . #[(pair) " D" [car pair] 2])) (defalias 'mh-seq-msgs '(macro . #[(pair) " D" [cdr pair] 2])) (put (quote mh-show-mode) (quote mode-class) (quote special)) #@116 Major mode for showing messages in mh-e. The value of mh-show-mode-hook is called when a new message is displayed. (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 (#$ . 6079)]) (defalias 'mh-maybe-show #[(&optional msg) "\n!" [mh-showing mh-show msg] 2]) #@487 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. (defalias 'mh-show #[(&optional message) " \f\n !" [mh-showing-with-headers mhl-formfile mh-clean-message-header mh-invalidate-show-buffer mh-show-msg message] 2 (#$ . 6453) nil]) (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]) (defalias 'mh-display-msg #[(msg-num folder) "q \n \f! \n \f  !&\"q ? !B \\ ;U D %a !eb\fwe \n#ebz =!  #!! )#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 mh-unvisit-file erase-buffer boundp write-contents-hooks nil mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" "-form" insert-file-contents mh-clean-msg-header mh-start-of-uncleaned-message buffer-undo-list t set-buffer-modified-p set-buffer-auto-saved buffer-backed-up auto-save-mode 1 set-mark mh-show-mode format mh-show-buffer-mode-line-buffer-id mode-line-buffer-identification mh-showing-with-headers] 6]) (defalias 'mh-start-of-uncleaned-message #[nil "#y!)" [t case-fold-search re-search-forward "^To:\\|^Cc:\\|^From:\\|^Subject:\\|^Date:" nil 0 mh-recenter] 4]) (defalias 'mh-invalidate-show-buffer #[nil " ! q )" [get-buffer mh-show-buffer mh-unvisit-file] 2]) (defalias 'mh-unvisit-file #[nil "   !\"!! ʉ" [buffer-modified-p buffer-file-name yes-or-no-p format "Message %s modified; flush changes? " file-name-nondirectory error "Flushing changes not confirmed" clear-visited-file-modtime unlock-buffer nil] 5]) (defalias '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]) (defalias 'mh-msg-filename #[(msg &optional folder) "\n!  ! \"" [expand-file-name int-to-string msg folder mh-expand-file-name mh-folder-filename] 4]) (defalias '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]) (defalias 'mh-recenter #[(arg) "p! =  !" [get-buffer-window selected-window recenter arg (t)] 2]) (defalias 'mh-delete-line #[(lines) "`y`)|" [lines] 2]) (defalias '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]) #@201 Position the cursor at message NUMBER. Optional non-nil second argument means return nil instead of signaling an error if message does not exist. Non-nil third argument means not to show the message. (defalias 'mh-goto-msg #[(number &optional no-error-if-no-message dont-show) " !!` ! UN/ W/ #NC VC #Ndb #^y\fZ !ɂmbl \"+" [prefix-numeric-value number mh-get-msg-num nil mh-msg-search-pat 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 (#$ . 10505) "NGo to message: "]) (defalias 'mh-msg-search-pat #[(n) " \n\"" [format mh-msg-search-regexp n] 3]) (defalias 'mh-get-profile-field #[(field) "eb \"#Ƃ0!Ƃ0#ʔ  `{))" [t case-fold-search re-search-forward format "^%s" field nil looking-at "[ ]*$" "[ ]*\\([^ \n].*\\)$" 1 start] 4]) (defalias 'mh-find-path #[nil " !\f!!q ͏!+!\"!!^!M\"!!^!\"!m{!{\"!!!!!!!%%!%!*" [mh-find-progs expand-file-name getenv "MH" "~/.mh_profile" profile get-buffer-create mh-temp-buffer nil buffer-offer-save erase-buffer err (insert-file-contents profile) ((file-error (mh-install profile err))) mh-get-profile-field "Path:" mh-user-path "Mail" file-name-as-directory "~" "Draft-Folder:" mh-draft-folder mh-folder-name-p format "+%s" file-exists-p mh-expand-file-name error "Draft folder \"%s\" not found. Create it and try again." "Inbox:" mh-inbox "+inbox" "Unseen-Sequence:" mh-unseen-seq intern unseen "Previous-Sequence:" mh-previous-seq run-hooks mh-find-path-hook] 6]) (defalias 'mh-find-progs #[nil " \"! \"\"  \"!>\"; \"; ;ˉ " [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/") "/usr/local/bin/" "mhl" mh-lib ("/usr/local/lib/mh/" "/usr/local/mh/lib/" "/usr/local/bin/mh/" "/usr/lib/mh/" "/usr/new/lib/mh/" "/usr/contrib/mh/lib/") "/usr/local/lib/mh/"] 4]) (defalias 'mh-path-search #[(path file) " @\"!A@" [path file-exists-p expand-file-name file] 5]) (defalias '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]) (defalias 'mh-set-folder-modified-p #[(flag) " !" [set-buffer-modified-p flag] 2]) (defalias 'mh-find-seq #[(name) " \n\"" [assoc name mh-seq-list] 3]) (defalias 'mh-seq-to-msgs #[(seq) " !A" [mh-find-seq seq] 2]) (defalias 'mh-add-msgs-to-seq #[(msgs seq &optional internal-flag) " !  : C\n B\fB) )\n \nA\"?< \"  \nT#)" [mh-find-seq seq entry msgs mh-seq-list append internal-flag mh-add-to-sequence mh-notate-seq mh-note-seq mh-cmd-note] 4]) (byte-code "\"\"\"\"" [autoload mh-add-to-sequence "mh-seq" mh-notate-seq mh-read-seq-default mh-map-to-seq-msgs] 3) (defalias 'mh-set-mode-name #[(mode-name-string) "!" [mode-name-string mode-name force-mode-line-update t] 2]) (defalias '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" run-hooks mh-folder-list-change-hook error "Folder %s is not created" assoc "/"] 8]) (byte-code "! B! B!  B‡" [boundp mh-make-folder-list-process nil current-load-list mh-folder-list-temp mh-folder-list-partial-line ""] 2) (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 run-hooks mh-folder-list-change-hook nil delete-process "Collecting folder names...done"] 2]) (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]) (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]) (defalias 'mh-folder-name-p #[(name) "9 !H=GVH=" [name symbol-name 0 43] 2]) (defalias 'mh-exec-cmd #[(command &rest args) " !q \" !& V$΋)" [get-buffer-create mh-temp-buffer 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-buffer sit-for 5] 2))] 8]) (defalias 'mh-exec-cmd-error #[(env command &rest args) " !q )  \"# !& : \"!& \"*" [get-buffer-create mh-temp-buffer 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]) (defalias 'mh-exec-cmd-daemon #[(command &rest args) " !q ) \" !%\f\f\"*" [get-buffer-create mh-temp-buffer 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]) (defalias 'mh-process-daemon #[(process output) " !q ! !" [get-buffer-create mh-temp-buffer insert-before-markers output display-buffer] 2]) (defalias 'mh-exec-cmd-quiet #[(raise-error command &rest args) " !q \"\n& eb\f* \", )" [get-buffer-create mh-temp-buffer erase-buffer apply call-process expand-file-name command mh-progs nil t args value raise-error mh-handle-process-error] 7]) (defalias '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]) (defalias 'mh-exec-lib-cmd-output #[(command &rest args) " \f\"$" [apply mh-exec-cmd-output expand-file-name command mh-lib nil args] 5]) (defalias '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]) (defalias 'mh-expand-file-name #[(filename &optional default) " ! O \" \"" [mh-folder-name-p filename expand-file-name 1 nil mh-user-path default] 4]) (defalias 'mh-list-to-string #[(l) " !" [mh-list-to-string-1 l] 2]) (defalias 'mh-list-to-string-1 #[(l) "\n]\n@V\n@9\n@! BV\n@+\n@! BV\n@ŚV\n@;@\n@ BV\n@