diff options
| author | Daniel Colascione | 2018-06-08 21:21:47 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2018-06-08 21:21:47 -0700 |
| commit | f1e65b73ca20f72717d0b50fa5d983668a49bc38 (patch) | |
| tree | c38cf4460ecd9c559afc3a5b047311d36072bdc7 /src | |
| parent | d1febb42f48cd9906713d2a2f4501a7059d7d171 (diff) | |
| download | emacs-f1e65b73ca20f72717d0b50fa5d983668a49bc38.tar.gz emacs-f1e65b73ca20f72717d0b50fa5d983668a49bc38.zip | |
Fix formatting in the face filter change
* src/xfaces.c:
(evaluate_face_filter,filter_face_ref)
(merge_face_ref,syms_of_xfaces): Fix comments, formatting.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 961bef7c9ce..265581cca88 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -2193,8 +2193,10 @@ merge_named_face (struct window *w, | |||
| 2193 | (:window PARAMETER VALUE), which matches if the current window has | 2193 | (:window PARAMETER VALUE), which matches if the current window has |
| 2194 | a PARAMETER EQ to VALUE. | 2194 | a PARAMETER EQ to VALUE. |
| 2195 | 2195 | ||
| 2196 | If the filter is invalid, set *OK to false and, if ERR_MSGS is | 2196 | This function returns true if the face filter matches and false if |
| 2197 | true, log an error message. */ | 2197 | it doesn't or if the function encountered an error. If the filter |
| 2198 | is invalid, set *OK to false and, if ERR_MSGS is true, log an error | ||
| 2199 | message. On success, *OK is untouched. */ | ||
| 2198 | static bool | 2200 | static bool |
| 2199 | evaluate_face_filter (Lisp_Object filter, struct window *w, | 2201 | evaluate_face_filter (Lisp_Object filter, struct window *w, |
| 2200 | bool *ok, bool err_msgs) | 2202 | bool *ok, bool err_msgs) |
| @@ -2211,7 +2213,7 @@ evaluate_face_filter (Lisp_Object filter, struct window *w, | |||
| 2211 | if (!CONSP (filter)) | 2213 | if (!CONSP (filter)) |
| 2212 | goto err; | 2214 | goto err; |
| 2213 | 2215 | ||
| 2214 | if (!EQ (XCAR (filter), Qwindow_kw)) | 2216 | if (!EQ (XCAR (filter), QCwindow)) |
| 2215 | goto err; | 2217 | goto err; |
| 2216 | filter = XCDR (filter); | 2218 | filter = XCDR (filter); |
| 2217 | 2219 | ||
| @@ -2226,11 +2228,12 @@ evaluate_face_filter (Lisp_Object filter, struct window *w, | |||
| 2226 | goto err; | 2228 | goto err; |
| 2227 | 2229 | ||
| 2228 | bool match = false; | 2230 | bool match = false; |
| 2229 | if (w) { | 2231 | if (w) |
| 2230 | Lisp_Object found = assq_no_quit (parameter, w->window_parameters); | 2232 | { |
| 2231 | if (!NILP (found) && EQ (XCDR (found), value)) | 2233 | Lisp_Object found = assq_no_quit (parameter, w->window_parameters); |
| 2232 | match = true; | 2234 | if (!NILP (found) && EQ (XCDR (found), value)) |
| 2233 | } | 2235 | match = true; |
| 2236 | } | ||
| 2234 | 2237 | ||
| 2235 | return match; | 2238 | return match; |
| 2236 | } | 2239 | } |
| @@ -2243,15 +2246,16 @@ evaluate_face_filter (Lisp_Object filter, struct window *w, | |||
| 2243 | } | 2246 | } |
| 2244 | 2247 | ||
| 2245 | /* Determine whether FACE_REF is a "filter" face specification (case | 2248 | /* Determine whether FACE_REF is a "filter" face specification (case |
| 2246 | #4 in merge_face_ref). If it is, evaluate the filter, and if the | 2249 | #4 in merge_face_ref). If it is, evaluate the filter, and if the |
| 2247 | filter matches, return the filtered expression. Otherwise, return | 2250 | filter matches, return the filtered expression. If the filter does |
| 2248 | the original expression. | 2251 | not match, return `nil'. If FACE_REF is not a filtered face |
| 2252 | specification, return FACE_REF. | ||
| 2249 | 2253 | ||
| 2250 | On error, set *OK to false, having logged an error message if | 2254 | On error, set *OK to false, having logged an error message if |
| 2251 | ERR_MSGS is true, with return value unspecified. | 2255 | ERR_MSGS is true, and return `nil'. |
| 2252 | 2256 | ||
| 2253 | W is either NULL or a window used to evaluate filters. If W is | 2257 | W is either NULL or a window used to evaluate filters. If W is |
| 2254 | null, no window-based face specification filter matches. | 2258 | NULL, no window-based face specification filter matches. |
| 2255 | */ | 2259 | */ |
| 2256 | static Lisp_Object | 2260 | static Lisp_Object |
| 2257 | filter_face_ref (Lisp_Object face_ref, | 2261 | filter_face_ref (Lisp_Object face_ref, |
| @@ -2263,8 +2267,10 @@ filter_face_ref (Lisp_Object face_ref, | |||
| 2263 | if (!CONSP (face_ref)) | 2267 | if (!CONSP (face_ref)) |
| 2264 | return face_ref; | 2268 | return face_ref; |
| 2265 | 2269 | ||
| 2270 | /* Inner braces keep compiler happy about the goto skipping variable | ||
| 2271 | initialization. */ | ||
| 2266 | { | 2272 | { |
| 2267 | if (!EQ (XCAR (face_ref), Qfiltered_kw)) | 2273 | if (!EQ (XCAR (face_ref), QCfiltered)) |
| 2268 | return face_ref; | 2274 | return face_ref; |
| 2269 | face_ref = XCDR (face_ref); | 2275 | face_ref = XCDR (face_ref); |
| 2270 | 2276 | ||
| @@ -2336,7 +2342,8 @@ merge_face_ref (struct window *w, | |||
| 2336 | { | 2342 | { |
| 2337 | face_ref = filtered_face_ref; | 2343 | face_ref = filtered_face_ref; |
| 2338 | filtered_face_ref = filter_face_ref (face_ref, w, &ok, err_msgs); | 2344 | filtered_face_ref = filter_face_ref (face_ref, w, &ok, err_msgs); |
| 2339 | } while (ok && !EQ (face_ref, filtered_face_ref)); | 2345 | } |
| 2346 | while (ok && !EQ (face_ref, filtered_face_ref)); | ||
| 2340 | 2347 | ||
| 2341 | if (!ok) | 2348 | if (!ok) |
| 2342 | return false; | 2349 | return false; |
| @@ -4569,8 +4576,8 @@ face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face) | |||
| 4569 | frame F suitable for displaying ASCII characters. Value is -1 if | 4576 | frame F suitable for displaying ASCII characters. Value is -1 if |
| 4570 | the face couldn't be determined, which might happen if the default | 4577 | the face couldn't be determined, which might happen if the default |
| 4571 | face isn't realized and cannot be realized. If window W is given, | 4578 | face isn't realized and cannot be realized. If window W is given, |
| 4572 | consider face remappings specified for W or for W's buffer. If W is | 4579 | consider face remappings specified for W or for W's buffer. If W |
| 4573 | NULL, consider only frame-level face configuration. */ | 4580 | is NULL, consider only frame-level face configuration. */ |
| 4574 | int | 4581 | int |
| 4575 | lookup_named_face (struct window *w, struct frame *f, | 4582 | lookup_named_face (struct window *w, struct frame *f, |
| 4576 | Lisp_Object symbol, bool signal_p) | 4583 | Lisp_Object symbol, bool signal_p) |
| @@ -6564,8 +6571,8 @@ syms_of_xfaces (void) | |||
| 6564 | 6571 | ||
| 6565 | /* Used for limiting character attributes to windows with specific | 6572 | /* Used for limiting character attributes to windows with specific |
| 6566 | characteristics. */ | 6573 | characteristics. */ |
| 6567 | DEFSYM (Qwindow_kw, ":window"); | 6574 | DEFSYM (QCwindow, ":window"); |
| 6568 | DEFSYM (Qfiltered_kw, ":filtered"); | 6575 | DEFSYM (QCfiltered, ":filtered"); |
| 6569 | 6576 | ||
| 6570 | /* The symbol `face-alias'. A symbol having that property is an | 6577 | /* The symbol `face-alias'. A symbol having that property is an |
| 6571 | alias for another face. Value of the property is the name of | 6578 | alias for another face. Value of the property is the name of |
| @@ -6643,8 +6650,10 @@ syms_of_xfaces (void) | |||
| 6643 | #endif | 6650 | #endif |
| 6644 | 6651 | ||
| 6645 | DEFVAR_BOOL ("face-filters-always-match", face_filters_always_match, | 6652 | DEFVAR_BOOL ("face-filters-always-match", face_filters_always_match, |
| 6646 | doc: /* Non-nil means that face filters are always deemed to | 6653 | doc: /* Non-nil means that face filters are always |
| 6647 | match. Use only when evaluating face attributes. */); | 6654 | deemed to match. This variable is intended for use only by code that |
| 6655 | evaluates the "specifity" of a face specification and should be | ||
| 6656 | let-bound only for this purpose. */); | ||
| 6648 | 6657 | ||
| 6649 | DEFVAR_LISP ("face-new-frame-defaults", Vface_new_frame_defaults, | 6658 | DEFVAR_LISP ("face-new-frame-defaults", Vface_new_frame_defaults, |
| 6650 | doc: /* List of global face definitions (for internal use only.) */); | 6659 | doc: /* List of global face definitions (for internal use only.) */); |