Skip to content

Instantly share code, notes, and snippets.

@Dima-369
Created February 24, 2021 19:18
Show Gist options
  • Save Dima-369/03029a0475aaf8cc66d346dc896c88ab to your computer and use it in GitHub Desktop.
Save Dima-369/03029a0475aaf8cc66d346dc896c88ab to your computer and use it in GitHub Desktop.
Use (buffer-file-name) with (intern) to dynamically create and access symbols entirely from strings in Emacs Lisp
(defun get-symbol-for-buffer-file ()
(intern (concat "jump-list-" (buffer-file-name))))
;; (message "%s" (intern "abcd"))
;; (message "%s" (boundp (intern "tab-width")))
(set (get-symbol-for-buffer-file) 369)
(message "%s" (symbol-value (get-symbol-for-buffer-file)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment