--- Begin Message ---
Subject: |
[PATCH] Prevent spurious clash warnings when looking at an ERC log file and logging to it |
Date: |
Sun, 30 Sep 2007 14:48:06 +0200 |
When I open an ERC log file read-only in a buffer and am concurrently
writing to it (with erc-enable-logging and activity in the relevant
channel), I get told regularly that [file] has changed on disk; really edit
the buffer? (I put a backtrace call in
#’ask-user-about-supersession-threat-minibuf and there’s some sample output
below.) This is inappropriate--actual clashes will be detected in the actual
buffer, later, and won’t be for read-only buffers--and can be avoided by
binding inhibit-clash-detection to to in #'erc-save-buffer-in-logs.
xemacs-packages/erc/ChangeLog addition:
2007-09-30 Aidan Kehoe <address@hidden>
* erc-log.el (erc-save-buffer-in-logs):
Prevent spurious warnings when looking at a log file and
concurrently saving to it.
XEmacs Packages source patch:
Diff command: cvs -q diff -Nu
Files affected: xemacs-packages/erc/erc-log.el
===================================================================
RCS
Index: xemacs-packages/erc/erc-log.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/erc/erc-log.el,v
retrieving revision 1.9
diff -u -u -r1.9 erc-log.el
--- xemacs-packages/erc/erc-log.el 2006/02/19 12:57:29 1.9
+++ xemacs-packages/erc/erc-log.el 2007/09/30 12:39:34
@@ -328,7 +328,8 @@
(or buffer (setq buffer (current-buffer)))
(when (erc-logging-enabled buffer)
(let ((file (erc-current-logfile buffer))
- (coding-system-for-write erc-log-file-coding-system))
+ (coding-system-for-write erc-log-file-coding-system)
+ (inhibit-clash-detection t))
(save-excursion
(with-current-buffer buffer
(save-restriction
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
backtrace(t t)
(progn (backtrace standard-output t) (let (answer) (while (null answer)
(message "%s changed on disk; really edit the buffer? (y, n, r or C-h) "
(file-name-nondirectory filename)) (let ((tem (downcase (let
((cursor-in-echo-area t)) (read-char))))) (setq answer (if (= tem help-char)
(quote help) (cdr (assoc tem (quote ((?n . yield) (?\^G . yield) (?y . proceed)
(?r . revert) (?\? . help))))))) (cond ((null answer) (beep) (message "Please
type y, n or r; or ? for help") (sit-for 3)) ((eq answer (quote help))
(ask-user-about-supersession-help) (setq answer nil)) ((eq answer (quote
revert)) (revert-buffer nil (not (buffer-modified-p))) (signal (quote
file-supersession) (list "File reverted" filename))) ((eq answer (quote yield))
(signal (quote file-supersession) (list "File changed on disk" filename))))))
(message "File on disk now will become a backup file if you save these
changes.") (setq buffer-backed-up nil)))
# (unwind-protect ...)
(unwind-protect (progn (backtrace standard-output t) (let (answer) (while
(null answer) (message "%s changed on disk; really edit the buffer? (y, n, r or
C-h) " (file-name-nondirectory filename)) (let ((tem (downcase (let
((cursor-in-echo-area t)) (read-char))))) (setq answer (if (= tem help-char)
(quote help) (cdr (assoc tem (quote ((?n . yield) (?\^G . yield) (?y . proceed)
(?r . revert) (?\? . help))))))) (cond ((null answer) (beep) (message "Please
type y, n or r; or ? for help") (sit-for 3)) ((eq answer (quote help))
(ask-user-about-supersession-help) (setq answer nil)) ((eq answer (quote
revert)) (revert-buffer nil (not (buffer-modified-p))) (signal (quote
file-supersession) (list "File reverted" filename))) ((eq answer (quote yield))
(signal (quote file-supersession) (list "File changed on disk" filename))))))
(message "File on disk now will become a backup file if you save these
changes.") (setq buffer-backed-up nil))) (set-window-configuration G62625))
# bind (G62625)
(let ((G62625 (current-window-configuration))) (unwind-protect (progn
(backtrace standard-output t) (let (answer) (while (null answer) (message "%s
changed on disk; really edit the buffer? (y, n, r or C-h) "
(file-name-nondirectory filename)) (let ((tem (downcase (let
((cursor-in-echo-area t)) (read-char))))) (setq answer (if (= tem help-char)
(quote help) (cdr (assoc tem (quote ((?n . yield) (?\^G . yield) (?y . proceed)
(?r . revert) (?\? . help))))))) (cond ((null answer) (beep) (message "Please
type y, n or r; or ? for help") (sit-for 3)) ((eq answer (quote help))
(ask-user-about-supersession-help) (setq answer nil)) ((eq answer (quote
revert)) (revert-buffer nil (not (buffer-modified-p))) (signal (quote
file-supersession) (list "File reverted" filename))) ((eq answer (quote yield))
(signal (quote file-supersession) (list "File changed on disk" filename))))))
(message "File on disk now will become a backup file if you save these
changes.") (setq buffer-backed-up nil))) (set-window-configuration G62625)))
(save-window-excursion (backtrace standard-output t) (let (answer) (while
(null answer) (message "%s changed on disk; really edit the buffer? (y, n, r or
C-h) " (file-name-nondirectory filename)) (let ((tem (downcase (let
((cursor-in-echo-area t)) (read-char))))) (setq answer (if (= tem help-char)
(quote help) (cdr (assoc tem (quote ((?n . yield) (?\^G . yield) (?y . proceed)
(?r . revert) (?\? . help))))))) (cond ((null answer) (beep) (message "Please
type y, n or r; or ? for help") (sit-for 3)) ((eq answer (quote help))
(ask-user-about-supersession-help) (setq answer nil)) ((eq answer (quote
revert)) (revert-buffer nil (not (buffer-modified-p))) (signal (quote
file-supersession) (list "File reverted" filename))) ((eq answer (quote yield))
(signal (quote file-supersession) (list "File changed on disk" filename))))))
(message "File on disk now will become a backup file if you save these
changes.") (setq buffer-backed-up nil)))
# bind (filename)
ask-user-about-supersession-threat-minibuf("/home/aidan/.irc/logs/address@hidden:7000.txt")
# bind (filename)
ask-user-about-supersession-threat("/home/aidan/.irc/logs/address@hidden:7000.txt")
# (unwind-protect ...)
write-region-internal(15331 15446
"/home/aidan/.irc/logs/address@hidden:7000.txt" t nomessage nil escape-quoted)
# bind (func coding-system lockname visit append filename end start)
write-region(15331 15446 "/home/aidan/.irc/logs/address@hidden:7000.txt" t
nomessage)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# bind (file coding-system-for-write buffer)
erc-save-buffer-in-logs()
run-hooks(erc-save-buffer-in-logs)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# bind (string buffer-undo-list inhibit-read-only insert-position)
# (unwind-protect ...)
# bind (buffer string)
erc-display-line-1("*** }{obbes (address@hidden) has quit: Read error: 110
(Connection timed out)" #<buffer "#linguistics">)
# bind (--dolist-temp--12738 buf inhibit-point-motion-hooks new-bufs buffer
string)
erc-display-line("*** }{obbes (address@hidden) has quit: Read error: 110
(Connection timed out)" (#<buffer "#linguistics">))
# bind (string args msg buffer type parsed)
erc-display-message([cl-struct-erc-response ":address@hidden QUIT :Read
error: 110 (Connection timed out)" "address@hidden" "QUIT" ("Read error: 110
(Connection timed out)") "Read error: 110 (Connection timed out)"] notice
(#<buffer "#linguistics">) QUIT ?n "}{obbes" ?u "n=pinnerup" ?h
"ip247.rev112.brygge.net" ?r "Read error: 110 (Connection timed out)")
# bind (host login nick G13502 reason bufs parsed proc)
erc-server-QUIT(#<network connection "erc-irc.freenode.net-7000" (7000 .
"irc.freenode.net") state:run> [cl-struct-erc-response ":address@hidden QUIT
:Read error: 110 (Connection timed out)" "address@hidden" "QUIT" ("Read error:
110 (Connection timed out)") "Read error: 110 (Connection timed out)"])
run-hook-with-args-until-success(erc-server-QUIT #<network connection
"erc-irc.freenode.net-7000" (7000 . "irc.freenode.net") state:run>
[cl-struct-erc-response ":address@hidden QUIT :Read error: 110 (Connection
timed out)" "address@hidden" "QUIT" ("Read error: 110 (Connection timed out)")
"Read error: 110 (Connection timed out)"])
# bind (hook message process)
erc-call-hooks(#<network connection "erc-irc.freenode.net-7000" (7000 .
"irc.freenode.net") state:run> [cl-struct-erc-response ":address@hidden QUIT
:Read error: 110 (Connection timed out)" "address@hidden" "QUIT" ("Read error:
110 (Connection timed out)") "Read error: 110 (Connection timed out)"])
# bind (parsed-response process)
erc-handle-parsed-server-response(#<network connection
"erc-irc.freenode.net-7000" (7000 . "irc.freenode.net") state:run>
[cl-struct-erc-response ":address@hidden QUIT :Read error: 110 (Connection
timed out)" "address@hidden" "QUIT" ("Read error: 110 (Connection timed out)")
"Read error: 110 (Connection timed out)"])
# bind (posn msg)
# (unwind-protect ...)
# bind (match-data string proc)
erc-parse-server-response(#<network connection "erc-irc.freenode.net-7000"
(7000 . "irc.freenode.net") state:run> ":address@hidden QUIT :Read error: 110
(Connection timed out)")
# bind (line erc-server-processing-p)
# (unwind-protect ...)
# bind (string process)
erc-server-filter-function(#<network connection "erc-irc.freenode.net-7000"
(7000 . "irc.freenode.net") state:run> ":address@hidden QUIT :Read error: 110
(Connection timed out)\n")
# (condition-case ... . error)
# (catch top-level ...)
--- End Message ---