;;; erc-fill.el --- Filling IRC messages in various ways
-;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
+;; 2007, 2008 Free Software Foundation, Inc.
;; Author: Andreas Fuchs <asf@void.at>
;; Mario Lang <mlang@delysid.org>
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(unless (erc-string-invisible-p (buffer-substring (point-min) (point-max)))
(when erc-fill-function
- (funcall erc-fill-function))))
+ ;; skip initial empty lines
+ (goto-char (point-min))
+ (save-match-data
+ (while (and (looking-at "[ \t\n]*$")
+ (= (forward-line 1) 0))))
+ (unless (eobp)
+ (save-restriction
+ (narrow-to-region (point) (point-max))
+ (funcall erc-fill-function))))))
(defun erc-fill-static ()
"Fills a text such that messages start at column `erc-fill-static-center'."
(length (format-time-string erc-timestamp-format))
0))
-(defun erc-restore-text-properties ()
- "Restore the property 'erc-parsed for the region."
- (let* ((parsed-posn (text-property-not-all (point-min) (point-max)
- 'erc-parsed nil))
- (parsed-prop (when parsed-posn
- (get-text-property parsed-posn 'erc-parsed))))
- (put-text-property (point-min) (point-max) 'erc-parsed parsed-prop)))
-
(provide 'erc-fill)
;;; erc-fill.el ends here