mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
@ -57,20 +57,19 @@ If PREFIX is nil, will prompt whether or not to download. NAME is informational
|
||||
only. URL-FORMAT is a format string that should be a url and have a single %s,
|
||||
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
|
||||
(unless (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, continue?"
|
||||
name)))
|
||||
(user-error "Aborted"))
|
||||
(let* ((font-dest
|
||||
(pcase window-system
|
||||
(`x
|
||||
(cond (IS-LINUX
|
||||
(expand-file-name
|
||||
"fonts/" (or (getenv "XDG_DATA_HOME")
|
||||
"~/.local/share")))
|
||||
((or `mac `ns)
|
||||
(IS-MAC
|
||||
(expand-file-name "~/Library/Fonts/"))))
|
||||
(known-dest? (stringp font-dest))
|
||||
(known-dest-p (stringp font-dest))
|
||||
(font-dest (or font-dest (read-directory-name "Font installation directory: " "~/"))))
|
||||
(unless (file-directory-p font-dest)
|
||||
(mkdir font-dest t))
|
||||
@ -78,11 +77,11 @@ filename of each font. It is used as the source and destination filename."
|
||||
(url-copy-file (format url-format font)
|
||||
(expand-file-name font font-dest)
|
||||
t))
|
||||
(when known-dest?
|
||||
(when known-dest-p
|
||||
(message "Font downloaded, updating font cache... <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")
|
||||
(if known-dest-p "installed" "downloaded")
|
||||
name font-dest)))
|
||||
|
||||
;;;###autoload
|
||||
@ -95,5 +94,5 @@ When PREFIX is non-nil, ignore the prompt and just install it."
|
||||
(mapcar #'car +pretty-code-font-alist))))
|
||||
(if-let (font-files (cdr (assoc font-name +pretty-code-font-alist)))
|
||||
(cl-destructuring-bind (&key url files) font-files
|
||||
(+pretty-code--install-font prefix font-name url font-files))
|
||||
(+pretty-code--install-font prefix font-name url files))
|
||||
(user-error "%S is not a valid font")))
|
||||
|
Reference in New Issue
Block a user