Function: format-encode-region
format-encode-region is an interactive and byte-compiled function
defined in format.el.gz.
Signature
(format-encode-region BEG END &optional FORMAT)
Documentation
Translate the region into some FORMAT.
FORMAT defaults to buffer-file-format. It is a symbol naming
one of the formats defined in format-alist, or a list of such symbols.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/format.el.gz
(defun format-encode-region (beg end &optional format)
"Translate the region into some FORMAT.
FORMAT defaults to `buffer-file-format'. It is a symbol naming
one of the formats defined in `format-alist', or a list of such symbols."
(interactive
(list (region-beginning) (region-end)
(format-read (format-prompt "Translate region to format"
buffer-file-format))))
(if (null format) (setq format buffer-file-format))
(if (symbolp format) (setq format (list format)))
(save-excursion
(goto-char end)
(let ((end (point-marker)))
(while format
(let* ((info (assq (car format) format-alist))
(to-fn (nth 4 info))
(modify (nth 5 info)))
(if to-fn
(if modify
(setq end (format-encode-run-method to-fn beg end
(current-buffer)))
(format-insert-annotations
(funcall to-fn beg end (current-buffer)))))
(setq format (cdr format)))))))