From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Steven L." Newsgroups: gmane.emacs.help Subject: Re: how to save a face in Lisp? Date: Wed, 03 Oct 2007 00:24:02 -0400 Message-ID: <47031962.7000307@earthlink.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1191385517 2774 80.91.229.12 (3 Oct 2007 04:25:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2007 04:25:17 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 03 06:25:12 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IcvnG-0007kg-GH for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 06:25:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IcvnB-0005Om-UI for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 00:25:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Icvmt-0005OX-05 for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 00:24:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Icvmr-0005O9-83 for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 00:24:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Icvmr-0005O6-46 for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 00:24:41 -0400 Original-Received: from pop-tawny.atl.sa.earthlink.net ([207.69.195.67]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Icvmq-0000ug-UV for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 00:24:41 -0400 Original-Received: from pool-141-154-21-161.bos.east.verizon.net ([141.154.21.161] helo=[127.0.0.1]) by pop-tawny.atl.sa.earthlink.net with esmtp (Exim 3.36 #1) id 1Icvmh-0000Dv-00; Wed, 03 Oct 2007 00:24:31 -0400 User-Agent: Thunderbird 1.5.0.13 (Windows/20070809) Original-Newsgroups: gnu.emacs.help In-Reply-To: X-Detected-Kernel: Solaris 8 (1) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48060 Archived-At: Drew Adams wrote: >>> In Lisp, how can I save a face to the user's custom-file after >>> it has been changed (or to cause it to be saved when Emacs is quit)? >> The function custom-set-faces works for me. > > It requires the face's SPEC also as input: > > "The arguments should be a list where each entry has the form: > (FACE SPEC [NOW [COMMENT]]) > SPEC is stored as the saved value for FACE..." > > I'm looking for something that takes just the face as arg and saves it. IOW, > I don't want to define the face; I just want to save it. You don't have to define the face manually. But you have to write Elisp code to find the current values of the attributes of an existing face, and write those values to a custom-file which can be read back the next time you start Emacs. Example: If you execute the following in a Lisp-Interaction buffer: (describe-face 'default) you will see all the default face's attributes whose *current* values you have to save to a file: :family, :width, :height, :slant, :foreground, :background, etc. A function to inspect each attribute in turn is called 'face-attribute So again, for the default face, you can get each value: (face-attribute 'default :family) (face-attribute 'default :height) (face-attribute 'default :background) And so on. Get the value of each attribute of the face you're interested in, and then write those values to a file and you can read them back in at any time. -- Steven L. Email: sdlitvin@earthlinkNOSPAM.net Remove the NOSPAM before replying to me.