[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Persistence of variables
From: |
Emanuel Berg |
Subject: |
Re: Persistence of variables |
Date: |
Wed, 21 Mar 2018 22:43:33 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
(defun write-string-to-file (string file)
"Write STRING to FILE.
Create nonexistent FILE otherwise overwrite."
(interactive "sstring: \nFfile: ")
(with-temp-file file
(insert string "\n") ))
;; (write-string-to-file "Leeloo Dallas Multipass" "~/5ifth.txt")
(require 'subr-x)
(defun file-to-string (file)
"Put the contents of FILE into a string and return it."
(interactive "Ffile: ")
(with-temp-buffer
(insert-file-contents file)
(string-trim
(buffer-substring-no-properties (point-min) (point-max)))
))
;; (file-to-string "~/5ifth.txt")
(defmacro read-from-file (var file)
`(setq ,var ,(file-to-string file)) )
(defvar string-value)
(setq string-value "")
;; (read-from-file string-value "~/5ifth.txt")
;; string-value
--
underground experts united
http://user.it.uu.se/~embe8573
- Re: Persistence of variables, (continued)
- Re: Persistence of variables, Eric Abrahamsen, 2018/03/21
- Re: Persistence of variables, Marcin Borkowski, 2018/03/21
- RE: Persistence of variables, Drew Adams, 2018/03/21
- Re: Persistence of variables, tomas, 2018/03/21
- Re: Persistence of variables, Joost Kremers, 2018/03/21
- Re: Persistence of variables, Marcin Borkowski, 2018/03/25
- RE: Persistence of variables, Drew Adams, 2018/03/25
- Message not available
- Re: Persistence of variables, Emanuel Berg, 2018/03/27
- Re: Persistence of variables, Marcin Borkowski, 2018/03/28
- Message not available
- Re: Persistence of variables, Emanuel Berg, 2018/03/28
- Message not available
- Re: Persistence of variables,
Emanuel Berg <=
- Message not available
- Re: Persistence of variables, Robert L., 2018/03/24
- Re: Persistence of variables, Marcin Borkowski, 2018/03/25
- Re: Persistence of variables, Eric Abrahamsen, 2018/03/25
- Re: Persistence of variables, Marcin Borkowski, 2018/03/28
- Message not available
- Re: Persistence of variables, Emanuel Berg, 2018/03/21
- Re: Persistence of variables, Eli Zaretskii, 2018/03/21
- Message not available
- Re: Persistence of variables, Emanuel Berg, 2018/03/21
- Message not available
- Re: Persistence of variables, Rolf Ade, 2018/03/21
- Re: Persistence of variables, Eli Zaretskii, 2018/03/22
- Message not available
- Re: Persistence of variables, Emanuel Berg, 2018/03/23