APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1375541218 -3600
# Node ID d56da29e55b2ddc5d8e2bf23f4a53b184913bc4e
# Parent 63205fffa0eca7e872cb62c176cda7d1e0d627f6
Fix a couple of ERC bugs, thank you Johann Myrkraverk Oskarsson.
ChangeLog addition:
2013-08-03 Aidan Kehoe <kehoea(a)parhasard.net>
* erc-log.el (erc-log-setup-logging):
Avoid attempting to insert at a negative offset if the log file is
smaller than erc-max-buffer-size; patch from Johann 'Myrkraverk'
Oskarsson <myrkraverk(a)gmail.com>, thank you Johann.
* erc-goodies.el (erc-make-read-only):
Avoid making the input buffer, or its prefix, read-only on
truncating. Also from Johann, thank you Johann.
diff -r 63205fffa0ec -r d56da29e55b2 ChangeLog
--- a/ChangeLog Sat Sep 03 14:45:36 2011 +0200
+++ b/ChangeLog Sat Aug 03 15:46:58 2013 +0100
@@ -1,3 +1,13 @@
+2013-08-03 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * erc-log.el (erc-log-setup-logging):
+ Avoid attempting to insert at a negative offset if the log file is
+ smaller than erc-max-buffer-size; patch from Johann 'Myrkraverk'
+ Oskarsson <myrkraverk(a)gmail.com>, thank you Johann.
+ * erc-goodies.el (erc-make-read-only):
+ Avoid making the input buffer, or its prefix, read-only on
+ truncating. Also from Johann, thank you Johann.
+
2009-09-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 0.23 released.
diff -r 63205fffa0ec -r d56da29e55b2 erc-goodies.el
--- a/erc-goodies.el Sat Sep 03 14:45:36 2011 +0200
+++ b/erc-goodies.el Sat Aug 03 15:46:58 2013 +0100
@@ -106,9 +106,20 @@
(defun erc-make-read-only ()
"Make all the text in the current buffer read-only.
Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
- (put-text-property (point-min) (point-max) 'read-only t)
- (put-text-property (point-min) (point-max) 'front-sticky t)
- (put-text-property (point-min) (point-max) 'rear-nonsticky t))
+ (if (featurep 'xemacs)
+ (let ((extent (car (extent-list nil nil nil nil 'name 'erc-read-only))))
+ (cond (extent
+ ;; The buffer may be (or definitely is) narrowed to the
+ ;; recently inserted text, hence explicitly using 1 and not
+ ;; (point-min).
+ (set-extent-endpoints extent 1 erc-insert-marker))
+ (t
+ (setq extent (make-extent 1 erc-insert-marker))
+ (set-extent-property extent 'name 'erc-read-only)
+ (set-extent-property extent 'read-only t))))
+ (put-text-property (point-min) (point-max) 'read-only t)
+ (put-text-property (point-min) (point-max) 'front-sticky t)
+ (put-text-property (point-min) (point-max) 'rear-nonsticky t)))
;; Distinguish non-commands
(defvar erc-noncommands-list '(erc-cmd-ME
diff -r 63205fffa0ec -r d56da29e55b2 erc-log.el
--- a/erc-log.el Sat Sep 03 14:45:36 2011 +0200
+++ b/erc-log.el Sat Aug 03 15:46:58 2013 +0100
@@ -235,7 +235,7 @@
(start (if (and log-file-size
(memq 'erc-truncate-buffer
erc-insert-post-hook))
- (- log-file-size erc-max-buffer-size)
+ (max (- log-file-size erc-max-buffer-size) 0)
0)))
(ignore-errors (insert-file-contents log-file nil start
log-file-size))
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches