emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110969: Add optional "inherit" argum


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110969: Add optional "inherit" argument for face-bold-p and related functions
Date: Wed, 21 Nov 2012 00:39:08 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110969
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2012-11-21 00:39:08 -0800
message:
  Add optional "inherit" argument for face-bold-p and related functions
  
  * lisp/faces.el (face-underline-p, face-inverse-video-p, face-bold-p)
  (face-italic-p): Add optional argument "inherit".
  
  * doc/lispref/display.texi (Attribute Functions):
  Add new "inherit" argument for face-bold-p etc.
  Move description of this argument to a common section, like "frame".
modified:
  doc/lispref/ChangeLog
  doc/lispref/display.texi
  lisp/ChangeLog
  lisp/faces.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2012-11-21 08:27:13 +0000
+++ b/doc/lispref/ChangeLog     2012-11-21 08:39:08 +0000
@@ -2,6 +2,8 @@
 
        * display.texi (Attribute Functions):
        Update for set-face-* name changes.
+       Add new "inherit" argument for face-bold-p etc.
+       Move description of this argument to a common section, like "frame".
 
        * debugging.texi (Profiling): New section.
        (Debugging): Mention profiling in the introduction.

=== modified file 'doc/lispref/display.texi'
--- a/doc/lispref/display.texi  2012-11-21 08:27:13 +0000
+++ b/doc/lispref/display.texi  2012-11-21 08:39:08 +0000
@@ -2453,59 +2453,48 @@
 don't specify @var{frame}, they refer to the selected frame; @code{t}
 refers to the default data for new frames.  They return the symbol
 @code{unspecified} if the face doesn't define any value for that
-attribute.
+attribute.  If @var{inherit} is @code{nil}, only an attribute directly
+defined by the face is returned.  If @var{inherit} is address@hidden,
+any faces specified by its @code{:inherit} attribute are considered as
+well, and if @var{inherit} is a face or a list of faces, then they are
+also considered, until a specified attribute is found.  To ensure that
+the return value is always specified, use a value of @code{default} for
address@hidden
+
address@hidden face-font face &optional frame
+This function returns the name of the font of face @var{face}.
address@hidden defun
 
 @defun face-foreground face &optional frame inherit
 @defunx face-background face &optional frame inherit
 These functions return the foreground color (or background color,
 respectively) of face @var{face}, as a string.
-
-If @var{inherit} is @code{nil}, only a color directly defined by the face is
-returned.  If @var{inherit} is address@hidden, any faces specified by its
address@hidden:inherit} attribute are considered as well, and if @var{inherit}
-is a face or a list of faces, then they are also considered, until a
-specified color is found.  To ensure that the return value is always
-specified, use a value of @code{default} for @var{inherit}.
 @end defun
 
 @defun face-stipple face &optional frame inherit
 This function returns the name of the background stipple pattern of face
 @var{face}, or @code{nil} if it doesn't have one.
-
-If @var{inherit} is @code{nil}, only a stipple directly defined by the
-face is returned.  If @var{inherit} is address@hidden, any faces
-specified by its @code{:inherit} attribute are considered as well, and
-if @var{inherit} is a face or a list of faces, then they are also
-considered, until a specified stipple is found.  To ensure that the
-return value is always specified, use a value of @code{default} for
address@hidden
address@hidden defun
-
address@hidden face-font face &optional frame
-This function returns the name of the font of face @var{face}.
address@hidden defun
-
address@hidden face-bold-p face &optional frame
address@hidden defun
+
address@hidden face-bold-p face &optional frame inherit
 This function returns a address@hidden value if the @code{:weight}
 attribute of @var{face} is bolder than normal (i.e., one of
 @code{semi-bold}, @code{bold}, @code{extra-bold}, or
 @code{ultra-bold}).  Otherwise, it returns @code{nil}.
 @end defun
 
address@hidden face-italic-p face &optional frame
address@hidden face-italic-p face &optional frame inherit
 This function returns a address@hidden value if the @code{:slant}
 attribute of @var{face} is @code{italic} or @code{oblique}, and
 @code{nil} otherwise.
 @end defun
 
address@hidden Note the weasel words.  A face that inherits from an underlined
address@hidden face but does not specify :underline will return nil.
address@hidden face-underline-p face &optional frame
address@hidden face-underline-p face &optional frame inherit
 This function returns address@hidden if face @var{face} specifies
 a address@hidden @code{:underline} attribute.
 @end defun
 
address@hidden face-inverse-video-p face &optional frame
address@hidden face-inverse-video-p face &optional frame inherit
 This function returns address@hidden if face @var{face} specifies
 a address@hidden @code{:inverse-video} attribute.
 @end defun

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-21 08:27:13 +0000
+++ b/lisp/ChangeLog    2012-11-21 08:39:08 +0000
@@ -1,5 +1,8 @@
 2012-11-21  Glenn Morris  <address@hidden>
 
+       * faces.el (face-underline-p, face-inverse-video-p, face-bold-p)
+       (face-italic-p): Add optional argument "inherit".
+
        * faces.el (set-face-inverse-video, set-face-bold, set-face-italic):
        Remove -p suffix from names, for consistency with other set-face-*.
        (set-face-inverse-video): Fix interactive spec.

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2012-11-21 08:27:13 +0000
+++ b/lisp/faces.el     2012-11-21 08:39:08 +0000
@@ -487,44 +487,44 @@
 (defalias 'face-background-pixmap 'face-stipple)
 
 
-;; FIXME all of these -p functions ignore inheritance (cf face-stipple).
-;; Ie, a face that inherits from an underlined face but does not
-;; specify :underline will return nil.
-;; So these functions don't actually tell you anything about how the
-;; face will _appear_.  So not very useful IMO.
-(defun face-underline-p (face &optional frame)
+(defun face-underline-p (face &optional frame inherit)
  "Return non-nil if FACE specifies a non-nil underlining.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
-If FRAME is omitted or nil, use the selected frame."
- (face-attribute-specified-or (face-attribute face :underline frame) nil))
-
-
-(defun face-inverse-video-p (face &optional frame)
+If FRAME is omitted or nil, use the selected frame.
+Optional argument INHERIT is passed to `face-attribute'."
+ (face-attribute-specified-or
+  (face-attribute face :underline frame inherit) nil))
+
+
+(defun face-inverse-video-p (face &optional frame inherit)
  "Return non-nil if FACE specifies a non-nil inverse-video.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
-If FRAME is omitted or nil, use the selected frame."
- (eq (face-attribute face :inverse-video frame) t))
-
-
-(defun face-bold-p (face &optional frame)
+If FRAME is omitted or nil, use the selected frame.
+Optional argument INHERIT is passed to `face-attribute'."
+ (eq (face-attribute face :inverse-video frame inherit) t))
+
+
+(defun face-bold-p (face &optional frame inherit)
   "Return non-nil if the font of FACE is bold on FRAME.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.
+Optional argument INHERIT is passed to `face-attribute'.
 Use `face-attribute' for finer control."
-  (let ((bold (face-attribute face :weight frame)))
+  (let ((bold (face-attribute face :weight frame inherit)))
     (memq bold '(semi-bold bold extra-bold ultra-bold))))
 
 
-(defun face-italic-p (face &optional frame)
+(defun face-italic-p (face &optional frame inherit)
   "Return non-nil if the font of FACE is italic on FRAME.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame.
+Optional argument INHERIT is passed to `face-attribute'.
 Use `face-attribute' for finer control."
-  (let ((italic (face-attribute face :slant frame)))
+  (let ((italic (face-attribute face :slant frame inherit)))
     (memq italic '(italic oblique))))
 
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]