Questions tagged [read]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
27 views

How to preselect initial text in the minibuffer with Elisp?

I'm using read-string to read a string from the minibuffer, with an initial input. How can I highlight the initial input, so that I can start replacing it with one key stroke? IOW, given (read-string &...
user avatar
  • 1,414
1 vote
3 answers
36 views

How to read multiple expressions from stream?

When calling (read "(+ 1 2) (+ 2 3)"), I get (+ 1 2), as expected. How can I get the next expression, namely (+ 2 3)?
user avatar
0 votes
1 answer
31 views

read-char-from-minibuffer for optional argument

The following counts the number of opening (brcmk-beg) and closing (brcmk-end) braces. Having brcmk-end an optional argument, I would like to print $begmk nil $count-begmk 0 when the user either ...
user avatar
  • 159
0 votes
1 answer
33 views

Reading a word or regular expression from the mini-buffer to a function

What function should I call to read a word or regular expression from the minibuffer? Am writing a function that accepts a word or regular expression and counts the number of matches. But need to ...
user avatar
  • 159
0 votes
1 answer
30 views

read: Transferring an alist (containing a comma) from a file to a variable

I have a file, "/path/to/token-file.el", which contains an alist: ((access ((access_token 123abc456) (timestamp ((43 5 21 29 12 2021 3 nil 0) (Wed, 29 Dec 2021 21:05:43 GMT)...
user avatar
  • 17.7k
2 votes
0 answers
27 views

Distinguish expected from erroneous end-of-file in read function?

What is the correct way to use (read (current-buffer)) to read from a buffer until the end of the file is reached? When no forms remain in a buffer, Emacs signals an error: (with-temp-buffer ...
user avatar
  • 1,481
0 votes
1 answer
50 views

How to read an s-expression at load-time

Why does it seem impossible to read an s-expression at load-time? Given this and only this s-expression in my init file: (save-excursion (end-of-defun) (beginning-of-defun) (setq beg (point)) (...
user avatar
4 votes
1 answer
473 views

How can I convert a string form of a list to an actual list?

I would like to convert these two strings "(a b c)" "(9 . 3)" to these (a b c) (9 . 3) I'd had some luck with the first one evaluating this, (mapcar 'intern (split-string (string-...
user avatar
  • 313
1 vote
1 answer
26 views

Is there an easy way to use thing-at-point to initialize interactive read string (interactive "sfoo:")

Is there an easy way to use thing-at-point to initialize the contents of an interactive string reading? I have a function the looks something like this: (defun foo (string) (interactive "...
user avatar
1 vote
1 answer
150 views

Filter the content read from file

(This follows the answer to the question: Completion of sentences stored in a file.) Suppose I have a file, the content of which being organized thanks to org-mode: * Dreams ≠ reality Please, don'...
user avatar
4 votes
1 answer
668 views

Read first N lines of file into list

The general way this seems to be done using Elisp is to first read the entire file using something like insert-file-contents-literally or find-file-no-select, using split-string on a newline, and then ...
user avatar
  • 3,885
0 votes
1 answer
102 views

How set default number (1) in the interactive custom function

here custom function: (defun increment-number-at-point(number) (interactive "nInput increment number:") (skip-chars-backward "0-9") (or (looking-at "[0-9]+") (error "No number at point")) ...
user avatar
  • 3,425
2 votes
1 answer
412 views

What does hash s indicate in lisp

This is the result of M-: (elfeed-search-selected :ignore-region) #s(elfeed-entry ("www.cbc.com.com" . "https://www.cbc.com.com/defg/Polyglot-programming_%7E017e364530a5359046?source=rss") ...
user avatar
1 vote
0 answers
44 views

What methods are available for complex user input?

I am experimenting with writing a plugin which requires quite a bit of user input, its a front end to an api. A typical request will have 4 required inputs and many optional inputs, obviously I can ...
user avatar
  • 503
4 votes
2 answers
1k views

How to read elisp file into s-expression?

I have a file of elisp code, say foo.el. I want to turn the content into a s-expression, so that I can play with it. Right now, I use the following method: Read foo.el into a string. Turn the string ...
user avatar
  • 161
2 votes
1 answer
269 views

How should you read a Lisp file as Lisp for processing without condition-case?

To help catch predictable errors, I've written my own linting tasks that read the code and report any inconsistencies it finds. One of the hackier pieces to this right now is the following function: ...
user avatar
  • 6,681
1 vote
1 answer
472 views

Read input char without pressing RET

I want to perform the same task as in the function below, but without having to press ENTER every time I select an option. (defun my-fun () (interactive) (setq something (read-string "Options:\n [...
user avatar
  • 35
1 vote
0 answers
60 views

How do I read and parse other Lisps in Emacs

I am playing with LFE language and I try to improve documentation lookup. Some of my efforts can be seen on my Github repo I have a function sexp-at-point which return a string enclosed by round ...
user avatar
12 votes
1 answer
1k views

Meaning of period in (. 123)

I learnt . /path/to/file in bash is used to execute a file. Just out of curiosity, I eval something like the following in Emacs (. 123) ⇒ 123 (read "(. 123)") ⇒ 123 It looks like Emacs ...
user avatar
  • 13.6k
2 votes
1 answer
1k views

Read a config file and get some value into elisp variable

I'm trying to read a value of variable context from the config file. I use something like this (but have got an error..): (with-current-buffer (insert-file-contents "/home/user/liquibase.properties") ...
user avatar
  • 123
3 votes
1 answer
814 views

How to handle end of file during parsing errors while reading a string?

I was trying to read and eval Lisp forms from a string using a loop, instead of just putting the string into a buffer and using eval-buffer to load everything in the string. That method was mentioned ...
user avatar
  • 1,218
25 votes
3 answers
4k views

How to evaluate Elisp code contained in a string?

The question pretty much says it all: I have a string containing the source code for a valid Elisp expression, and I would like to evaluate it. (In Python, for example, the expression eval("1 - 2 + 3"...
user avatar
  • 2,909
2 votes
1 answer
78 views

How to add-to-list to read-in file contents

When I do this (setq v (f-read-text "s.el")) where s.el is of this form ((thing1 . thing2) (thing3 . thing4)) I get v back as one long string. And (setq v (append (f-read-text "s.el"))) doesn't seem ...
user avatar
  • 2,717