[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to automatically write *Messages" buffer to a file?
From: |
Joe Corneli |
Subject: |
Re: How to automatically write *Messages" buffer to a file? |
Date: |
Wed, 24 Nov 2004 22:56:20 -0600 |
OK, so I tried rewriting the code without advice.
But there are still a number of problems.
First of all, it seems that the arguments being sent to the
`after-change-functions' aren't quite right.
There may be other problems too.
;; messages to log file
(defun start-logging ()
(interactive)
(set-buffer "*Messages*")
(add-hook 'after-change-functions 'write-to-log)
(message (concat "begin logging " (current-time-string))))
(defun write-to-log (beg end len)
;; This message reveals that the *Messages* buffer
;; and the echo area are joined at the hip. `beg'
;; and `end' are positions in the echo area!
; (message (format "%s %s" (- (point-max) (- end beg)) (point-max)))
(save-excursion (set-buffer "*Messages*")
(write-region
;; this region doesn't seem to include the
;; final character, but I can't change the
;; way it is written or I get error.
;;
;; the obvious choice
;; beg end
;; doesn't work either.
(- (point-max)
(- end beg))
(point-max)
"~/LOG" t 'quiet)))
(defun stop-logging ()
(interactive)
(message (concat "stop logging " (current-time-string)))
(set-buffer "*Messages*")
(remove-hook 'after-change-functions 'write-to-log))
(defun test-message ()
(interactive)
(message "hi"))
- How to automatically write *Messages" buffer to a file?, Brad Collins, 2004/11/23
- Re: How to automatically write *Messages" buffer to a file?, Pascal Bourguignon, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Eli Zaretskii, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Stefan Monnier, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Stefan Monnier, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- RE: How to automatically write *Messages" buffer to a file?, Drew Adams, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?,
Joe Corneli <=
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Stefan Monnier, 2004/11/25
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Thien-Thi Nguyen, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/25