From: Herbert Euler <herberteuler@hotmail.com>
To: <emacs-devel@gnu.org>
Subject: RE: A suggestion on `x-select-font'
Date: Fri, 27 Jun 2008 16:50:01 +0800 [thread overview]
Message-ID: <BAY143-W8CAFEC0DAB327B1F15F75DAA20@phx.gbl> (raw)
In-Reply-To: <BAY143-W55604B24FAAFA427947B09DAA10@phx.gbl>
[It was sent several days ago but there's no reply. I wrote a patch
today, but am not sure it is the right one.]
The attached patch does what I suggested: It makes the font chooser in
Emacs more like other X appications by setting the user selected font
in the font chooser dialog. There are several problems in it, though:
- Not only the frame font has been reset, but also the frame size.
Perhaps this is because I'm not setting the frame's font in a
right way.
- When the buffer uses a different font than the default one and
when the font dialog is popped, the main frame of Emacs is blank,
whereas it displayed the buffer text before this change.
- Sometimes the font in the font dialog is still not what the user
chooses for a particular buffer. I can't figure out why.
Having the changes in `mouse-appearance-menu' instead of
`x-select-font', the advantage is that the handling of the event (the
way that the buffer in which the event occurred can be found) is
nearer to where it occured. And because `mouse-appearance-menu' is a
Lisp-level function, this way seems more flexible. (All because
`x-select-font' needs to know as little about the event as possible.)
The disadvantage is that the use of expensive `unwind-protect' would
not be necessary if the font is chosen at the C level.
How do you think about this proposal? Thanks.
Regards,
Guanpeng Xu
*** mouse.el.~1.342.~ 2008-06-24 13:37:06.000000000 +0800
--- mouse.el 2008-06-27 16:11:35.000000000 +0800
***************
*** 2527,2537 ****
(choice
;; Either choice == 'x-select-font, or choice is a
;; symbol whose name is a font.
! (buffer-face-mode-invoke (font-face-attributes
! (if (eq choice 'x-select-font)
! (x-select-font)
! (symbol-name choice)))
! t (interactive-p))))))))
\f
;;; Bindings for mouse commands.
--- 2527,2554 ----
(choice
;; Either choice == 'x-select-font, or choice is a
;; symbol whose name is a font.
! (let ((font
! (if (eq choice 'x-select-font)
! (let ((buf (window-buffer
! (posn-window
! (event-start event)))))
! (with-current-buffer buf
! (if (null face-remapping-alist)
! (x-select-font)
! (let ((oldfont (frame-parameter nil 'font))
! (newfont (face-font 'default)))
! (unwind-protect
! (progn
! (modify-frame-parameters
! nil
! `((font . ,newfont)))
! (x-select-font))
! (modify-frame-parameters
! nil
! `((font . ,oldfont))))))))
! (symbol-name choice))))
! (buffer-face-mode-invoke (font-face-attributes font)
! t (interactive-p)))))))))
\f
;;; Bindings for mouse commands.
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
next prev parent reply other threads:[~2008-06-27 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 2:48 A suggestion on `x-select-font' Herbert Euler
2008-06-24 7:27 ` Herbert Euler
2008-06-27 8:50 ` Herbert Euler [this message]
2008-06-27 9:16 ` Jason Rumney
2008-06-27 10:52 ` Herbert Euler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BAY143-W8CAFEC0DAB327B1F15F75DAA20@phx.gbl \
--to=herberteuler@hotmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).