erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][master] Conditionally remove the erc-parsed proper


From: mwolson
Subject: [Erc-commit] [commit][master] Conditionally remove the erc-parsed property after displaying message.
Date: Thu, 10 Jan 2008 18:20:03 -0500

commit 9ed4989fb4d0f2f3e4f5e87dc11ab7ae1554e837
Author: Michael W. Olson <address@hidden>
Date:   Thu Jan 10 18:15:52 2008 -0500

    Conditionally remove the erc-parsed property after displaying message.

diff --git a/ChangeLog b/ChangeLog
index 1ca1775..d99ca50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,10 @@
        (erc-notice-face): If we have less than 88 colors, make this
        blue.  Otherwise the text will be pink in a tty, which looks
        dreadful.  Thanks to e1f for the report.
+       (erc-remove-parsed-property): New option that determines whether
+       to remove the erc-parsed property after displaying a message.
+       This should have the effect of making ERC take up less memory.
+       (erc-display-line-1): Use it.
 
 2008-01-04  Stefan Monnier  <address@hidden>
 
diff --git a/erc.el b/erc.el
index 716890c..92299fb 100644
--- a/erc.el
+++ b/erc.el
@@ -2321,6 +2321,15 @@ If ARG is non-nil, show the *erc-protocol* buffer."
 I.e. any char in it has the `invisible' property set."
   (text-property-any 0 (length string) 'invisible t string))
 
+(defcustom erc-remove-parsed-property t
+  "Whether to remove the erc-parsed text property after displaying a message.
+
+The default is to remove it, since it causes ERC to take up extra
+memory.  If you have code that relies on this property, then set
+this option to nil."
+  :type 'boolean
+  :group 'erc)
+
 (defun erc-display-line-1 (string buffer)
   "Display STRING in `erc-mode' BUFFER.
 Auxiliary function used in `erc-display-line'.  The line gets filtered to
@@ -2361,7 +2370,10 @@ If STRING is nil, the function does nothing."
                (save-restriction
                  (narrow-to-region insert-position (point))
                  (run-hooks 'erc-insert-modify-hook)
-                 (run-hooks 'erc-insert-post-hook))))))
+                 (run-hooks 'erc-insert-post-hook)
+                 (when erc-remove-parsed-property
+                   (remove-text-properties (point-min) (point-max)
+                                           '(erc-parsed nil))))))))
        (erc-update-undo-list (- (or (marker-position erc-insert-marker)
                                     (point-max))
                                 insert-position))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]