branch: externals/ivy-hydra
commit aa473967bd735d87936851eb4b68b9b84f12e7a8
Author: Nathan Moreau <nathan.mor...@m4x.org>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    counsel.el (counsel-fonts): Preselect the current font
---
 counsel.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/counsel.el b/counsel.el
index a5e9b66..cae8ff7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5379,11 +5379,14 @@ selected color."
 
 You can insert or kill the name of the selected font."
   (interactive)
-  (ivy-read "Font: " (delete-dups (font-family-list))
-            :require-match t
-            :history 'counsel-fonts-history
-            :action #'insert
-            :caller 'counsel-fonts))
+  (let ((current-font
+         (symbol-name (font-get (face-attribute 'default :font) :family))))
+    (ivy-read "Font: " (delete-dups (font-family-list))
+              :preselect current-font
+              :require-match t
+              :history 'counsel-fonts-history
+              :action #'insert
+              :caller 'counsel-fonts)))
 
 ;;** `counsel-kmacro'
 (defvar counsel-kmacro-map

Reply via email to