Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [list]

is for the list object in Lisp programming. A list represents a sequence of zero or more elements. Emacs Lisp relies extensively on the list data structure; it is a fundamental building block. Emacs provides many facilities for building, modifying, extending, and efficiently handling list data structures.

1
vote
1answer
70 views

How to use text-properties in a lambda function

I wish to map the text properties onto a list and them insert them on a new buffer. For some reason the following snippet doesn't work. I've used the -map utility from dash.el package for the map. ...
5
votes
3answers
887 views

How to check if a given string is a substring of an element of a list

According to documentation, member checks if a a given element is an element of a list. For example if the list, say my_list consists of apple and orange, (member "apple" my_list) returns true. Is ...
12
votes
1answer
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 ...
1
vote
1answer
69 views

How to merge two buffers containing questions and answers

In my line of work, I often have one document containing questions and another document containing answers. How can I merge these documents in the form of Question/Answer. BUFFER #1: Q1: Do you ...
7
votes
1answer
302 views

Convert 2-item list to a dotted pair?

Q: how can I convert a 2-item list to a dotted pair cons cell? I can convert a 2-item list to a dotted pair with: (let ((list '(1 2))) (cons (car list) (cadr list))) ; => (1 . 2) I'm ...
1
vote
2answers
61 views

Test whether all elements/symbols of a list are the same (eq)

Project: (1) Push every new this-command onto a list containing any previously pushed this-command. (2) Limit the list to a variable length (e.g., 3 or 5), and chop off the oldest. (3) Compare ...
2
votes
1answer
174 views

Org Mode - Is there a way to reverse org-list-make-subtree?

By using org-list-make-subtree (C-c C-*) you turn an Org List into a sub tree: - Item 1 - Item 2 - Item 3 would turn into * Item 1 ** Item 2 *** Item 3 But is there a built in function (like ...
0
votes
2answers
660 views

How to remove MELPA repository from package-archives?

I added MELPA stable and MELPA repositories with (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa....
3
votes
1answer
125 views

Why is this function not pure

I just spent a significant amount of time debugging an issue that boils down to the following: (defun my-new-alist () `((x . nil))) (setq a (my-new-alist)) (setq b (my-new-alist)) (push 1 (alist-...
15
votes
1answer
2k views

Is '(a . b) really a list?

I'm really confused with the . notation. Is '(a . b) a list? (listp '(a . b)) returns t but when I want to know its length (length '(a . b)) gives an error Wrong type argument: listp, b. The same is ...
0
votes
1answer
540 views

how to access/print a list of a list?

Given; (setq whole '(group1 group2(element1 element2(suba subb subc) element3) group3)) I would to print some list of that list, like element2 sublist. How can i do it?
4
votes
1answer
173 views

Check box add date in org mode

I have a book list contained which will be read or had done. Like this * English books [0/2] - [ ] bible - [ ] When I use C-c C-c to check, is it possible to add date behind or add low level ...
2
votes
1answer
195 views

Change level into list in org mode

I have following text which are expressed in level 5 ***** It's better to be first than it is to be better. ***** The basic issue in marketing is creating a category you can be first in. It’s the law ...
2
votes
1answer
2k views

Indenting lists in org-mode

I copied and paste text in an org file and formatted it as a list: - Funded pensions :: As explained more fully in Chapter 3, funded pensions are paid on behalf of its members. How can I have the ...
12
votes
1answer
432 views

Why does a constant in `let` change with repeated calls? [duplicate]

Say we have such a foo function: (defun foo (e) (let ((lst '(a b c))) (delq e lst))) Then we use it in following way (sequentially evaluating one by one): (foo 'c) ; => (a b) (foo 'b) ; =&...
2
votes
2answers
335 views

Append lists smartly?

How do I append two lists together, and delete duplicates? For example: (setq list1 ("a" "b" "c")) (setq list2 ("b" "c" "d")) (setq list3 (a b c)) (setq list4 (c d e)) ;; use case (append-list-to-...
4
votes
2answers
263 views

How can I paste paragraph not to interrupt numbers in list org mode?

In list environment, after I copy several paragraphs, the next item number will change into number 1, How can I deal with that? For example, 1. aaa 2. aaa 3. aaa bbb <---this is what I copied ...
2
votes
1answer
204 views

how to parameterize prompt for interactive/command?

background I had elisp code (in this very small git repo) like (defun bulk-replace-file (filepath) (interactive "FPath to file to bulk-replace: ") (bulk-replace-file-non-interactive filepath) ) ...
3
votes
1answer
171 views

What has replaced elib?

Looking for some data structures for elisp, I came across this. But then this warns me off -- without specifying exactly what replaces elib. So where do I get packages to do doubly linked lists?
5
votes
1answer
343 views

Converting nested lists to org-mode lists

I need to convert all nested lists present in buffer to org-mode headers using elisp. How can I do this? 1.2.7.2 Some Header Name -> **** Some Header Name
2
votes
1answer
55 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 ...
8
votes
2answers
125 views

Proper reinitialization of a list? What is happening under the hood?

I'm teaching myself some more elisp and have encountered the following problem: If I want to reset a list variable it won't get updated after the first evaluation. Here is some example code: (defun ...
0
votes
1answer
58 views

list data structure split across files?

If I were trying to use a list as a data structure -- and it was getting really big -- is there a precedent of breaking it up and having it span files? One particular list of mine is looking very tree-...
1
vote
1answer
301 views

how to automatically add org-emphasis properties to list titles?

I use org-mode lists, both plain-text lists and numbered lists. I precede my lists with a "list title," which for me is any line ending in a colon. Grocery list: - tomatoes - spinach - blueberries I'...
1
vote
2answers
387 views

How to continue giving list number after insert a block of code

GNU Emacs 24.5.1 (i686-pc-mingw32) Org-mode version 8.2.10 (release_8.2.10 @ e:/emacs/share/emacs/24.5/lisp/org/) In my org file, 1. one thing #+begin_src sh ls -la #+end_src 2. second ...
3
votes
1answer
228 views

What's difference between + and - in the list in org mode

I find I can create bullets with the - and + both. How can I decide when to use + and -
2
votes
1answer
94 views

turn a list into a set of arguments for a function [duplicate]

I have a defun get-quotes with one mandatory and 2 optional arguments. I would like to do something like this: (let ((articles '("/home/matt/art/mice.pdf" '("/home/matt/art/cats.pdf" "Smith, ...
5
votes
2answers
806 views

How to iterate over JSON list and select one element

Say I have a list of names with ids, in JSON: (let ((json-object-type 'plist)) (setq mylist (json-read-from-string "[{\"name\": \"Adam\", \"id\": \"1\"}, {\"...