changeset 1137:c6facab13185

[xemacs-hg @ 2002-12-03 10:35:06 by didierv] new function `set-face-background-pixmap-file'
author didierv
date Tue, 03 Dec 2002 10:35:17 +0000
parents 14f3ffacd8be
children 05ed51332340
files lisp/ChangeLog lisp/faces.el man/ChangeLog man/lispref/faces.texi man/lispref/glyphs.texi man/xemacs/custom.texi
diffstat 6 files changed, 120 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Dec 02 22:53:28 2002 +0000
+++ b/lisp/ChangeLog	Tue Dec 03 10:35:17 2002 +0000
@@ -1,3 +1,8 @@
+2002-12-03  Didier Verna  <didier@xemacs.org>
+
+	* faces.el (background-pixmap-file-history): New.
+	* faces.el (set-face-background-pixmap-file): New.
+
 2002-11-28  Mike Sperber <mike@xemacs.org>
 
 	* window.el (save-window-excursion): New macro to eventually
@@ -23,13 +28,13 @@
 2002-11-27  Ben Wing  <ben@xemacs.org>
 
 	* cl-macs.el (loop): Document better.
-	
+
 	* cmdloop.el:
 	* cmdloop.el (command-error):
 	* cmdloop.el (breakpoint-on-error): Removed.
 	Remove nonworking breakpoint-on-error now that debug-on-error
 	works as documented.
-	
+
 	* help.el:
 	* help.el (temp-buffer-mode): New.
 	* help.el (Commands): New.
@@ -44,7 +49,7 @@
 	* lib-complete.el (find-library-source-path):
 	* lib-complete.el (find-library):
 	Support thunks in find-library-source-path.
-	
+
 	* startup.el (normal-top-level):
 	Don't catch errors when noninteractive, because that makes
 	stack traces from stack-trace-on-error useless.
@@ -73,7 +78,7 @@
 
 	* font-menu.el (font-menu-set-font): Make sure values for family,
 	size, and weight are defaulted non-nil.  Fix indentation.
-	(font-menu-size-scaling): 
+	(font-menu-size-scaling):
 	(font-menu-preferred-resolution):
 	Provide specs for GTK+.
 
@@ -281,7 +286,7 @@
 
 2002-07-21  John Paul Wallington  <jpw@xemacs.org>
 
-	* process.el (substitute-env-vars): New function; sync with 
+	* process.el (substitute-env-vars): New function; sync with
 	GNU Emacs 21.1.50.
 	(setenv): Add optional arg SUBSTITUTE-ENV-VARS; sync with
 	GNU Emacs 21.1.50.
--- a/lisp/faces.el	Mon Dec 02 22:53:28 2002 +0000
+++ b/lisp/faces.el	Tue Dec 03 10:35:17 2002 +0000
@@ -234,7 +234,7 @@
 	(setq value (if (or (charsetp matchspec)
 			    (and (symbolp matchspec)
 				 (find-charset matchspec)))
-			(or 
+			(or
 			 (specifier-matching-instance
 			  value (cons matchspec nil) domain default
 			  no-fallback)
@@ -625,6 +625,25 @@
   (interactive (face-interactive "background-pixmap"))
   (set-face-property face 'background-pixmap pixmap locale tag-set how-to-add))
 
+(defvar background-pixmap-file-history nil
+  ;; History for `set-face-background-pixmap-file'
+  )
+
+(defun set-face-background-pixmap-file (face file)
+  "Read (and set) the background pixmap of FACE from FILE.
+This function is a simplified version of `set-face-background-pixmap',
+designed for interactive use."
+  (interactive
+   (let* ((face (read-face-name "Set background pixmap of face: "))
+	  (file (read-file-name
+		 (format "Set background pixmap of face %s to: "
+			 (symbol-name face))
+		 nil (image-instance-file-name
+		      (face-background-pixmap-instance face)) t nil
+		      'background-pixmap-file-history)))
+     (list face (if (equal file "") nil file))))
+  (set-face-property face 'background-pixmap file))
+
 (defun face-display-table (face &optional locale tag-set exact-p)
   "Return the display table of FACE in LOCALE.
 
@@ -1136,7 +1155,7 @@
          behavior -- changes to the global value, to other locales, won't
          affect this locale, (b) the face will actually look bold in
          the locale.
-STAGE 3: (if called for) 
+STAGE 3: (if called for)
 
 The way the frobbing works depends on the device type -- first on whether
 or not it's TTY, and second, if it's a window-system device type, on which
@@ -1295,7 +1314,7 @@
 
 ;; Size frobbing
 ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com>
-;; Jan had a separate helper function 
+;; Jan had a separate helper function
 (defun make-face-size (face size &optional locale tags exact-p)
   "Adjust FACE to SIZE in LOCALE, if possible."
   (interactive (list (read-face-name "Set size of which face: ")
--- a/man/ChangeLog	Mon Dec 02 22:53:28 2002 +0000
+++ b/man/ChangeLog	Tue Dec 03 10:35:17 2002 +0000
@@ -1,3 +1,13 @@
+2002-12-03  Didier Verna  <didier@xemacs.org>
+
+	* xemacs/custom.texi (Faces): document
+	`set-face-background-pixmap-file'.
+
+2002-12-03  Didier Verna  <didier@xemacs.org>
+
+	* lispref/faces.texi (Face Convenience Functions): ditto.
+	* lispref/glyphs.texi (Creating Glyphs): reference it.
+
 2002-11-29  Stephen Turnbull  <stephen@xemacs.org>
 
 	* lispref/specifiers.texi (Simple Specifier Usage): New node.
@@ -72,11 +82,11 @@
 	how to skip and warn about tests that depend on packages.
 
 2002-08-16  Stephen J. Turnbull  <stephen@xemacs.org>
- 
+
 	* internals/internals.texi (Regression Testing XEmacs): Fix typo.
 
 2002-08-15  Stephen J. Turnbull  <stephen@xemacs.org>
- 
+
 	* internals/internals.texi (GCPROing): Add comment on GCPRO.
 	(Regression Testing XEmacs): New node.
 	(Modules for Regression Testing): New node.
@@ -198,7 +208,7 @@
 	* lispref/glyphs.texi:
 	lispref/lispref.texi: Add examples of how to insert graphics into a
 	buffer.
-	
+
 2001-12-17  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* xemacs/packages.texi (Packages):
@@ -225,7 +235,7 @@
 2001-11-27  Adrian Aichner  <adrian@xemacs.org>
 
 	* xemacs-faq.texi: Hyperlink fixes.
-	
+
 2002-02-04  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* xemacs-faq.texi (Q4.7.7): New FAQ on remote files.
@@ -258,7 +268,7 @@
 	* xemacs/packages.texi (Automatically): Don't mention "Options"
 	menu.
 	(Installing Packages): Don't mention getting list of packages via
-	customize. 
+	customize.
 
 2002-04-05  Stephen J. Turnbull  <stephen@xemacs.org>
 
@@ -294,7 +304,7 @@
 
 	* emodules.texi (Using DEFUN): Add @ref{Lisp Primitives}.
 
-	* lispref/mule.texi (Unicode Support): 
+	* lispref/mule.texi (Unicode Support):
 	* xemacs/custom.texi (Behaviors):
 	* lispref/customize.texi (Enabling Behavior):
 	New nodes.
@@ -384,7 +394,7 @@
 	* glyphs.texi:
 	lispref.texi: Add examples of how to insert graphics into a
 	buffer.
-	
+
 2002-01-02  Adrian Aichner  <adrian@xemacs.org>
 
 	* emodules.texi: Add missing direntry, reword "dynamic loadable"
@@ -430,7 +440,7 @@
 	* lispref/intro.texi (Introduction): Next -> Packaging.
 	* lispref/objects.texi (Lisp Data Types): Previous -> Packaging.
 	* Makefile (lispref-srcs): Depend on lispref/packaging.texi.
-	
+
 2001-11-26  Adrian Aichner  <adrian@xemacs.org>
 
 	* xemacs-faq.texi (Top): Remove duplicate node "Introduction".
@@ -586,7 +596,7 @@
 	* xemacs-faq.texi (Q2.1.18):
 	* xemacs-faq.texi (Q2.1.19):
 	document how to debug X errors
-	
+
 2001-05-15  Steve Youngs  <youngs@xemacs.org>
 
 	* xemacs/packages.texi (Local.rules): Update to reflect new dir tree.
@@ -826,7 +836,7 @@
 	* standards.texi (References):
 	* standards.texi (Index):
 	Update to latest GNU version.
-	
+
 	* xemacs-faq.texi (Q6.3.3):
 	* xemacs-faq.texi (Q6.4.1):
 	Improve questions on current Windows activity.
@@ -927,13 +937,13 @@
 	location.  Update information about the MS Windows port.  Change
 	description of XEmacs at beginning to match the web site.  Update
 	info about current developers.
-	
+
 
 2001-02-25  Ben Wing  <ben@xemacs.org>
 
 	* lispref\help.texi (Describing Characters):
 	kp- not kp_.
-	
+
 2001-02-25  Ben Wing  <ben@xemacs.org>
 
 	* new-users-guide\custom1.texi (Customization Basics):
@@ -947,7 +957,7 @@
 	* new-users-guide\modes.texi (Minor Modes):
 	* new-users-guide\new-users-guide.texi (Top):
 	Fix up references to .emacs to take into account init.el.
-	
+
 2001-02-23  Martin Buchholz <martin@xemacs.org>
 
 	* XEmacs 21.2.45 "Thelxepeia" is released.
--- a/man/lispref/faces.texi	Mon Dec 02 22:53:28 2002 +0000
+++ b/man/lispref/faces.texi	Tue Dec 03 10:35:17 2002 +0000
@@ -375,6 +375,12 @@
 string, containing the raw bits of the bitmap.
 @end deffn
 
+@deffn Command set-face-background-pixmap-file face file
+This function sets the background pixmap of face @var{face} to the image
+contained in @var{file}. This is just a simplified version of
+@code{set-face-background-pixmap} which provides filename completion.
+@end deffn
+
 @deffn Command set-face-font face font &optional locale tag-set how-to-add
 This function sets the font of face @var{face}.  The argument @var{font}
 should be a string or a font object as returned by @code{make-font}
--- a/man/lispref/glyphs.texi	Mon Dec 02 22:53:28 2002 +0000
+++ b/man/lispref/glyphs.texi	Tue Dec 03 10:35:17 2002 +0000
@@ -226,13 +226,14 @@
 To use a glyph as the background pixmap of a face: Note that the
 background pixmap of a face is actually an image specifier -- probably
 the only place in XEmacs where an image specifier occurs outside of a
-glyph.  Similarly to how the glyph's image specifier works, you don't
+glyph. Similarly to how the glyph's image specifier works, you don't
 create your own image specifier, but rather add specifications to the
-existing one (using @code{set-face-background-pixmap}).  Note that the
-image instance that is generated in order to actually display the
-background pixmap is of type @code{mono-pixmap}, meaning that it's a
-two-color image and the foreground and background of the image get
-filled in with the corresponding colors from the face.
+existing one (using @code{set-face-background-pixmap-file} or
+@code{set-face-background-pixmap}). Note that the image instance that is
+generated in order to actually display the background pixmap is of type
+@code{mono-pixmap}, meaning that it's a two-color image and the
+foreground and background of the image get filled in with the
+corresponding colors from the face.
 @end itemize
 
 It is extremely rare that you will ever have to specify a value for
@@ -1454,7 +1455,7 @@
 ;; current buffer.  Any existing glyph at this location is replaced.
 (defun insert-glyph (gl)
   "Insert a glyph at the left edge of point."
-  (let ( (prop 'myimage)        ;; myimage is an arbitrary name, chosen 
+  (let ( (prop 'myimage)        ;; myimage is an arbitrary name, chosen
                                 ;; to (hopefully) not conflict with any
                                 ;; other properties.  Change it if
                                 ;; necessary.
--- a/man/xemacs/custom.texi	Mon Dec 02 22:53:28 2002 +0000
+++ b/man/xemacs/custom.texi	Tue Dec 03 10:35:17 2002 +0000
@@ -492,9 +492,9 @@
             [ ] Foreground: white       (sample)
             [ ] Background: blue        (sample)
             [ ] Inverse: [Toggle]  off (nil)
-            [ ] Stipple: 
-            [ ] Font Family: 
-            [ ] Size: 
+            [ ] Stipple:
+            [ ] Font Family:
+            [ ] Size:
             [ ] Strikethru: off
 @end smallexample
 
@@ -509,7 +509,7 @@
 @c background are @samp{black}, @samp{white}, @samp{gray}, @samp{gray1},
 @c and @samp{gray3}.  Emacs supports these shades of gray by using
 @c background stipple patterns instead of a color.
-@c 
+@c
   Setting, saving and resetting a face work like the same operations for
 options (@pxref{Changing an Option}).
 
@@ -545,7 +545,7 @@
 @item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
 Set up a customization buffer with all the options, faces and groups
 that match @var{regexp}.
-@item M-x customize-saved 
+@item M-x customize-saved
 Set up a customization buffer containing all options and faces that you
 have saved with customization buffers.
 @item M-x customize-customized
@@ -776,7 +776,7 @@
 enough like Lisp for Lisp mode to be useful but in which comments
 start and end differently.  The prefix and suffix are used in the local
 variables list to make the list look like several lines of comments when
-the compiler or interpreter for that language reads the file. 
+the compiler or interpreter for that language reads the file.
 
   The start of the local variables list must be no more than 3000
 characters from the end of the file, and must be in the last page if the
@@ -888,7 +888,7 @@
 executed, but also becomes part of the definition of the macro.  @samp{Def}
 appears in the mode line to remind you of what is going on.  When you are
 finished, the @kbd{C-x )} command (@code{end-kbd-macro}) terminates the
-definition, without becoming part of it. 
+definition, without becoming part of it.
 
   For example,
 
@@ -1134,9 +1134,9 @@
 local map, which affects all buffers using the same major mode.
 
 @menu
-* Interactive Rebinding::      Changing Key Bindings Interactively   
+* Interactive Rebinding::      Changing Key Bindings Interactively
 * Programmatic Rebinding::     Changing Key Bindings Programmatically
-* Key Bindings Using Strings:: Using Strings for Changing Key Bindings 
+* Key Bindings Using Strings:: Using Strings for Changing Key Bindings
 @end menu
 
 @node Interactive Rebinding
@@ -1148,7 +1148,7 @@
 @table @kbd
 @item M-x global-set-key @key{RET} @var{key} @var{cmd} @key{RET}
 Defines @var{key} globally to run @var{cmd}.
-@item M-x local-set-key @key{RET} @var{keys} @var{cmd} @key{RET} 
+@item M-x local-set-key @key{RET} @var{keys} @var{cmd} @key{RET}
 Defines @var{key} locally (in the major mode now in effect) to run
 @var{cmd}.
 @item M-x local-unset-key @key{RET} @var{keys} @key{RET}
@@ -1217,7 +1217,7 @@
 @item @code{(define-key @var{keymap} @var{keys} @var{def})}
 Defines @var{keys} to run @var{def} in the keymap @var{keymap}.
 @end table
- 
+
 @var{keymap} is a keymap object.
 
 @var{keys} is the sequence of keystrokes to bind.
@@ -1251,7 +1251,7 @@
 @xref{Keystrokes}, for more information about the rules for constructing
 key sequences.
 
-Emacs allows you to abbreviate representations for key sequences in 
+Emacs allows you to abbreviate representations for key sequences in
 most places where there is no ambiguity.
 Here are some rules for abbreviation:
 
@@ -1273,13 +1273,13 @@
 @example
 
 ;;;  Bind @code{my-command} to @key{f1}
-(global-set-key 'f1 'my-command)                
+(global-set-key 'f1 'my-command)
 
 ;;;  Bind @code{my-command} to @kbd{Shift-f1}
 (global-set-key '(shift f1) 'my-command)
 
 ;;; Bind @code{my-command} to @kbd{C-c Shift-f1}
-(global-set-key '[(control c) (shift f1)] 'my-command)  
+(global-set-key '[(control c) (shift f1)] 'my-command)
 
 ;;; Bind @code{my-command} to the middle mouse button.
 (global-set-key 'button2 'my-command)
@@ -1296,13 +1296,13 @@
 @comment (global-set-key '(meta control backspace) 'my-command)
 @comment (global-set-key '(meta control h) 'my-command)
 @comment (global-set-key '(meta control H) 'my-command)
-@comment 
+@comment
 @comment ;; note that this binds two key sequences: ``control-j'' and ``linefeed''.
 @comment ;;
 @comment (global-set-key "\^J" 'my-command)
 
 @node Key Bindings Using Strings
-@subsubsection Using Strings for Changing Key Bindings 
+@subsubsection Using Strings for Changing Key Bindings
 
   For backward compatibility, you can still use strings to represent
 key sequences.  Thus you can use commands like the following:
@@ -1313,7 +1313,7 @@
 @end example
 
 Note, however, that in some cases you may be binding more than one
-key sequence by using a single command.  This situation can 
+key sequence by using a single command.  This situation can
 arise because in ASCII, @kbd{C-i} and @key{TAB} have
 the same representation.  Therefore, when Emacs sees:
 
@@ -1347,11 +1347,11 @@
 similar fashion:
 
 @example
-        control h      backspace           
+        control h      backspace
         control l      clear
-        control i      tab 
-        control m      return              
-        control j      linefeed 
+        control i      tab
+        control m      return
+        control j      linefeed
         control [      escape
         control @@      control space
 @end example
@@ -1883,7 +1883,7 @@
 standard beep.  This only works if you are logged in on the console of a
 machine with audio hardware. To listen to a sound of the provided type,
 call the function @code{play-sound} with the argument @var{sound}. You
-can also set the volume of the sound with the optional argument 
+can also set the volume of the sound with the optional argument
 @var{volume}.@refill
 @cindex ding
 
@@ -1893,7 +1893,7 @@
 
 @table @code
 @item sound
-A string of raw sound data, or the name of another sound to play.   
+A string of raw sound data, or the name of another sound to play.
 The symbol @code{t} here means use the default X beep.
 
 @item volume
@@ -1930,7 +1930,7 @@
 This variable applies to the standard X bell sound as well as sound files.
 
 If the symbol @code{t} is in place of a sound-string, Emacs uses the
-default X beep.  This allows you to define beep-types of 
+default X beep.  This allows you to define beep-types of
 different volumes even when not running on the console.
 
 @findex load-sound-file
@@ -1970,7 +1970,7 @@
 @item y-or-n-p
 You type something other than the required @code{y} or @code{n}
 
-@item yes-or-no-p       
+@item yes-or-no-p
 You type something other than @code{yes} or @code{no}
 @end table
 
@@ -2002,13 +2002,13 @@
 Make the font of the given @var{face} bold.  When called from a
 program, returns @code{nil} if this is not possible.
 @item M-x make-face-bold-italic
-Make the font of the given @var{face} bold italic.  
+Make the font of the given @var{face} bold italic.
 When called from a program, returns @code{nil} if not possible.
 @item M-x make-face-italic
-Make the font of the given @var{face} italic.  
+Make the font of the given @var{face} italic.
 When called from a program, returns @code{nil} if not possible.
 @item M-x make-face-unbold
-Make the font of the given @var{face} non-bold.  
+Make the font of the given @var{face} non-bold.
 When called from a program, returns @code{nil} if not possible.
 @item M-x make-face-unitalic
 Make the font of the given @var{face} non-italic.
@@ -2019,11 +2019,13 @@
 @item M-x make-face-smaller
 Make the font of the given @var{face} a little smaller.
 When called from a program, returns @code{nil} if not possible.
-@item M-x set-face-background 
+@item M-x set-face-background
 Change the background color of the given @var{face}.
 @item M-x set-face-background-pixmap
 Change the background pixmap of the given @var{face}.
-@item M-x set-face-font 
+@item M-x set-face-background-pixmap-file
+A simpler version but with filename completion.
+@item M-x set-face-font
 Change the font of the given @var{face}.
 @item M-x set-face-foreground
 Change the foreground color of the given @var{face}.
@@ -2044,7 +2046,7 @@
 @var{face} with the function @code{invert-face}. If the face does not
 specify both foreground and background, then its foreground and
 background are set to the background and foreground of the default face.
-When calling this from a program, you can supply the optional argument 
+When calling this from a program, you can supply the optional argument
 @var{frame} to specify which frame is affected; otherwise, all frames
 are affected.
 
@@ -2052,7 +2054,7 @@
 You can set the background color of the specified @var{face} with the
 function @code{set-face-background}.  The argument @code{color} should
 be a string, the name of a color.  When called from a program, if the
-optional @var{frame} argument is provided, the face is changed only 
+optional @var{frame} argument is provided, the face is changed only
 in that frame; otherwise, it is changed in all frames.
 
 @findex set-face-background-pixmap
@@ -2074,14 +2076,21 @@
 If the environment variable @b{XBMLANGPATH} is set, then it is consulted
 before the @code{x-bitmap-file-path} variable.
 
+@findex set-face-background-pixmap
+Alternately, you can use a simpler version of
+@code{set-face-background-pixmap} called
+@code{set-face-background-pixmap-file}. This function does not give you
+as much control on the pixmap instanciator, but provides filename
+completion.
+
 @findex set-face-font
 You can set the font of the specified @var{face} with the function
 @code{set-face-font}.  The @var{font} argument should be a string, the
 name of a font.  When called from a program, if the
-optional @var{frame} argument is provided, the face is changed only 
+optional @var{frame} argument is provided, the face is changed only
 in that frame; otherwise, it is changed in all frames.
 
-@findex set-face-foreground 
+@findex set-face-foreground
 You can set the foreground color of the specified @var{face} with the
 function @code{set-face-foreground}.  The argument @var{color} should be
 a string, the name of a color.  If the optional @var{frame} argument is
@@ -2124,8 +2133,8 @@
 
 The examples in this section assume the application class is @samp{Emacs}.
 
-The Emacs resources are generally set per-frame. Each Emacs frame can have 
-its own name or the same name as another, depending on the name passed to the 
+The Emacs resources are generally set per-frame. Each Emacs frame can have
+its own name or the same name as another, depending on the name passed to the
 @code{make-frame} function.
 
 You can specify resources for all frames with the syntax:
@@ -2230,7 +2239,7 @@
 from the geometry of the frame.
 
 @item
-For subsequent frames, the position is taken only from the frame, and 
+For subsequent frames, the position is taken only from the frame, and
 never from the ApplicationShell.
 @end itemize
 
@@ -2261,7 +2270,7 @@
 Whether this frame should appear in the iconified state.
 
 @item @code{internalBorderWidth} (class @code{InternalBorderWidth}): int
-How many blank pixels to leave between the text and the edge of the 
+How many blank pixels to leave between the text and the edge of the
 window.
 
 @item @code{interline} (class @code{Interline}): int
@@ -2459,7 +2468,7 @@
 
 @item zmacs-region
 This is the face that mouse selections are displayed in.
- 
+
 @item isearch
 This is the face that the matched text being searched for is displayed
 in.
@@ -2541,7 +2550,7 @@
 Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
 @end example
 
-If both the Lucid Motif-lookalike menu widgets and X Font Sets are 
+If both the Lucid Motif-lookalike menu widgets and X Font Sets are
 configured to allow multilingual menubars, then one uses
 
 @example
@@ -2555,7 +2564,7 @@
 resources (eg, menubars) are ignored in favor of the corresponding
 .fontSet resources.
 
-If the Motif library is being used, then one would have to use 
+If the Motif library is being used, then one would have to use
 
 @example
 Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
@@ -2564,5 +2573,5 @@
 because the Motif library uses the @code{fontList} resource name instead
 of @code{font}, which has subtly different semantics.
 
-The same is true of the scrollbars: They accept whichever resources are 
+The same is true of the scrollbars: They accept whichever resources are
 appropriate for the toolkit in use.