Function: erc-add-timestamp

erc-add-timestamp is a byte-compiled function defined in erc-stamp.el.gz.

Signature

(erc-add-timestamp)

Documentation

Add timestamp and text-properties to message.

This function is meant to be called from erc-insert-modify-hook or erc-send-modify-hook.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-stamp.el.gz
(defun erc-add-timestamp ()
  "Add timestamp and text-properties to message.

This function is meant to be called from `erc-insert-modify-hook'
or `erc-send-modify-hook'."
  (unless (and (not erc-stamp--allow-unmanaged-p)
               (or (null erc--msg-props)
                   (erc--memq-msg-prop 'erc--skip 'stamp)))
    (let* ((ct (or (erc--check-msg-prop 'erc--ts)
                   (erc-stamp--current-time)))
           (invisible (get-text-property (point-min) 'invisible))
           (erc-stamp--invisible-property
            ;; FIXME on major version bump, make this `erc-' prefixed.
            (if invisible `(timestamp ,@(ensure-list invisible)) 'timestamp))
           (skipp (or (and erc-stamp--skip-when-invisible invisible)
                      (erc--check-msg-prop 'erc--ephemeral)))
           (erc-stamp--current-time ct))
      (when erc--msg-props
        (puthash 'erc--ts ct erc--msg-props))
      (unless skipp
        (funcall erc-insert-timestamp-function
                 (erc-format-timestamp ct erc-timestamp-format)))
      ;; Check `erc-insert-away-timestamp-function' for historical
      ;; reasons even though its Custom :type only allows functions.
      (when (and (not (or skipp erc-timestamp-format))
                 erc-away-timestamp-format
                 (functionp erc-insert-away-timestamp-function)
                 (erc-away-time))
	(funcall erc-insert-away-timestamp-function
		 (erc-format-timestamp ct erc-away-timestamp-format)))
      (when erc-stamp--permanent-cursor-sensor-functions
        (add-text-properties (point-min) (max (point-min) (1- (point-max)))
			   ;; It's important for the function to
			   ;; be different on different entries (bug#22700).
			   (list 'cursor-sensor-functions
                                 ;; Regions are no longer contiguous ^
                                 '(erc--echo-ts-csf) 'erc--ts ct))))))