Fix permission-error on +pretty-code/install-patched-font #2807

This commit is contained in:
Henrik Lissner 2020-04-02 05:10:42 -04:00
parent 74f64c63f0
commit a8f34f0f81
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -59,15 +59,15 @@ which is expanded for each font in FONTS-ALIST. FONTS-ALIST should be the
filename of each font. It is used as the source and destination filename."
(or prefix
(yes-or-no-p
(format "This will download and install the %s fonts, are you
sure you want to do this?" name))
(format "This will download and install the %s fonts, are you sure you want to do this?"
name))
(user-error "Aborted"))
(let* ((font-dest
(pcase window-system
(`x
(expand-file-name
"/fonts/" (or (getenv "XDG_DATA_HOME")
(concat (getenv "HOME") "/.local/share"))))
"fonts/" (or (getenv "XDG_DATA_HOME")
"~/.local/share")))
((or `mac `ns)
(expand-file-name "~/Library/Fonts/"))))
(known-dest? (stringp font-dest))
@ -80,11 +80,10 @@ sure you want to do this?" name))
t))
(when known-dest?
(message "Font downloaded, updating font cache... <fc-cache -f -v> ")
(shell-command-to-string (format "fc-cache -f -v")))
(shell-command-to-string "fc-cache -f -v"))
(message "Successfully %s `%s' fonts to `%s'!%s"
(if known-dest? "installed" "downloaded")
name
font-dest)))
name font-dest)))
;;;###autoload
(defun +pretty-code/install-patched-font (font-name &optional prefix)