]> git.eshelyaron.com Git - emacs.git/commitdiff
(mouse-select-font): New function.
authorChong Yidong <cyd@stupidchicken.com>
Tue, 10 Jun 2008 19:57:09 +0000 (19:57 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Tue, 10 Jun 2008 19:57:09 +0000 (19:57 +0000)
lisp/mouse.el

index 63bb5b9051ca27dca61606a334f53a44e03555d0..8565e62edfe66a12f2d0dec4d6ce9c3fd6bece73 100644 (file)
@@ -2425,8 +2425,25 @@ and selects that window."
     )
   "X fonts suitable for use in Emacs.")
 
+(defun mouse-select-font ()
+  "Prompt for a font name, using `x-popup-menu', and return it."
+  (interactive)
+  (unless (display-multi-font-p)
+    (error "Cannot change fonts on this display"))
+  (x-popup-menu
+   (if (listp last-nonmenu-event)
+       last-nonmenu-event
+     (list '(0 0) (selected-window)))
+   (append x-fixed-font-alist
+          (list (generate-fontset-menu)))))
+
 (defun mouse-set-font (&rest fonts)
-  "Select an Emacs font from a list of known good fonts and fontsets."
+  "Set the default font for the selected frame.
+The argument FONTS is a list of font names; the first valid font
+in this list is used.
+
+When called interactively, pop up a menu and allow the user to
+choose a font."
   (interactive
    (progn (unless (display-multi-font-p)
            (error "Cannot change fonts on this display"))