[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help in querying xlsfonts for a particular font from elisp
From: |
Andrew M. Scott |
Subject: |
Re: Help in querying xlsfonts for a particular font from elisp |
Date: |
Mon, 28 Aug 2006 09:09:01 -0700 |
>>>>> "Peter" == Peter Dyballa <Peter_Dyballa@Web.DE> writes:
Peter> Am 25.08.2006 um 17:41 schrieb Andrew M. Scott:
>> I really like the "vera sans mono" font, but it's only
>> available on some of the platforms I use.
Peter> The fonts are free. You can easily install them everywhere.
Peter> If you can't because of missing privileges, you could think
Peter> of setting up a font server on your local machine (usually
Peter> port 7100). This is just a piece of software and some
Peter> configuration. Since the ssh tunnels are open to X11
Peter> protocol, your remote X clients could use the fonts from
Peter> your font server. When it's running it does not consume
Peter> much resources. The fonts are a few 10 kB, and your font
Peter> server does not need to serve all X11 fonts, just a chosen
Peter> few.
Peter> Instead of complicated Elisp code you could also set up
Peter> ~/.Xdefaults files on your remote computers. Emacs*font and
Peter> other font resources can also name a fontset
Peter> (Emacs*fontSet, Emacs.Fontset-0), one of a few you have set
Peter> up in the .emacs files.
Peter> When you know exactly what each machine offers, you could
Peter> use Emacs invocations (from shell scripts for example)
Peter> where either X resources or fonts or fontsets to use are
Peter> specified.
Peter,
My work/home laptops are often disconnected from a network, so I was
looking for a self-contained solution, though I like your font-server
suggestion! Thank you!!
As background, my desire is to "take my Emacs customizations" with me;
I have a master gnu/linux .emacs and a personal site-lisp area which I
replicate to other gnu/linux and Windows XP machines. The handy
color-theme.el package allows me to take my color scheme with me, and
I was wondering if a few more lines of .emacs elisp could let me
conditionally use my favorite font per platform (that is already
installed by default.)
There appears to be a whole spectrum of where to put "conditionals"
like this. On one side, in the ~/.Xdefaults or ~/.Xresources, either
supported with ancillary scripts or m4 macros, or in a .emacs or
equivalent elisp file. I was trying the elisp route.
Also, one of my motivations for my question is to better understand
(in general) how to call native commands on my gnu/linux system
from elisp and process its return information. For example, my .emacs
currently has some code to customize the grep-command strings for the
platforms which supported it, based on a "grep --version" query:
--- .emacs snippet (It works, even if not pretty) ----
;; AMS: I prefer M-x grep ignoring case; otherwise default is "grep -n -e "
;; AMS: If grep 2.5 is available, ignore GNUS files prefixed with .newsrc,
;; because it is slow to parse with font-lock mode enabled.
;; Futures:
;; 1. Is there a way to do this that is directory-specific, like the
;; .cvsignore command. Maybe a combination of skip_directories and
;; excludes?
;; 2. GREP_OPTIONS breaks older grep's, so probably it's a portability
;; barrier, e.g. leave it out of my .tcshrc
;; 3. Better: set GREP_OPTIONS conditionally (upon grep >= v2.5) in
;; .tcshrc, e.g. setenv GREP_OPTIONS "-nH -i --color=always
;; --exclude='\.newsrc.*'"
;; setenv GREP_COLOR red (red is the default)
(defvar my-grep-version nil
"*Version of grep that is foremost in my exec-path.")
;; nth split-string idea courtesy of Thien-Thi Nguyen <ttn@glug.org>
;; AMS: Discern best available grep for WinXP, Unix
(setq my-grep-version
(nth 3 (split-string (shell-command-to-string
(concat
(or (executable-find "ggrep")
(executable-find "grep"))
" --version")
))))
;; Courtesy of Kevin Rodgers <ihs_4664@yahoo.com>
;; (setq my-grep-version
;; (shell-command-to-string "grep --version | awk '{printf(\"%s\", $NF);
exit}'"))
(if (string-lessp "2.5" my-grep-version)
(progn
;; GNU grep 2.5+
;; (setq grep-command "grep -nH -i --color=always --exclude='\.newsrc.*'
")
(setq grep-command (concat
(or (executable-find "ggrep")
(executable-find "grep"))
" -nH -i --exclude='\.newsrc.*'
--exclude='.fonts.cache-1' ")))
;; GNU grep 2.4 or earlier
(setq grep-command (concat
(or (executable-find "ggrep")
(executable-find "grep"))
" -nH -i ")))
Andy Scott