[mew-int 00533] completion of shell command for mew-summary-pipe-message?

sen_ml at example.com sen_ml at example.com
Mon Oct 29 23:39:23 JST 2001


Hello,

I would like to be able to perform completion at the shell command
prompt for `mew-summary-pipe-message'.  I wrote some example code to
test it out.

Is there a chance a feature like this could be included in Mew?

(require 'shell)

;; based on `mew-summary-pipe-message'
(defun mew-summary-pipe-message-body (prefix command)
  "Support code for `mew-summary-pipe-message'."
  (mew-summary-display 'redisplay)
  (when (y-or-n-p "Send this message to pipe? ")
    (save-excursion
      (set-buffer (mew-buffer-message))
      (save-restriction
	(widen)
	(if (string= command "") (setq command mew-last-shell-command))
	(goto-char (point-min)) ; perhaps this line won't be necessary
	(if prefix (search-forward "\n\n"))
	(let ((max-mini-window-height 1))
	  (shell-command-on-region (point) (point-max) command nil))
	(setq mew-last-shell-command command)))))

(defun mew-summary-pipe-message2 (prefix)
  "Send this message via pipe.
This function supports completion of the shell command."
  (interactive (list current-prefix-arg))
  (let ((map (copy-keymap minibuffer-local-map))
	(restore-completion-functions comint-dynamic-complete-functions)
	(comint-dynamic-complete-functions
	 (list (function shell-dynamic-complete-as-command)))
	command)
    (define-key map
      (kbd "TAB")
      (function comint-dynamic-complete))
    (setq command
	  (read-from-minibuffer "Shell command on message: " 
				mew-last-shell-command
				map))
    (mew-summary-pipe-message-body prefix command)
    (setq comint-dynamic-complete-functions restore-completion-functions)))



More information about the Mew-int mailing list