# HG changeset patch # User Chong Yidong # Date 1213127829 0 # Node ID 4542b29082c922fd5fe65f5d9d39fdf32f414bcc # Parent 09e6bd8a641ab06de3d7d4fd6ebb1105098c339d (mouse-select-font): New function. diff -r 09e6bd8a641a -r 4542b29082c9 lisp/mouse.el --- a/lisp/mouse.el Tue Jun 10 19:56:42 2008 +0000 +++ b/lisp/mouse.el Tue Jun 10 19:57:09 2008 +0000 @@ -2425,8 +2425,25 @@ ) "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"))