Re: defcustom manipulation
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <Cny1thP-uLfLsEzp7R-JTAfB-IO4VagvH2yyUnRRGh9urm5VgDPzhEkxxa1z4cCAhYGeOfc3Dr-ASiR7sYInmsyYlALZWXiqbQYYKaeP3ig=@protonmail.com> |
On Friday, August 21st, 2026 at 6:56 AM, [email protected] <[email protected]> wrote: > Heime <[email protected]> writes: > > > Could I include a let binding to use a variable to store the value of > > (assoc-default 'GLXKS orellana-fpln)? > > > > What should I put in the function galaxiakos-fpln-update? > > This defcustom variable sets an alist of elements (key . dir) > > > > (defcustom galaxiakos-fpln > > `((GLXKS . ,(assoc-default 'GLXKS orellana-fpln)) > > (OMNIX . ,(concat (assoc-default 'GLXKS orellana-fpln) "/omniskon")) > > (PROTL . ,(concat(assoc-default 'GLXKS orellana-fpln) "/protilus")) > > (GRGRS . ,(concat (assoc-default 'GLXKS orellana-fpln) "/gregers"))) > > "Association List (alist) specifying a flight plan, where each element is > > a cons cell (WAYPT . DIRECTORY-PATH) linking a waypoint code to its > > associated directory path for different Galaxiakos components." > > :group 'galaxiakos > > :type '(alist :key-type (symbol :tag "Code") > > :value-type (string :tag "Path")) > > :set #'galaxiakos-fpln-update) > > > > 1. Because the definition of ‘defcustom’ says: > > ":set VALUE should be a function to set the value of the symbol > when using the Customize user interface. It takes > two arguments, the symbol to set and the value to > give it. The function should not modify its value > argument destructively." Is the symbol the one that the defcustom is named? My defcustom symbol is an alist, does supplying a value mean one for the entire alist. I want to modify or add just a single element of the alist (key . value) entry, not the entire thing every time. > your function ‘galaxiakos-fpln-update’ must take the > form: > > (defun galaxiakos-fpln-update (option-name new-value) > ... > ) > > 2. You could create a simply function to test your function: > > (defun set-my-option (new-value) > "Update the ‘galaxiakos-fpln’ option with NEW-VALUE." > (galaxiakos-fpln-update 'galaxiakos-fpln new-value) > galaxiakos-fpln) > > 3. Call ‘set-my-option’ with various (constant) values and > see which result is returned (the result is the updated > value of your user option ‘galaxiakos-fpln’). > > (set-my-option <some new value>) > > Using that new function, you could post questions to this > mailing list showing: > > a. the expression that calls ‘set-my-option’ > b. the result that you expected > c. the actual result of that call > > With that information, readers might be able to suggest how > to resolve any differences between what you expected and what > you got. > > Once all of the problems are resolved, you should then be > able to use M-: (setopt ...) or M-x customize-option to > update the value of ‘galaxiakos-fpln’. > > -- > The lyf so short, the craft so long to lerne. > - Geoffrey Chaucer, The Parliament of Birds. >