%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/ |
Current File : //usr/local/share/emacs/27.2/lisp/format-spec.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #@1438 Return a string based on FORMAT and SPECIFICATION. FORMAT is a string containing `format'-like specs like "su - %u %k". SPECIFICATION is an alist mapping format specification characters to their substitutions. For instance: (format-spec "su - %u %l" \=`((?u . ,(user-login-name)) (?l . "ls"))) Each %-spec may contain optional flag and width modifiers, as follows: %<flags><width>character The following flags are allowed: * 0: Pad to the width, if given, with zeros instead of spaces. * -: Pad to the width, if given, on the right instead of the left. * <: Truncate to the width, if given, on the left. * >: Truncate to the width, if given, on the right. * ^: Convert to upper case. * _: Convert to lower case. The width modifier behaves like the corresponding one in `format' when applied to %s. For example, "%<010b" means "substitute into the output the value associated with ?b in SPECIFICATION, either padding it with leading zeros or truncating leading characters until it's ten characters wide". Any text properties of FORMAT are copied to the result, with any text properties of a %-spec itself copied to its substitution. ONLY-PRESENT indicates how to handle %-spec characters not present in SPECIFICATION. If it is nil or omitted, emit an error; otherwise leave those %-specs and any occurrences of "%%" in FORMAT verbatim in the result, including their text properties, if any. (defalias 'format-spec #[(format specification &optional only-present) "\306\307!rq\210\310\216 c\210eb\210\311\312\313\314#\203\334 \313f\315=\203* \n\204 \316\317!\210\202 \320\321!\203\321 \322\317!\322\323!\324\322\325!!\211%\236\211&\204T \n\204\315 \326\327 \"\210\202\315 &A&\330!\301\331&\"'\f\203\234 \332\f!\333'\f#\211'G\fV\203\234 \334>\203\216 \335'\211G\fZ\"'\202\234 \336>\203\234 \335'\337\f#'\340>\203\247 '\226'\341>\203\262 '\227'\342'!\210\337\224'G\\\337\225'G\\|\210\337\224S\337\224|\210),\202 \n\204 \326\343!\210\202 \344 +\207" [#1=#:temp-buffer format only-present modifiers num spec generate-new-buffer " *temp*" #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] search-forward "%" nil t 37 delete-char 1 looking-at "\\([-0 _^<>]*\\)\\([0-9.]*\\)\\([a-zA-Z]\\)" match-string 2 string-to-char 3 error "Invalid format character: `%%%c'" format-spec--parse-modifiers "%s" string-to-number format-spec--pad :chop-left substring :chop-right 0 :uppercase :lowercase insert-and-inherit "Invalid format string" buffer-string specification val text] 5 (#$ . 410)]) (defalias 'format-spec--pad #[(text total-length modifiers) "G V\203 \207\304 GZ\305\n>\203 \306\202 \307\"\310\n>\203' P\202* P)\207" [text total-length modifiers padding make-string :zero-pad 48 32 :right-pad] 4]) (defalias 'format-spec--parse-modifiers #[(modifiers) "\301\302\"\207" [modifiers mapcan #[(char) "\302\267\202\"