Function: format-decode-run-method
format-decode-run-method is a byte-compiled function defined in
format.el.gz.
Signature
(format-decode-run-method METHOD FROM TO &optional BUFFER)
Documentation
Decode 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 is currently ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/format.el.gz
(defun format-decode-run-method (method from to &optional _buffer)
"Decode 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 is currently ignored."
(if (stringp method)
(let ((error-buff (get-buffer-create "*Format Errors*"))
(coding-system-for-write 'no-conversion)
format-alist)
(with-current-buffer error-buff
(widen)
(erase-buffer))
;; We should perhaps go via a temporary buffer and copy it
;; back, in case of errors.
(if (and (zerop (save-window-excursion
(shell-command-on-region from to method t 'no-mark
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 decoding failed"))
(point))
(funcall method from to)))