Fix wakatime api key void-variable errors

Because the api-key was saved to the elisp cache without quotes, the key
was read like a variable symbol. This is why we can't have nice things.

Reported by @freddian
This commit is contained in:
Henrik Lissner 2018-06-24 23:01:04 +02:00
parent 094735867c
commit 9ca73ee30e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -20,7 +20,7 @@ changes."
(user-error "No api key was received."))
(setq wakatime-api-key api-key)
(with-temp-file +wakatime-api-file
(princ `(setq wakatime-api-key ,api-key)
(prin1 `(setq wakatime-api-key ,wakatime-api-key)
(current-buffer)))
(require 'wakatime-mode)
(global-wakatime-mode +1)))
@ -30,9 +30,8 @@ changes."
"Initialize wakatime (if `wakatime-api-key' is set, otherwise no-op with a
warning)."
(interactive)
(when (and (not (bound-and-true-p wakatime-api-key))
(file-exists-p +wakatime-api-file))
(load +wakatime-api-file nil t))
(unless (bound-and-true-p wakatime-api-key)
(ignore-errors (load +wakatime-api-file t t)))
(if (bound-and-true-p wakatime-api-key)
(global-wakatime-mode +1)
(message "wakatime-mode isn't set up. Run `M-x +wakatime/start' to do so (only necessary once)."))