I want to define a bundle of variable-and-function pairs, e.g.:
vl/path-doc points to my often used path, and
vl/open-path-doc is used for open it in
I tried this piece of code:
(setq vivo-work-directory "~/Workspace/vivo/") (defvar vl/paths '((aktualoj . "doc/aktualoj/") (doc . "doc/") (analysis . "analysis/") (lernejo . "lernejo/") (utils . "utils/") (topics . "vivo/topics/") (projects . "vivo/projects/"))) (defun vl/create-path-funcs (p-list) (mapc (lambda (x) (let* ((s (car x)) (p (concat vivo-work-directory (cdr x))) (sym-p (make-symbol (concat "vl/path-" (symbol-name s)))) (sym-f (make-symbol (concat "vl/open-path-" (symbol-name s))))) (progn (set sym-p p) (set sym-f (lambda () (interactive) (dired p)))) )) p-list)) (vl/create-path-funcs vl/paths)
Then, I hope I can use
M-x to invoke
vl/open-path-doc, etc. But I failed.
Of course, I can define these pairs one by one. But if it's OK, I can change my
vl/paths without re-defining anything else. So, if possible, how to define the pairs of variable-and-function based on a list?