Questions tagged [alists]
The alists tag has no usage guidance.
21
questions
0
votes
2
answers
70
views
How to map/reduce a list into an alist?
Given a list of things, I want to create an alist by applying a function which creates elements of the alist.
For example, what is the implementation of doit here:
(doit '("a" "b" &...
0
votes
1
answer
66
views
Using the push function to append a list to the default-frame-alist variable
I've noticed some people use this to disable the menu bar in the GUI:
(push '(menu-bar-lines . 0) default-frame-alist)
and some people use this:
(menu-bar-mode -1)
Both achieve the same. The first ...
2
votes
1
answer
60
views
Defcustom definition for plists
I want to write a defcustom definition for a variable my-var.
my-var is an alist that maps strings to plists. Each such plists maps one of three keys (:x, :y, :z) to a list of strings. So, a member ...
3
votes
1
answer
79
views
Emacs native database for fast key/value access?
I would like to do a key -> value lookup for data that may not fit into memory (or simply avoid the overhead of having to load it an keep it in memory).
Does Emacs natively support any kind of ...
0
votes
1
answer
36
views
Working with a list of alists
I have a number of "alists".
(defconst assoc-table-1
'( ("frantic" . "fN") ("authentic" . "atN") ))
(defconst assoc-table-2
'( ("graphology&...
0
votes
1
answer
19
views
Reading the list produced by (mac-frame-geometry)
I just learned about the function (mac-frame-geometry). It produces a list in the form of:
'((outer-position 0 . 25)
(outer-size 1920 . 1055)
(external-border-size 0 . 0)
(title-bar-size 1920 . ...
0
votes
0
answers
29
views
Passing many alists in a loop without actually listing them one by one
The following function add string associations if matches are found within a collection of alists. Currently I am listing the alists andromeda-assoc-tablet-N one by one. Can one manage to this ...
0
votes
1
answer
24
views
Compact way that searches multiple alists
I have a collection of alists, ptc-1 through ptc-5. Would it be possible
to make the following code more compact, rather having to add more sections
if there are more alists?
(let ( (v "") )...
0
votes
1
answer
24
views
Evaluate elements in an alist? [duplicate]
I would like to evaluate an element in an alist, like dynamically generating an alist key for the current year:
((format-time-string "%Y") . ?y) => ("2022" . ?y)
(In my case ...
3
votes
1
answer
232
views
Is it possible to append to a list via .dir-locals.el?
So, I know that I can assign a variable via .dir-locals.el...
("thingy" (1 2 3 4))
but is there any way that I can append to an array, if at all?
("that" . "is correct")
...
1
vote
2
answers
79
views
How to randomize the order of elements in an alist?
I'm using ielm inside Emacs to randomize an associative list. I'm getting duplicate entries a lot of the time, not sure what I'm doing wrong?
(defun q ()
"Q."
(let ((alist))
(setf ...
0
votes
1
answer
36
views
return full list of which element is a member
i know that member returns non-nil if the element is found in the list, but it only returns the tail of the list from element onwards. is there a way to return the full list it is a member of?
my case:...
0
votes
1
answer
78
views
Use regex as key/car in alist
I'd like to set up an alist (similar to auto-mode-alist), which is made up from regular expressions as key (AKA car) of the list. Next I'd like to be able, to match, say the major mode, against the ...
3
votes
1
answer
84
views
How to match the car of alist elements with a regexp?
I've spent a good amount of hours trying to solve this one but without success.
I have an alist with strings
(setq trees '(("pine" . "cones") ("oak" . "acorns") ...
1
vote
1
answer
107
views
Format alist into bullet points
I have this couple of alists:
((melpa . 49) (gnu . 14) (nongnu . 1))
((nongnu (nongnu . markdown-mode)) (gnu (gnu . adaptive-wrap) (gnu . auctex) (gnu . company) (gnu . consult) (gnu . csv-mode) (gnu ...
3
votes
3
answers
77
views
Retrieve alist from list of alists by value of specific key inside of it
I'm probably missing something simple here but... I've got a list of alists parsed from JSON using json-parse-string. The list of alists is like the following (details omitted for brevity):
( ((id . 1)...
2
votes
2
answers
642
views
setf + alist-get but with "equal" instead of "eq"?
I got a suggestion to use setf to replace value in an alist: Replace element in a list / add in case of absence, with custom test/key functions
The example was provided, but it doesn't work if key is ...
0
votes
1
answer
161
views
Apply settings in .dir-locals.el to both c and c++ major modes
Is there a way to specify the same settings for c-mode and c++-mode without repeating the alist?
I have:
((c-mode . ((comment-start . "/* ")
(comment-end . " */")
(comment-...
0
votes
2
answers
58
views
How to make an alist without repeating key/values?
When writing an alist where all the key/value pairs have keys that are variables, is there a convenient way to write this in Elisp without repetition?
eg:
`((foo . ,foo)
(long-variable-name . ,...
1
vote
1
answer
63
views
Append to a list inside an alist for custom find-file behaviour
cc-other-file-alist is part of find-file that looks something like this.
(("\\.cc\\'"
(".hh" ".h"))
("\\.hpp\\'"
(".cpp"))
;; more such entries
)
This is an alist where I'd like to append an ...
0
votes
1
answer
188
views
How to set up personal information alist with defcustom
I would like to have a variable, say my-info that would have an alist attached to it. In normal programming it would look like this:
(setq my-info '((my-name . "Giuseppe Sextus-Packus") (my-email . "...