* Saving the Messages buffer
@ 2014-01-21 17:43 Sivaram Neelakantan
0 siblings, 0 replies; 6+ messages in thread
From: Sivaram Neelakantan @ 2014-01-21 17:43 UTC (permalink / raw)
To: help-gnu-emacs
Is there an option to simply save the messages buffer after certain
number of lines/chars? I'm running into some strange issues when ntemacs
kicks off openssl in cygwin and I'd like to save the messages buffer
to debug the issue.
Simply saving the buffer to the same named file with overwrite option?
sivaram
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Saving the Messages buffer
[not found] <mailman.12519.1390326264.10748.help-gnu-emacs@gnu.org>
@ 2014-01-21 22:18 ` Emanuel Berg
2014-01-21 22:58 ` Emanuel Berg
2014-01-22 18:35 ` Emanuel Berg
1 sibling, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2014-01-21 22:18 UTC (permalink / raw)
To: help-gnu-emacs
Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
> Is there an option to simply save the messages buffer
> after certain number of lines/chars? I'm running
> into some strange issues when ntemacs kicks off
> openssl in cygwin and I'd like to save the messages
> buffer to debug the issue.
>
> Simply saving the buffer to the same named file with
> overwrite option?
One way to do it would be to use the auto-save which
Emacs already uses.
;; These are my values (which are probably default) but
;; even if you already have them, and the mode enabled,
;; it might be interesting to see - use `C-x e' with
;; point to the right of the symbol's names to echo
;; their values. (Otherwise just setup as you please.)
(auto-save-mode) ; enable auto-save
(setq auto-save-interval 300) ; auto-save every 300 keydowns
(setq auto-save-timeout 30) ; or after 30 seconds of idle
;; whenever so, save the messages buffer
(add-hook 'auto-save-hook
(lambda ()
(with-current-buffer "*Messages*"
(write-file "~/emacs_messages" nil) ))) ; nil: no confirm
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Saving the Messages buffer
2014-01-21 22:18 ` Saving the Messages buffer Emanuel Berg
@ 2014-01-21 22:58 ` Emanuel Berg
2014-01-22 8:32 ` Kevin Rodgers
[not found] ` <mailman.12551.1390379541.10748.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-01-21 22:58 UTC (permalink / raw)
To: help-gnu-emacs
Aha, so `auto-save-mode' says that auto-save should
apply to the current buffer. So that doesn't make sense
in my previous post, but the hook should still work, as
long as there are buffers "under the influence" all
round, which is likely.
But, using that to solve the problem of the OP, if the
message buffer could be associated with a file, and
then itself subjected to auto-save-mode, that would be
even better. Try:
(let ((buffer "*Messages*"))
(with-current-buffer buffer
(set-visited-file-name buffer t) ; no confirmation
(auto-save-mode) ))
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Saving the Messages buffer
2014-01-21 22:58 ` Emanuel Berg
@ 2014-01-22 8:32 ` Kevin Rodgers
[not found] ` <mailman.12551.1390379541.10748.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2014-01-22 8:32 UTC (permalink / raw)
To: help-gnu-emacs
On 1/21/14 3:58 PM, Emanuel Berg wrote:
> Aha, so `auto-save-mode' says that auto-save should
> apply to the current buffer. So that doesn't make sense
> in my previous post, but the hook should still work, as
> long as there are buffers "under the influence" all
> round, which is likely.
>
> But, using that to solve the problem of the OP, if the
> message buffer could be associated with a file, and
> then itself subjected to auto-save-mode, that would be
> even better. Try:
>
> (let ((buffer "*Messages*"))
> (with-current-buffer buffer
> (set-visited-file-name buffer t) ; no confirmation
> (auto-save-mode) ))
The first arg to set-visited-file-name is FILENAME, not BUFFER.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Saving the Messages buffer
[not found] ` <mailman.12551.1390379541.10748.help-gnu-emacs@gnu.org>
@ 2014-01-22 17:30 ` Emanuel Berg
0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-01-22 17:30 UTC (permalink / raw)
To: help-gnu-emacs
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
>> (let ((buffer "*Messages*")) (with-current-buffer
>> buffer (set-visited-file-name buffer t)
>> (auto-save-mode) ))
>
> The first arg to set-visited-file-name is FILENAME,
> not BUFFER.
Yes, but in that piece of code, "buffer" is not a
buffer, but a *string*, which works both to identify
the buffer (in `with-current-buffer') *and* to specify
a path (in `set-visited-file-name').
If you go to the *Messages* buffer, you will see that
its default-directory is the user home path (if that's
form where Emacs is started), so there is where the
file should go.
The reason the filename is the same as the buffer is
that
> Change name of file visited in current buffer to
> FILENAME. This also renames the buffer to correspond
> to the new file.
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Saving the Messages buffer
[not found] <mailman.12519.1390326264.10748.help-gnu-emacs@gnu.org>
2014-01-21 22:18 ` Saving the Messages buffer Emanuel Berg
@ 2014-01-22 18:35 ` Emanuel Berg
1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-01-22 18:35 UTC (permalink / raw)
To: help-gnu-emacs
Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
> Simply saving the buffer to the same named file with
> overwrite option?
If you don't want to use `auto-save-mode', how about
scheduling the save with the Emacs' "collaborative"
(non-preemptive) idle-timer?
The first argument says how many seconds you should be
idle before Emacs fires off the defun. The `t' says
this shouldn't just happens once, but at every such
instance.
But if you are idle all day, and still get changes to
*Messages*, the function will only be run once, because
(what I can see) it waits for non-idleness before it
resets.
(run-with-idle-timer 10 t
(lambda ()
(with-current-buffer "*Messages*"
(write-file "~/emacs_messages" nil) )))
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-22 18:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.12519.1390326264.10748.help-gnu-emacs@gnu.org>
2014-01-21 22:18 ` Saving the Messages buffer Emanuel Berg
2014-01-21 22:58 ` Emanuel Berg
2014-01-22 8:32 ` Kevin Rodgers
[not found] ` <mailman.12551.1390379541.10748.help-gnu-emacs@gnu.org>
2014-01-22 17:30 ` Emanuel Berg
2014-01-22 18:35 ` Emanuel Berg
2014-01-21 17:43 Sivaram Neelakantan
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.