I want to do this.
(let ((myvar "my/variable")
(myval "Some Value"))
(setq myvar myval))
The manual method is:
(setq "my/variable" "Some Value")
Here is the full code: As you can see the values are shown in the messages area but they are not set as variables.
(define-error 'my-own-errors "My Errors")
(define-error 'wrong-arguments "Wrong Arguments" 'my-own-errors)
(define-error 'file-missing "File Missing" 'my-own-errors)
(define-error 'unknown "Unknown Error" 'my-own-errors)
(defun my/map--nested-alist (callback NLIST)
"Call CALLBACK with key value pairs."
(cond ((stringp NLIST)
(unless (file-exists-p NLIST)
(error (signal 'file-missing '(NLIST "was not found.")))))
((not (listp NLIST))
(error (signal 'wrong-arguments '(NLIST "is not a list"))))
((listp NLIST) ; Ideally check the list for (dot . notation)
t)
(t
(error (signal 'unknown '(NLIST "was not found.")))))
(dotimes (x (length NLIST))
(let* ((group (nth x NLIST))
(cl (nth 0 (cdr group))) ; cons or list
(key (car group))
;; if list use nth if cons (foo . bar) use cdr
(val1 (if (consp cl)
(car cl)
(nth 0 cl)))
;; TODO: I could not figure out how to account for cons (dot . notation)
;; for now don’t use a '.' in the file, will look at it later.
(val2 (if (consp cl)
(nth 1 cl)
(cdr cl))))
(funcall callback
`(:key ,key :val1 ,val1 :val2 ,val2)))))
(my/map--nested-alist (lambda (x)
(let* ((key (format "%s" (plist-get x :key)))
(myvar (format "%s" (plist-get x :val1))))
(progn
(message "key is: %s val: %s" key myvar)
(setq key myvar))))
(with-temp-buffer (insert-file-contents "~/.config/emacs/.data/fakefile")
(read (buffer-string))))
Here is the file in ~/.config/emacs/.data/fakefile
(("my/website" ("~/Documents/website" "Website stuff Comment"))
("my/journals" ("~/Documents/journals" nil))
("my/example" ("~/Documents/example" "Example Comment")))
'my/variable
, not"my/variable"
.(let* ((myvar 'my/variable).....