Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In emacs lisp how can I append a string to a file that I don't like to open?

Tags:

emacs

elisp

I need to append a string S(belonging to no buffer) to a special file F, but since I hope this operation takes as little time as possible I don't want F opened as a buffer.

AFAIK, there is a built-in function in emacs called write-region, but this requires the content to be written into F inside one of the buffers(while in my case there is no guarantee that S should be such a string). How can I make it?

like image 264
Hongxu Chen Avatar asked Jun 29 '13 04:06

Hongxu Chen


People also ask

How do I write to a file in Emacs?

To insert text into a buffer, place the cursor where you want to start inserting text, and start typing away. If you want to insert the contents of another file into the current buffer, place the cursor at the desired insertion point, and type Control-X-I. Emacs will ask you for the name of the file you wish to insert.

What does #' mean in Emacs Lisp?

function (aka #' ) is used to quote functions, whereas quote (aka ' ) is used to quote data.

How do I Lisp in emacs?

In a fresh Emacs window, type ESC-x lisp-interaction-mode . That will turn your buffer into a LISP terminal; pressing Ctrl+j will feed the s-expression that your cursor (called "point" in Emacs manuals' jargon) stands right behind to LISP, and will print the result.

Is Emacs Lisp compiled or interpreted?

Emacs Lisp has a compiler that translates functions written in Lisp into a special representation called byte-code that can be executed more efficiently. The compiler replaces Lisp function definitions with byte-code. When a byte-code function is called, its definition is evaluated by the byte-code interpreter.


1 Answers

(write-region <STRING> nil <FILENAME> 'append)

like image 109
Stefan Avatar answered Nov 03 '22 01:11

Stefan