Function: sc-cite-original
sc-cite-original is an autoloaded and byte-compiled function defined
in supercite.el.gz.
Signature
(sc-cite-original)
Documentation
Workhorse citing function which performs the initial citation.
This is callable from the various mail and news readers' reply
function according to the agreed upon standard. See the associated
info node (SC)Top for more details.
sc-cite-original does not do any yanking of the
original message but it does require a few things:
1) The reply buffer is the current buffer.
2) The original message has been yanked and inserted into the
reply buffer.
3) Verbose mail headers from the original message have been
inserted into the reply buffer directly before the text of the
original message.
4) Point is at the beginning of the verbose headers.
5) Mark is at the end of the body of text to be cited.
The region need not be active (and typically isn't when this
function is called). Also, the hook sc-pre-hook is run before,
and sc-post-hook is run after the guts of this function.
Probably introduced at or before Emacs version 19.20.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/supercite.el.gz
;;;###autoload
(defun sc-cite-original ()
"Workhorse citing function which performs the initial citation.
This is callable from the various mail and news readers' reply
function according to the agreed upon standard. See the associated
info node `(SC)Top' for more details.
`sc-cite-original' does not do any yanking of the
original message but it does require a few things:
1) The reply buffer is the current buffer.
2) The original message has been yanked and inserted into the
reply buffer.
3) Verbose mail headers from the original message have been
inserted into the reply buffer directly before the text of the
original message.
4) Point is at the beginning of the verbose headers.
5) Mark is at the end of the body of text to be cited.
The region need not be active (and typically isn't when this
function is called). Also, the hook `sc-pre-hook' is run before,
and `sc-post-hook' is run after the guts of this function."
(run-hooks 'sc-pre-hook)
(sc-minor-mode 1)
(undo-boundary)
;; grab point and mark since the region is probably not active when
;; this function gets automatically called. we want point to be a
;; mark so any deleting before point works properly
(let* ((mark-active t)
(point (point-marker))
(mark (copy-marker (mark-marker))))
;; make sure point comes before mark, not all functions are
;; interactive "r"
(if (< mark point)
(let ((tmp point))
(setq point mark
mark tmp)))
;; first process mail headers, and populate sc-mail-info
(sc-mail-process-headers point mark)
;; now get possible attributions
(sc-attribs-chop-address (or (sc-mail-field "from")
(sc-mail-field "reply")
(sc-mail-field "reply-to")
(sc-mail-field "sender")))
;; select the attribution
(sc-select-attribution)
;; cite the region, but first check the value of sc-cite-region-limit
(let ((linecnt (count-lines point mark)))
(and sc-cite-region-limit
(if (or (not (numberp sc-cite-region-limit))
(<= linecnt sc-cite-region-limit))
(progn
;; cite the region and insert the header rewrite
(sc-cite-region point mark)
(goto-char point)
(let ((sc-eref-style (or sc-preferred-header-style 0)))
(if sc-electric-references-p
(sc-electric-mode sc-eref-style)
(sc-eref-insert-selected t))))
(beep)
(message
"Region not cited. %d lines exceeds sc-cite-region-limit: %d"
linecnt sc-cite-region-limit))))
;; finally, free the point-marker
(set-marker point nil)
(set-marker mark nil))
(run-hooks 'sc-post-hook))