Function: format-encode-run-method
format-encode-run-method is a byte-compiled function defined in
format.el.gz.
Signature
(format-encode-run-method METHOD FROM TO &optional BUFFER)
Documentation
Translate using METHOD the text from FROM to TO.
If METHOD is a string, it is a shell command (including options); otherwise, it should be a Lisp function. BUFFER should be the buffer that the output originally came from.
Source Code
;; Defined in /usr/src/emacs/lisp/format.el.gz
;;; Basic Functions (called from Lisp)
(defun format-encode-run-method (method from to &optional buffer)
"Translate using METHOD the text from FROM to TO.
If METHOD is a string, it is a shell command (including options);
otherwise, it should be a Lisp function.
BUFFER should be the buffer that the output originally came from."
(if (stringp method)
(let ((error-buff (get-buffer-create "*Format Errors*"))
(coding-system-for-read 'no-conversion)
format-alist)
(with-current-buffer error-buff
(widen)
(erase-buffer))
(if (and (zerop (save-window-excursion
(shell-command-on-region from to method t t
error-buff)))
;; gzip gives zero exit status with bad args, for instance.
(zerop (with-current-buffer error-buff
(buffer-size))))
(bury-buffer error-buff)
(switch-to-buffer-other-window error-buff)
(error "Format encoding failed")))
(funcall method from to buffer)))