all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How can i write to file in background in elisp...
@ 2011-11-11 23:25 Oleksandr Gavenko
  2011-11-11 23:54 ` Deniz Dogan
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Gavenko @ 2011-11-11 23:25 UTC (permalink / raw
  To: help-gnu-emacs

I write:

  (let (
        (coding-system-for-read 'utf-8)
        (coding-system-for-write 'utf-8)
        )
    (save-excursion
      (find-file stmcrblog-file)
      (beginning-of-buffer)
      (insert
       (format-time-string "%Y-%m-%d %H:%M" (current-time))
       " "  msg  "\n")
      (save-buffer)
      (kill-buffer)
      ))

but afraid that this is not correct way to write to file without splashing it
into to user...

How can i write to file in background in elisp?

-- 
Best regards!




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

* Re: How can i write to file in background in elisp...
  2011-11-11 23:25 How can i write to file in background in elisp Oleksandr Gavenko
@ 2011-11-11 23:54 ` Deniz Dogan
  2011-11-11 23:55   ` Deniz Dogan
  0 siblings, 1 reply; 3+ messages in thread
From: Deniz Dogan @ 2011-11-11 23:54 UTC (permalink / raw
  To: Oleksandr Gavenko; +Cc: help-gnu-emacs

On 2011-11-12 00:25, Oleksandr Gavenko wrote:
> I write:
>
>    (let (
>          (coding-system-for-read 'utf-8)
>          (coding-system-for-write 'utf-8)
>          )
>      (save-excursion
>        (find-file stmcrblog-file)
>        (beginning-of-buffer)
>        (insert
>         (format-time-string "%Y-%m-%d %H:%M" (current-time))
>         " "  msg  "\n")
>        (save-buffer)
>        (kill-buffer)
>        ))
>
> but afraid that this is not correct way to write to file without splashing it
> into to user...
>
> How can i write to file in background in elisp?
>

You could try using:

(with-temp-buffer
   (insert "foo")
   (write-file "bar"))

I hope that helps!

Deniz




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

* Re: How can i write to file in background in elisp...
  2011-11-11 23:54 ` Deniz Dogan
@ 2011-11-11 23:55   ` Deniz Dogan
  0 siblings, 0 replies; 3+ messages in thread
From: Deniz Dogan @ 2011-11-11 23:55 UTC (permalink / raw
  To: Oleksandr Gavenko; +Cc: help-gnu-emacs

On 2011-11-12 00:54, Deniz Dogan wrote:
> On 2011-11-12 00:25, Oleksandr Gavenko wrote:
>> I write:
>>
>> (let (
>> (coding-system-for-read 'utf-8)
>> (coding-system-for-write 'utf-8)
>> )
>> (save-excursion
>> (find-file stmcrblog-file)
>> (beginning-of-buffer)
>> (insert
>> (format-time-string "%Y-%m-%d %H:%M" (current-time))
>> " " msg "\n")
>> (save-buffer)
>> (kill-buffer)
>> ))
>>
>> but afraid that this is not correct way to write to file without
>> splashing it
>> into to user...
>>
>> How can i write to file in background in elisp?
>>
>
> You could try using:
>
> (with-temp-buffer
> (insert "foo")
> (write-file "bar"))
>
> I hope that helps!
>

Oh, and `insert-file' or `insert-file-contents'!

Deniz





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

end of thread, other threads:[~2011-11-11 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 23:25 How can i write to file in background in elisp Oleksandr Gavenko
2011-11-11 23:54 ` Deniz Dogan
2011-11-11 23:55   ` Deniz Dogan

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.