branch: externals/fontaine commit e3d595f07748e40d05d67c43c2fa3a67a3716ba0 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make fontaine-set-preset always prompt for a preset --- README.org | 14 +++++++++----- fontaine.el | 11 +++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.org b/README.org index ec5580e132..83a8c7b6d7 100644 --- a/README.org +++ b/README.org @@ -144,12 +144,16 @@ in Emacs. [[#h:35bc7f51-6368-4718-ad25-b276a1f2cc08][Shared and implicit fallback values for presets]]. +[ As part of {{{development-version}}}, the ~fontaine-set-preset~ + always prompts for a preset when called interactively, even if there + is only one preset available. This is how all prompts work in Emacs, + so better be consistent with them. ] + #+findex: fontaine-set-preset -The command ~fontaine-set-preset~ applies the desired preset. If there -is only one available, it implements it outright. Otherwise it produces -a minibuffer prompt with completion among the available presets. When -called from Lisp, the ~fontaine-set-preset~ requires a PRESET argument, -such as: +The command ~fontaine-set-preset~ applies the desired preset. If +called interactively, it produces a minibuffer prompt with completion +among the available presets. When called from Lisp, it requires a +=PRESET= argument, such as: #+begin_src emacs-lisp (fontaine-set-preset 'regular) diff --git a/fontaine.el b/fontaine.el index f3d21ec2e0..fadbd2482e 100644 --- a/fontaine.el +++ b/fontaine.el @@ -498,8 +498,8 @@ the command `fontaine-apply-current-preset'.") (defun fontaine-set-preset (preset &optional frame) "Set font configurations specified in PRESET. PRESET is a symbol that represents the car of a list in -`fontaine-presets'. If there is only one available, apply it -outright, else prompt with completion. +`fontaine-presets'. When called interactively, prompt for +PRESET.g Unless optional FRAME argument is supplied, apply the change to all frames. If FRAME satisfies `framep', then make the changes @@ -514,12 +514,7 @@ Set `fontaine-current-preset' to PRESET. Also see the command `fontaine-apply-current-preset'. Call `fontaine-set-preset-hook' as a final step." - (interactive - (list - (if (= (length fontaine-presets) 1) - (caar fontaine-presets) - (fontaine--set-fonts-prompt)) - current-prefix-arg)) + (interactive (list (fontaine--set-fonts-prompt) current-prefix-arg)) (if (and (not (daemonp)) (not window-system)) (user-error "Cannot use this in a terminal emulator; try the Emacs GUI") (fontaine--set-faces preset frame)