[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bypass encoding selection in automated function
From: |
tpeplt |
Subject: |
Re: Bypass encoding selection in automated function |
Date: |
Sat, 15 Feb 2025 18:59:25 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Christopher Howard <christopher@librehacker.com> writes:
>
> I don't know of a way to dump the string directly to a file, so I'm
> dumping the string to a buffer, and then using write-region to dump
> that to a file. This basically works, except that before Emacs writes
> the file, first it asks the user to manually select an encoding. But
> this function can't depend on any manual intervention.
>
> Could somebody advise me about the simplest solution here. I just want
> to pass the exact contents I received from the API, into the file,
> without any changes.
To read the Emacs Lisp reference manual’s chapter on files, evaluate the
following expression in Emacs:
(info "(elisp) Files")
Its first sentence reads:
"This chapter describes the Emacs Lisp functions and variables to find,
create, view, save, and otherwise work with files and directories."
That chapter contains the section titled "Writing to Files":
(info "(elisp) Writing to Files")
What you are looking for is likely the ‘with-temp-file’ macro, which is
described in that section.
Also, from the Help menu in Emacs:
Help -> Search Documentation -> Lookup Subject in Elisp Manual...
can be used to guess about what might be appropriate (but sometimes
guessing does not work -- no matches or too many matches).
--
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.