unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Can emacs be made to right Messages buffer to disc?
@ 2008-06-29 14:22 reader
  2008-07-02  2:29 ` Kevin Rodgers
       [not found] ` <mailman.14105.1214965793.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: reader @ 2008-06-29 14:22 UTC (permalink / raw)
  To: help-gnu-emacs

I asked this question when emacs 21 was current and if I recall there
was some horribly complicated (requiring coding and good knowledge of
elisp) way to do it.

I wondered if with 22 or even 23 one can write the \*Messages\* buffer
to disc as a session progresses any easier than before?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
  2008-06-29 14:22 Can emacs be made to right Messages buffer to disc? reader
@ 2008-07-02  2:29 ` Kevin Rodgers
  2008-07-03  3:56   ` Harry Putnam
       [not found] ` <mailman.14105.1214965793.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2008-07-02  2:29 UTC (permalink / raw)
  To: help-gnu-emacs

reader@newsguy.com wrote:
> I asked this question when emacs 21 was current and if I recall there
> was some horribly complicated (requiring coding and good knowledge of
> elisp) way to do it.
> 
> I wondered if with 22 or even 23 one can write the \*Messages\* buffer
> to disc as a session progresses any easier than before?

I vaguely remember that thread, but I couldn't find it on the web.  In
any case, I think it's not too complicated (everything worth doing in
Emacs requires a basic knowledge of Emacs Lisp):

(setq message-log-max t); Emacs Lisp!!!

(with-current-buffer (get-buffer "*Messages*")
   (setq buffer-file-name "~/.emacs_messages")
   (setq buffer-offer-save t)) ; just in case

(defun save-messages-buffer ()
   (with-current-buffer (get-buffer "*Messages*")
     (save-buffer 0))) ; or just (basic-save-buffer)

(add-hook 'pre-command-hook 'save-messages-buffer)
(add-hook 'post-command-hook 'save-messages-buffer)

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
  2008-07-02  2:29 ` Kevin Rodgers
@ 2008-07-03  3:56   ` Harry Putnam
  2008-07-03  9:37     ` Thien-Thi Nguyen
  0 siblings, 1 reply; 7+ messages in thread
From: Harry Putnam @ 2008-07-03  3:56 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> reader@newsguy.com wrote:
>> I asked this question when emacs 21 was current and if I recall there
>> was some horribly complicated (requiring coding and good knowledge of
>> elisp) way to do it.
>>
>> I wondered if with 22 or even 23 one can write the \*Messages\* buffer
>> to disc as a session progresses any easier than before?
>
> I vaguely remember that thread, but I couldn't find it on the web.  In
> any case, I think it's not too complicated (everything worth doing in
> Emacs requires a basic knowledge of Emacs Lisp):

[...] snipped the nice example... thanks.

Nice... thank you.  I have to beg to differ on one point and I'm sure
you meant no harm with it...

>. . . . . . . . . . . . .  (everything worth doing in
> Emacs requires a basic knowledge of Emacs Lisp):

Not so... I have only a vague knowledge of emacs lisp and have managed
to use emacs in useful ways every day (or nearly so) for at least 10
yrs.  Much to the chagrin of this list.. I imagine,ue to the
ill-informed questions I've often posed here.

I always think I'm going to take out the time to learn some elisp but
have just never done it.  Its not really due to laziness or at least
not only laziness either.  Seems something more immediate always comes
up.

Further I haven't found a nifty way into the learning part like I have
with perl or shell scripting where I've needed to learn a little of
each to admin my home machines and my videography (hobby/business).

In those cases, with a basic knowledge of shell scripting I've been
able to learn a fair bit of perl by seeing code and asking lots of
questions. ... not so with elisp.

The question part never fails on this list, but I've never been able
to look at the code and sort of start to see how it works.   Then sort
of ease right into useful coding.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
  2008-07-03  3:56   ` Harry Putnam
@ 2008-07-03  9:37     ` Thien-Thi Nguyen
  0 siblings, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2008-07-03  9:37 UTC (permalink / raw)
  To: Harry Putnam; +Cc: help-gnu-emacs

() Harry Putnam <reader@newsguy.com>
() Wed, 02 Jul 2008 22:56:36 -0500

   The question part never fails on this list, but I've never been
   able to look at the code and sort of start to see how it works.
   Then sort of ease right into useful coding.

Probably a future Emacs will have video-editing support; hopefully
the code posted re those issues will be more engaging to you.

thi




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
       [not found] ` <mailman.14105.1214965793.18990.help-gnu-emacs@gnu.org>
@ 2008-07-03 15:18   ` Nordlöw
  2008-07-03 19:48     ` Xah
  2008-07-03 20:32     ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: Nordlöw @ 2008-07-03 15:18 UTC (permalink / raw)
  To: help-gnu-emacs

> (defun save-messages-buffer ()
>    (with-current-buffer (get-buffer "*Messages*")
>      (save-buffer 0))) ; or just (basic-save-buffer)
>
> (add-hook 'pre-command-hook 'save-messages-buffer)
> (add-hook 'post-command-hook 'save-messages-buffer)

This behaviour is not that useable as it constantly clutters the
minibuffer with the message "Wrote ~/.emacs_message". Can we make save-
buffer() silent perhaps?

It also writes to disc every time every time we navigate in the source
code which I believe is not that good for performance. I believe a
better solution would be to auto-save the buffer reguarly using a time
interval. Somebody know how?

/Nordlöw


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
  2008-07-03 15:18   ` Nordlöw
@ 2008-07-03 19:48     ` Xah
  2008-07-03 20:32     ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Xah @ 2008-07-03 19:48 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw wrote:
«I believe a better solution would be to auto-save the buffer reguarly
using a time interval. Somebody know how?»

You can use the run-with-timer function. Here's a example snippet:

; record opened files (session) every 5 min
(run-with-timer 600 600 'desktop-save "~/")

  Xah
∑ http://xahlee.org/

☄

On Jul 3, 8:18 am, Nordlöw <per.nord...@gmail.com> wrote:
> > (defun save-messages-buffer ()
> >    (with-current-buffer (get-buffer "*Messages*")
> >      (save-buffer 0))) ; or just (basic-save-buffer)
>
> > (add-hook 'pre-command-hook 'save-messages-buffer)
> > (add-hook 'post-command-hook 'save-messages-buffer)
>
> This behaviour is not that useable as it constantly clutters the
> minibuffer with the message "Wrote ~/.emacs_message". Can we make save-
> buffer() silent perhaps?
>
> It also writes to disc every time every time we navigate in the source
> code which I believe is not that good for performance. I believe a
> better solution would be to auto-save the buffer reguarly using a time
> interval. Somebody know how?
>
> /Nordlöw



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Can emacs be made to right Messages buffer to disc?
  2008-07-03 15:18   ` Nordlöw
  2008-07-03 19:48     ` Xah
@ 2008-07-03 20:32     ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-07-03 20:32 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw wrote:
>> (defun save-messages-buffer ()
>>    (with-current-buffer (get-buffer "*Messages*")
>>      (save-buffer 0))) ; or just (basic-save-buffer)
>>
>> (add-hook 'pre-command-hook 'save-messages-buffer)
>> (add-hook 'post-command-hook 'save-messages-buffer)
> 
> This behaviour is not that useable as it constantly clutters the
> minibuffer with the message "Wrote ~/.emacs_message". Can we make save-
> buffer() silent perhaps?
> 
> It also writes to disc every time every time we navigate in the source
> code which I believe is not that good for performance. I believe a
> better solution would be to auto-save the buffer reguarly using a time
> interval. Somebody know how?

That message comes from write-region, which fortunately provide a way to
silence it:

(defun save-messages-buffer ()
   (with-current-buffer (get-buffer "*Messages*")
     ;; (save-buffer 0) or even just (basic-save-buffer) is too noisy, so
     ;; we lose their functionality (including basic-save-buffer-1 and
     ;; basic-save-buffer-2):
     (when (and buffer-file-name
	       (buffer-modified-p))
       (write-region (point-min) (point-max) buffer-file-name
		    nil 'quiet))))

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-03 20:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-29 14:22 Can emacs be made to right Messages buffer to disc? reader
2008-07-02  2:29 ` Kevin Rodgers
2008-07-03  3:56   ` Harry Putnam
2008-07-03  9:37     ` Thien-Thi Nguyen
     [not found] ` <mailman.14105.1214965793.18990.help-gnu-emacs@gnu.org>
2008-07-03 15:18   ` Nordlöw
2008-07-03 19:48     ` Xah
2008-07-03 20:32     ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).