All pastes #838878 Raw Edit

dump-hide for erc

public text v1 · immutable
#838878 ·published 2007-12-30 18:48 UTC
rendered paste body
;; erc.el

;; brand new function:
(defun erc-dump-hidden (string buffer)
  (save-excursion
    (set-buffer (get-buffer-create buffer))
    (goto-char (point-max))
    (insert-before-markers string)
    (insert-before-markers "\n")))


;;
;; slightly patched function
;;
(defun erc-display-message (parsed type buffer msg &rest args)
  "Display MSG in BUFFER.

ARGS, PARSED, and TYPE are used to format MSG sensibly.

See also `erc-format-message' and `erc-display-line'."
  (let ((string (if (symbolp msg)
		    (apply 'erc-format-message msg args)
		  msg)))
    (setq string
	  (cond
	   ((null type)
	    string)
	   ((listp type)
	    (mapc (lambda (type)
		    (setq string
			  (erc-display-message-highlight type string)))
		  type)
	    string)
	   ((symbolp type)
	    (erc-display-message-highlight type string))))

    (if (not (erc-response-p parsed))
	(erc-display-line string buffer)
;;
;; changes have been made here
;;
      (if (not (member (erc-response.command parsed) erc-hide-list))
	  (progn (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
		 (erc-put-text-property 0 (length string) 'rear-sticky t string)
		 (erc-display-line string buffer))
	  (erc-dump-hidden string "*erc-scratch*")))))