From: Thomas Ingram <taingram@mtu.edu>
To: help-gnu-emacs@gnu.org
Subject: Elisp newbie string to symbol help
Date: Thu, 7 Mar 2019 11:36:57 -0500 [thread overview]
Message-ID: <0b0ec3c9-dfb5-fc9a-df6b-d5debc786b5d@mtu.edu> (raw)
I'm looking for some help with a simple function I am trying to write.
I'm a long time Emacs user but I have little experience with Emacs lisp.
The issue I am having is with the load-theme lines.
(defun my/theme-toggle ()
"Toggle between light to dark theme."
(interactive)
(require 'custom)
(let* ((current-theme (symbol-name (car custom-enabled-themes)))
(theme (substring current-theme 0
(- (length current-theme)
; Probably a better way to do this with regex?
(if (string-suffix-p "dark" current-theme)
(length "-dark")
(length "-light"))))))
(if (string-suffix-p "dark" current-theme)
(load-theme (concat theme "-light"))
(load-theme (concat theme "-dark"))))
;; (spaceline-emacs-theme)
(start-process "toggle Gtk theme" nil "~/bin/change-theme" "toggle"))
I get the message "load-theme: Invalid theme name ‘spacemacs-dark’"
which doesn't make sense as that is a theme I have installed. I've
tried quoting those lines but then it doesn't evaluate. How can I
properly pass this concatenated string to load-theme?
I vaguely understand that it is expecting a symbol not a string and I've
tried passing the string to make-symbol but that just changed the error
to "Undefined Custom theme spacemacs-dark"
Any help is appreciated.
Thanks,
Thomas Ingram
next reply other threads:[~2019-03-07 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 16:36 Thomas Ingram [this message]
2019-03-07 17:08 ` Elisp newbie string to symbol help Michael Heerdegen
2019-03-07 17:22 ` Thomas Ingram
2019-03-08 5:40 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b0ec3c9-dfb5-fc9a-df6b-d5debc786b5d@mtu.edu \
--to=taingram@mtu.edu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.