diff options
| author | Glenn Morris | 2020-06-07 09:03:59 -0700 |
|---|---|---|
| committer | Glenn Morris | 2020-06-07 09:03:59 -0700 |
| commit | fa6d56529f9ebaedaf62ecbf8887ffecca7dce12 (patch) | |
| tree | 922e12ffbf813534647a96788b9a5fb77b4f2288 | |
| parent | 6cb557e7a58d7f1c2e9afceeba45d0ced2aff214 (diff) | |
| parent | 35661ef943d261f6c43e93e475ddd8516f4a4b62 (diff) | |
| download | emacs-fa6d56529f9ebaedaf62ecbf8887ffecca7dce12.tar.gz emacs-fa6d56529f9ebaedaf62ecbf8887ffecca7dce12.zip | |
Merge from origin/emacs-27
35661ef943 (origin/emacs-27) Fix typo in "(elisp) Type Keywords"
1af0e95fec Gnus nnir-summary-line-format has no effect
dd366b5d3b Improve documentation of 'window-text-pixel-size'
fbd49f969e * src/xdisp.c (Fwindow_text_pixel_size): Doc fix. (Bug#41...
d8593fd19f Minor improvements to EDE and EIEIO manuals
3916e63f9e Have Fido mode also imitate Ido mode in ignore-case options
cc35b197c7 Update package-menu-quick-help
bf09106256 Improve documentation of 'sort-subr'
73749efa13 Update Ukrainian transliteration
30a7ee505a Fix Arabic shaping when eww/shr fill the text to be rendered
7d323f07c0 Silence some byte-compiler warnings in tests
cf473e742f * test/lisp/battery-tests.el: New file.
b07e3b1d97 Improve format-spec documentation (bug#41571)
# Conflicts:
# test/lisp/emacs-lisp/package-tests.el
| -rw-r--r-- | doc/lispref/customize.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 55 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 176 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 75 | ||||
| -rw-r--r-- | doc/misc/ede.texi | 10 | ||||
| -rw-r--r-- | doc/misc/eieio.texi | 17 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 7 | ||||
| -rw-r--r-- | lisp/format-spec.el | 49 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 9 | ||||
| -rw-r--r-- | lisp/icomplete.el | 5 | ||||
| -rw-r--r-- | lisp/language/cyril-util.el | 6 | ||||
| -rw-r--r-- | src/hbfont.c | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 60 | ||||
| -rw-r--r-- | test/lisp/battery-tests.el | 58 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-generic-tests.el | 8 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/package-tests.el | 5 | ||||
| -rw-r--r-- | test/lisp/eshell/eshell-tests.el | 1 | ||||
| -rw-r--r-- | test/lisp/image/exif-tests.el | 5 | ||||
| -rw-r--r-- | test/lisp/international/ccl-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/mail/footnote-tests.el | 6 | ||||
| -rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 11 | ||||
| -rw-r--r-- | test/lisp/progmodes/sql-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/simple-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/wdired-tests.el | 2 | ||||
| -rw-r--r-- | test/src/buffer-tests.el | 1 | ||||
| -rw-r--r-- | test/src/data-tests.el | 6 |
26 files changed, 417 insertions, 172 deletions
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 172809b29d8..2a72276bc56 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi | |||
| @@ -1156,7 +1156,7 @@ in that value. | |||
| 1156 | 1156 | ||
| 1157 | The usual reason to specify a documentation string for a type is to | 1157 | The usual reason to specify a documentation string for a type is to |
| 1158 | provide more information about the meanings of alternatives inside a | 1158 | provide more information about the meanings of alternatives inside a |
| 1159 | @code{:choice} type or the parts of some other composite type. | 1159 | @code{choice} type or the parts of some other composite type. |
| 1160 | 1160 | ||
| 1161 | @item :help-echo @var{motion-doc} | 1161 | @item :help-echo @var{motion-doc} |
| 1162 | @kindex help-echo@r{, customization keyword} | 1162 | @kindex help-echo@r{, customization keyword} |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 3d738b9965f..6fff199485e 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2017,36 +2017,45 @@ it contains. | |||
| 2017 | 2017 | ||
| 2018 | @defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line | 2018 | @defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line |
| 2019 | This function returns the size of the text of @var{window}'s buffer in | 2019 | This function returns the size of the text of @var{window}'s buffer in |
| 2020 | pixels. @var{window} must be a live window and defaults to the selected | 2020 | pixels. @var{window} must be a live window and defaults to the |
| 2021 | one. The return value is a cons of the maximum pixel-width of any text | 2021 | selected one. The return value is a cons of the maximum pixel-width |
| 2022 | line and the maximum pixel-height of all text lines. | 2022 | of any text line and the maximum pixel-height of all text lines. This |
| 2023 | 2023 | function exists to allow Lisp programs to adjust the dimensions of | |
| 2024 | The optional argument @var{from}, if non-@code{nil}, specifies the first | 2024 | @var{window} to the buffer text it needs to display. |
| 2025 | text position to consider and defaults to the minimum accessible | 2025 | |
| 2026 | position of the buffer. If @var{from} is @code{t}, it uses the minimum | 2026 | The optional argument @var{from}, if non-@code{nil}, specifies the |
| 2027 | accessible position that is not a newline character. The optional | 2027 | first text position to consider, and defaults to the minimum |
| 2028 | argument @var{to}, if non-@code{nil}, specifies the last text position | 2028 | accessible position of the buffer. If @var{from} is @code{t}, it |
| 2029 | to consider and defaults to the maximum accessible position of the | 2029 | stands for the minimum accessible position that is not a newline |
| 2030 | buffer. If @var{to} is @code{t}, it uses the maximum accessible | 2030 | character. The optional argument @var{to}, if non-@code{nil}, |
| 2031 | position that is not a newline character. | 2031 | specifies the last text position to consider, and defaults to the |
| 2032 | maximum accessible position of the buffer. If @var{to} is @code{t}, | ||
| 2033 | it stands for the maximum accessible position that is not a newline | ||
| 2034 | character. | ||
| 2032 | 2035 | ||
| 2033 | The optional argument @var{x-limit}, if non-@code{nil}, specifies the | 2036 | The optional argument @var{x-limit}, if non-@code{nil}, specifies the |
| 2034 | maximum pixel-width that can be returned. @var{x-limit} @code{nil} or | 2037 | maximum X coordinate beyond which text should be ignored; it is |
| 2035 | omitted, means to use the pixel-width of @var{window}'s body | 2038 | therefore also the largest value of pixel-width that the function can |
| 2036 | (@pxref{Window Sizes}); this is useful when the caller does not intend | 2039 | return. If @var{x-limit} @code{nil} or omitted, it means to use the |
| 2037 | to change the width of @var{window}. Otherwise, the caller should | 2040 | pixel-width of @var{window}'s body (@pxref{Window Sizes}); this |
| 2038 | specify here the maximum width @var{window}'s body may assume. Text | 2041 | default means that text of truncated lines wider than the window will |
| 2039 | whose x-coordinate is beyond @var{x-limit} is ignored. Since | 2042 | be ignored. This default is useful when the caller does not intend to |
| 2043 | change the width of @var{window}. Otherwise, the caller should | ||
| 2044 | specify here the maximum width @var{window}'s body may assume; in | ||
| 2045 | particular, if truncated lines are expected and their text needs to be | ||
| 2046 | accounted for, @var{x-limit} should be set to a large value. Since | ||
| 2040 | calculating the width of long lines can take some time, it's always a | 2047 | calculating the width of long lines can take some time, it's always a |
| 2041 | good idea to make this argument as small as needed; in particular, if | 2048 | good idea to make this argument as small as needed; in particular, if |
| 2042 | the buffer might contain long lines that will be truncated anyway. | 2049 | the buffer might contain long lines that will be truncated anyway. |
| 2043 | 2050 | ||
| 2044 | The optional argument @var{y-limit}, if non-@code{nil}, specifies the | 2051 | The optional argument @var{y-limit}, if non-@code{nil}, specifies the |
| 2045 | maximum pixel-height that can be returned. Text lines whose | 2052 | maximum Y coordinate beyond which text is to be ignored; it is |
| 2046 | y-coordinate is beyond @var{y-limit} are ignored. Since calculating the | 2053 | therefore also the maximum pixel-height that the function can return. |
| 2047 | pixel-height of a large buffer can take some time, it makes sense to | 2054 | If @var{y-limit} is nil or omitted, it means to considers all the |
| 2048 | specify this argument; in particular, if the caller does not know the | 2055 | lines of text till the buffer position specified by @var{to}. Since |
| 2049 | size of the buffer. | 2056 | calculating the pixel-height of a large buffer can take some time, it |
| 2057 | makes sense to specify this argument; in particular, if the caller | ||
| 2058 | does not know the size of the buffer. | ||
| 2050 | 2059 | ||
| 2051 | The optional argument @var{mode-and-header-line} @code{nil} or omitted | 2060 | The optional argument @var{mode-and-header-line} @code{nil} or omitted |
| 2052 | means to not include the height of the mode- or header-line of | 2061 | means to not include the height of the mode- or header-line of |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 70c3b3cf4be..4a7bda57c4e 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -28,6 +28,7 @@ keyboard character events. | |||
| 28 | * Text Comparison:: Comparing characters or strings. | 28 | * Text Comparison:: Comparing characters or strings. |
| 29 | * String Conversion:: Converting to and from characters and strings. | 29 | * String Conversion:: Converting to and from characters and strings. |
| 30 | * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. | 30 | * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. |
| 31 | * Custom Format Strings:: Formatting custom @code{format} specifications. | ||
| 31 | * Case Conversion:: Case conversion functions. | 32 | * Case Conversion:: Case conversion functions. |
| 32 | * Case Tables:: Customizing case conversion. | 33 | * Case Tables:: Customizing case conversion. |
| 33 | @end menu | 34 | @end menu |
| @@ -1122,6 +1123,181 @@ may be problematic; for example, @samp{%d} and @samp{%g} can mishandle | |||
| 1122 | NaNs and can lose precision and type, and @samp{#x%x} and @samp{#o%o} | 1123 | NaNs and can lose precision and type, and @samp{#x%x} and @samp{#o%o} |
| 1123 | can mishandle negative integers. @xref{Input Functions}. | 1124 | can mishandle negative integers. @xref{Input Functions}. |
| 1124 | 1125 | ||
| 1126 | The functions described in this section accept a fixed set of | ||
| 1127 | specification characters. The next section describes a function | ||
| 1128 | @code{format-spec} which can accept custom specification characters, | ||
| 1129 | such as @samp{%a} or @samp{%z}. | ||
| 1130 | |||
| 1131 | @node Custom Format Strings | ||
| 1132 | @section Custom Format Strings | ||
| 1133 | @cindex custom format string | ||
| 1134 | @cindex custom @samp{%}-sequence in format | ||
| 1135 | |||
| 1136 | Sometimes it is useful to allow users and Lisp programs alike to | ||
| 1137 | control how certain text is generated via custom format control | ||
| 1138 | strings. For example, a format string could control how to display | ||
| 1139 | someone's forename, surname, and email address. Using the function | ||
| 1140 | @code{format} described in the previous section, the format string | ||
| 1141 | could be something like @w{@code{"%s %s <%s>"}}. This approach | ||
| 1142 | quickly becomes impractical, however, as it can be unclear which | ||
| 1143 | specification character corresponds to which piece of information. | ||
| 1144 | |||
| 1145 | A more convenient format string for such cases would be something like | ||
| 1146 | @w{@code{"%f %l <%e>"}}, where each specification character carries | ||
| 1147 | more semantic information and can easily be rearranged relative to | ||
| 1148 | other specification characters, making such format strings more easily | ||
| 1149 | customizable by the user. | ||
| 1150 | |||
| 1151 | The function @code{format-spec} described in this section performs a | ||
| 1152 | similar function to @code{format}, except it operates on format | ||
| 1153 | control strings that use arbitrary specification characters. | ||
| 1154 | |||
| 1155 | @defun format-spec template spec-alist &optional only-present | ||
| 1156 | This function returns a string produced from the format string | ||
| 1157 | @var{template} according to conversions specified in @var{spec-alist}, | ||
| 1158 | which is an alist (@pxref{Association Lists}) of the form | ||
| 1159 | @w{@code{(@var{letter} . @var{replacement})}}. Each specification | ||
| 1160 | @code{%@var{letter}} in @var{template} will be replaced by | ||
| 1161 | @var{replacement} when formatting the resulting string. | ||
| 1162 | |||
| 1163 | The characters in @var{template}, other than the format | ||
| 1164 | specifications, are copied directly into the output, including their | ||
| 1165 | text properties, if any. Any text properties of the format | ||
| 1166 | specifications are copied to their replacements. | ||
| 1167 | |||
| 1168 | Using an alist to specify conversions gives rise to some useful | ||
| 1169 | properties: | ||
| 1170 | |||
| 1171 | @itemize @bullet | ||
| 1172 | @item | ||
| 1173 | If @var{spec-alist} contains more unique @var{letter} keys than there | ||
| 1174 | are unique specification characters in @var{template}, the unused keys | ||
| 1175 | are simply ignored. | ||
| 1176 | @item | ||
| 1177 | If @var{spec-alist} contains more than one association with the same | ||
| 1178 | @var{letter}, the closest one to the start of the list is used. | ||
| 1179 | @item | ||
| 1180 | If @var{template} contains the same specification character more than | ||
| 1181 | once, then the same @var{replacement} found in @var{spec-alist} is | ||
| 1182 | used as a basis for all of that character's substitutions. | ||
| 1183 | @item | ||
| 1184 | The order of specifications in @var{template} need not correspond to | ||
| 1185 | the order of associations in @var{spec-alist}. | ||
| 1186 | @end itemize | ||
| 1187 | |||
| 1188 | The optional argument @var{only-present} indicates how to handle | ||
| 1189 | specification characters in @var{template} that are not found in | ||
| 1190 | @var{spec-alist}. If it is @code{nil} or omitted, the function | ||
| 1191 | signals an error. Otherwise, those format specifications and any | ||
| 1192 | occurrences of @samp{%%} in @var{template} are left verbatim in the | ||
| 1193 | output, including their text properties, if any. | ||
| 1194 | @end defun | ||
| 1195 | |||
| 1196 | The syntax of format specifications accepted by @code{format-spec} is | ||
| 1197 | similar, but not identical, to that accepted by @code{format}. In | ||
| 1198 | both cases, a format specification is a sequence of characters | ||
| 1199 | beginning with @samp{%} and ending with an alphabetic letter such as | ||
| 1200 | @samp{s}. | ||
| 1201 | |||
| 1202 | Unlike @code{format}, which assigns specific meanings to a fixed set | ||
| 1203 | of specification characters, @code{format-spec} accepts arbitrary | ||
| 1204 | specification characters and treats them all equally. For example: | ||
| 1205 | |||
| 1206 | @example | ||
| 1207 | @group | ||
| 1208 | (setq my-site-info | ||
| 1209 | (list (cons ?s system-name) | ||
| 1210 | (cons ?t (symbol-name system-type)) | ||
| 1211 | (cons ?c system-configuration) | ||
| 1212 | (cons ?v emacs-version) | ||
| 1213 | (cons ?e invocation-name) | ||
| 1214 | (cons ?p (number-to-string (emacs-pid))) | ||
| 1215 | (cons ?a user-mail-address) | ||
| 1216 | (cons ?n user-full-name))) | ||
| 1217 | |||
| 1218 | (format-spec "%e %v (%c)" my-site-info) | ||
| 1219 | @result{} "emacs 27.1 (x86_64-pc-linux-gnu)" | ||
| 1220 | |||
| 1221 | (format-spec "%n <%a>" my-site-info) | ||
| 1222 | @result{} "Emacs Developers <emacs-devel@@gnu.org>" | ||
| 1223 | @end group | ||
| 1224 | @end example | ||
| 1225 | |||
| 1226 | A format specification can include any number of the following flag | ||
| 1227 | characters immediately after the @samp{%} to modify aspects of the | ||
| 1228 | substitution. | ||
| 1229 | |||
| 1230 | @table @samp | ||
| 1231 | @item 0 | ||
| 1232 | This flag causes any padding specified by the width to consist of | ||
| 1233 | @samp{0} characters instead of spaces. | ||
| 1234 | |||
| 1235 | @item - | ||
| 1236 | This flag causes any padding specified by the width to be inserted on | ||
| 1237 | the right rather than the left. | ||
| 1238 | |||
| 1239 | @item < | ||
| 1240 | This flag causes the substitution to be truncated on the left to the | ||
| 1241 | given width, if specified. | ||
| 1242 | |||
| 1243 | @item > | ||
| 1244 | This flag causes the substitution to be truncated on the right to the | ||
| 1245 | given width, if specified. | ||
| 1246 | |||
| 1247 | @item ^ | ||
| 1248 | This flag converts the substituted text to upper case (@pxref{Case | ||
| 1249 | Conversion}). | ||
| 1250 | |||
| 1251 | @item _ | ||
| 1252 | This flag converts the substituted text to lower case (@pxref{Case | ||
| 1253 | Conversion}). | ||
| 1254 | @end table | ||
| 1255 | |||
| 1256 | The result of using contradictory flags (for instance, both upper and | ||
| 1257 | lower case) is undefined. | ||
| 1258 | |||
| 1259 | As is the case with @code{format}, a format specification can include | ||
| 1260 | a width, which is a decimal number that appears after any flags. If a | ||
| 1261 | substitution contains fewer characters than its specified width, it is | ||
| 1262 | padded on the left: | ||
| 1263 | |||
| 1264 | @example | ||
| 1265 | @group | ||
| 1266 | (format-spec "%8a is padded on the left with spaces" | ||
| 1267 | '((?a . "alpha"))) | ||
| 1268 | @result{} " alpha is padded on the left with spaces" | ||
| 1269 | @end group | ||
| 1270 | @end example | ||
| 1271 | |||
| 1272 | Here is a more complicated example that combines several | ||
| 1273 | aforementioned features: | ||
| 1274 | |||
| 1275 | @example | ||
| 1276 | @group | ||
| 1277 | (setq my-battery-info | ||
| 1278 | (list (cons ?p "73") ; Percentage | ||
| 1279 | (cons ?L "Battery") ; Status | ||
| 1280 | (cons ?t "2:23") ; Remaining time | ||
| 1281 | (cons ?c "24330") ; Capacity | ||
| 1282 | (cons ?r "10.6"))) ; Rate of discharge | ||
| 1283 | |||
| 1284 | (format-spec "%>^-3L : %3p%% (%05t left)" my-battery-info) | ||
| 1285 | @result{} "BAT : 73% (02:23 left)" | ||
| 1286 | |||
| 1287 | (format-spec "%>^-3L : %3p%% (%05t left)" | ||
| 1288 | (cons (cons ?L "AC") | ||
| 1289 | my-battery-info)) | ||
| 1290 | @result{} "AC : 73% (02:23 left)" | ||
| 1291 | @end group | ||
| 1292 | @end example | ||
| 1293 | |||
| 1294 | As the examples in this section illustrate, @code{format-spec} is | ||
| 1295 | often used for selectively formatting an assortment of different | ||
| 1296 | pieces of information. This is useful in programs that provide | ||
| 1297 | user-customizable format strings, as the user can choose to format | ||
| 1298 | with a regular syntax and in any desired order only a subset of the | ||
| 1299 | information that the program makes available. | ||
| 1300 | |||
| 1125 | @node Case Conversion | 1301 | @node Case Conversion |
| 1126 | @section Case Conversion in Lisp | 1302 | @section Case Conversion in Lisp |
| 1127 | @cindex upper case | 1303 | @cindex upper case |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 7c4bed04cb5..d765c95f773 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -58,7 +58,6 @@ the character after point. | |||
| 58 | of another buffer. | 58 | of another buffer. |
| 59 | * Decompression:: Dealing with compressed data. | 59 | * Decompression:: Dealing with compressed data. |
| 60 | * Base 64:: Conversion to or from base 64 encoding. | 60 | * Base 64:: Conversion to or from base 64 encoding. |
| 61 | * Interpolated Strings:: Formatting Customizable Strings. | ||
| 62 | * Checksum/Hash:: Computing cryptographic hashes. | 61 | * Checksum/Hash:: Computing cryptographic hashes. |
| 63 | * GnuTLS Cryptography:: Cryptographic algorithms imported from GnuTLS. | 62 | * GnuTLS Cryptography:: Cryptographic algorithms imported from GnuTLS. |
| 64 | * Parsing HTML/XML:: Parsing HTML and XML. | 63 | * Parsing HTML/XML:: Parsing HTML and XML. |
| @@ -2029,8 +2028,15 @@ non-@code{nil} value. | |||
| 2029 | @end enumerate | 2028 | @end enumerate |
| 2030 | 2029 | ||
| 2031 | The argument @var{predicate} is the function to use to compare keys. | 2030 | The argument @var{predicate} is the function to use to compare keys. |
| 2032 | If keys are numbers, it defaults to @code{<}; otherwise it defaults to | 2031 | It is called with two arguments, the keys to compare, and should |
| 2033 | @code{string<}. | 2032 | return non-@code{nil} if the first key should come before the second |
| 2033 | in the sorting order. What exactly are the key arguments depends on | ||
| 2034 | what @var{startkeyfun} and @var{endkeyfun} return. If @var{predicate} | ||
| 2035 | is omitted or @code{nil}, it defaults to @code{<} if the keys are | ||
| 2036 | numbers, to @code{compare-buffer-substrings} if the keys are cons | ||
| 2037 | cells (whose @code{car} and @code{cdr} are start and end buffer | ||
| 2038 | positions of the key), and to @code{string<} otherwise (with keys | ||
| 2039 | assumed to be strings). | ||
| 2034 | 2040 | ||
| 2035 | As an example of @code{sort-subr}, here is the complete function | 2041 | As an example of @code{sort-subr}, here is the complete function |
| 2036 | definition for @code{sort-lines}: | 2042 | definition for @code{sort-lines}: |
| @@ -4662,69 +4668,6 @@ If optional argument @var{base64url} is non-@code{nil}, then padding | |||
| 4662 | is optional, and the URL variant of base 64 encoding is used. | 4668 | is optional, and the URL variant of base 64 encoding is used. |
| 4663 | @end defun | 4669 | @end defun |
| 4664 | 4670 | ||
| 4665 | |||
| 4666 | @node Interpolated Strings | ||
| 4667 | @section Formatting Customizable Strings | ||
| 4668 | |||
| 4669 | It is, in some circumstances, useful to present users with a string to | ||
| 4670 | be customized that can then be expanded programmatically. For | ||
| 4671 | instance, @code{erc-header-line-format} is @code{"%n on %t (%m,%l) | ||
| 4672 | %o"}, and each of those characters after the percent signs are | ||
| 4673 | expanded when the header line is computed. To do this, the | ||
| 4674 | @code{format-spec} function is used: | ||
| 4675 | |||
| 4676 | @defun format-spec format specification &optional only-present | ||
| 4677 | @var{format} is the format specification string as in the example | ||
| 4678 | above. @var{specification} is an alist that has elements where the | ||
| 4679 | @code{car} is a character and the @code{cdr} is the substitution. | ||
| 4680 | |||
| 4681 | If @var{only-present} is @code{nil}, errors will be signaled if a | ||
| 4682 | format character has been used that's not present in | ||
| 4683 | @var{specification}. If it's non-@code{nil}, that format | ||
| 4684 | specification is left verbatim in the result. | ||
| 4685 | @end defun | ||
| 4686 | |||
| 4687 | Here's a trivial example: | ||
| 4688 | |||
| 4689 | @example | ||
| 4690 | (format-spec "su - %u %l" | ||
| 4691 | `((?u . ,(user-login-name)) | ||
| 4692 | (?l . "ls"))) | ||
| 4693 | @result{} "su - foo ls" | ||
| 4694 | @end example | ||
| 4695 | |||
| 4696 | In addition to allowing padding/limiting to a certain length, the | ||
| 4697 | following modifiers can be used: | ||
| 4698 | |||
| 4699 | @table @asis | ||
| 4700 | @item @samp{0} | ||
| 4701 | Pad with zeros instead of the default spaces. | ||
| 4702 | |||
| 4703 | @item @samp{-} | ||
| 4704 | Pad to the right. | ||
| 4705 | |||
| 4706 | @item @samp{^} | ||
| 4707 | Use upper case. | ||
| 4708 | |||
| 4709 | @item @samp{_} | ||
| 4710 | Use lower case. | ||
| 4711 | |||
| 4712 | @item @samp{<} | ||
| 4713 | If the length needs to be limited, remove characters from the left. | ||
| 4714 | |||
| 4715 | @item @samp{>} | ||
| 4716 | Same as previous, but remove characters from the right. | ||
| 4717 | @end table | ||
| 4718 | |||
| 4719 | If contradictory modifiers are used (for instance, both upper and | ||
| 4720 | lower case), then what happens is undefined. | ||
| 4721 | |||
| 4722 | As an example, @samp{"%<010b"} means ``insert the @samp{b} expansion, | ||
| 4723 | but pad with leading zeros if it's less than ten characters, and if | ||
| 4724 | it's more than ten characters, shorten by removing characters from the | ||
| 4725 | left.'' | ||
| 4726 | |||
| 4727 | |||
| 4728 | @node Checksum/Hash | 4671 | @node Checksum/Hash |
| 4729 | @section Checksum/Hash | 4672 | @section Checksum/Hash |
| 4730 | @cindex MD5 checksum | 4673 | @cindex MD5 checksum |
diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index 584b0d7ee50..412176986cc 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi | |||
| @@ -955,18 +955,16 @@ The example for Makefiles looks like this: | |||
| 955 | ;;; MAKEFILE | 955 | ;;; MAKEFILE |
| 956 | 956 | ||
| 957 | (defclass ede-generic-makefile-project (ede-generic-project) | 957 | (defclass ede-generic-makefile-project (ede-generic-project) |
| 958 | ((buildfile :initform "Makefile") | 958 | ((buildfile :initform "Makefile")) |
| 959 | ) | ||
| 960 | "Generic Project for makefiles.") | 959 | "Generic Project for makefiles.") |
| 961 | 960 | ||
| 962 | (defmethod ede-generic-setup-configuration ((proj ede-generic-makefile-project) config) | 961 | (defmethod ede-generic-setup-configuration ((proj ede-generic-makefile-project) config) |
| 963 | "Setup a configuration for Make." | 962 | "Set up a configuration for Make." |
| 964 | (oset config build-command "make -k") | 963 | (oset config build-command "make -k") |
| 965 | (oset config debug-command "gdb ") | 964 | (oset config debug-command "gdb ")) |
| 966 | ) | ||
| 967 | 965 | ||
| 968 | (ede-generic-new-autoloader "generic-makefile" "Make" | 966 | (ede-generic-new-autoloader "generic-makefile" "Make" |
| 969 | "Makefile" 'ede-generic-makefile-project) | 967 | "Makefile" 'ede-generic-makefile-project) |
| 970 | @end example | 968 | @end example |
| 971 | 969 | ||
| 972 | This example project will detect any directory with the file | 970 | This example project will detect any directory with the file |
diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 6e7d4386bec..8dd394cb848 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi | |||
| @@ -744,14 +744,21 @@ slot values, and use the previously mentioned set/ref routines. | |||
| 744 | @anchor{slot-value} | 744 | @anchor{slot-value} |
| 745 | This function retrieves the value of @var{slot} from @var{object}. | 745 | This function retrieves the value of @var{slot} from @var{object}. |
| 746 | Unlike @code{oref}, the symbol for @var{slot} must be quoted. | 746 | Unlike @code{oref}, the symbol for @var{slot} must be quoted. |
| 747 | |||
| 748 | This is a generalized variable that can be used with @code{setf} to | ||
| 749 | modify the value stored in @var{slot}. @xref{Generalized | ||
| 750 | Variables,,,elisp,GNU Emacs Lisp Reference Manual}. | ||
| 747 | @end defun | 751 | @end defun |
| 748 | 752 | ||
| 749 | @defun set-slot-value object slot value | 753 | @defun set-slot-value object slot value |
| 750 | @anchor{set-slot-value} | 754 | @anchor{set-slot-value} |
| 751 | This is not a CLOS function, but is the setter for @code{slot-value} | 755 | This function sets the value of @var{slot} from @var{object}. Unlike |
| 752 | used by the @code{setf} macro. This | ||
| 753 | function sets the value of @var{slot} from @var{object}. Unlike | ||
| 754 | @code{oset}, the symbol for @var{slot} must be quoted. | 756 | @code{oset}, the symbol for @var{slot} must be quoted. |
| 757 | |||
| 758 | This is not a CLOS function, but is the obsolete setter for | ||
| 759 | @code{slot-value} used by the @code{setf} macro. It is therefore | ||
| 760 | recommended to use @w{@code{(setf (slot-value @var{object} @var{slot}) | ||
| 761 | @var{value})}} instead. | ||
| 755 | @end defun | 762 | @end defun |
| 756 | 763 | ||
| 757 | @defun slot-makeunbound object slot | 764 | @defun slot-makeunbound object slot |
| @@ -1072,7 +1079,7 @@ Return a string of the form @samp{#<object-class myobjname>} for @var{obj}. | |||
| 1072 | This should look like Lisp symbols from other parts of Emacs such as | 1079 | This should look like Lisp symbols from other parts of Emacs such as |
| 1073 | buffers and processes, and is shorter and cleaner than printing the | 1080 | buffers and processes, and is shorter and cleaner than printing the |
| 1074 | object's record. It is more useful to use @code{object-print} to get | 1081 | object's record. It is more useful to use @code{object-print} to get |
| 1075 | and object's print form, as this allows the object to add extra display | 1082 | an object's print form, as this allows the object to add extra display |
| 1076 | information into the symbol. | 1083 | information into the symbol. |
| 1077 | @end defun | 1084 | @end defun |
| 1078 | 1085 | ||
| @@ -1227,7 +1234,7 @@ objects on top of records, and thus everything is technically visible, | |||
| 1227 | some functions have been provided. None of these functions are a part | 1234 | some functions have been provided. None of these functions are a part |
| 1228 | of CLOS. | 1235 | of CLOS. |
| 1229 | 1236 | ||
| 1230 | @defun object-slots obj | 1237 | @defun eieio-class-slots obj |
| 1231 | Return the list of public slots for @var{obj}. | 1238 | Return the list of public slots for @var{obj}. |
| 1232 | @end defun | 1239 | @end defun |
| 1233 | 1240 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6298244c399..6fc80594125 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -3302,7 +3302,7 @@ If optional arg BUTTON is non-nil, describe its associated package." | |||
| 3302 | '(("install," "delete," "unmark," ("execute" . 1)) | 3302 | '(("install," "delete," "unmark," ("execute" . 1)) |
| 3303 | ("next," "previous") | 3303 | ("next," "previous") |
| 3304 | ("Hide-package," "(-toggle-hidden") | 3304 | ("Hide-package," "(-toggle-hidden") |
| 3305 | ("refresh-contents," "g-redisplay," "filter," "help"))) | 3305 | ("g-refresh-contents," "/-filter," "help"))) |
| 3306 | 3306 | ||
| 3307 | (defun package--prettify-quick-help-key (desc) | 3307 | (defun package--prettify-quick-help-key (desc) |
| 3308 | "Prettify DESC to be displayed as a help menu." | 3308 | "Prettify DESC to be displayed as a help menu." |
| @@ -3310,7 +3310,7 @@ If optional arg BUTTON is non-nil, describe its associated package." | |||
| 3310 | (if (listp (cdr desc)) | 3310 | (if (listp (cdr desc)) |
| 3311 | (mapconcat #'package--prettify-quick-help-key desc " ") | 3311 | (mapconcat #'package--prettify-quick-help-key desc " ") |
| 3312 | (let ((place (cdr desc)) | 3312 | (let ((place (cdr desc)) |
| 3313 | (out (car desc))) | 3313 | (out (copy-sequence (car desc)))) |
| 3314 | (add-text-properties place (1+ place) | 3314 | (add-text-properties place (1+ place) |
| 3315 | '(face (bold font-lock-warning-face)) | 3315 | '(face (bold font-lock-warning-face)) |
| 3316 | out) | 3316 | out) |
| @@ -3790,6 +3790,9 @@ packages." | |||
| 3790 | (package--has-keyword-p pkg-desc keyword)) | 3790 | (package--has-keyword-p pkg-desc keyword)) |
| 3791 | (concat "keyword:" (string-join keyword ","))))) | 3791 | (concat "keyword:" (string-join keyword ","))))) |
| 3792 | 3792 | ||
| 3793 | (define-obsolete-function-alias | ||
| 3794 | 'package-menu-filter #'package-menu-filter-by-keyword "27.1") | ||
| 3795 | |||
| 3793 | (defun package-menu-filter-by-name (name) | 3796 | (defun package-menu-filter-by-name (name) |
| 3794 | "Filter the \"*Packages*\" buffer by NAME regexp. | 3797 | "Filter the \"*Packages*\" buffer by NAME regexp. |
| 3795 | Display only packages with name that matches regexp NAME. | 3798 | Display only packages with name that matches regexp NAME. |
diff --git a/lisp/format-spec.el b/lisp/format-spec.el index f418cea4259..9278bd74c42 100644 --- a/lisp/format-spec.el +++ b/lisp/format-spec.el | |||
| @@ -29,35 +29,46 @@ | |||
| 29 | 29 | ||
| 30 | (defun format-spec (format specification &optional only-present) | 30 | (defun format-spec (format specification &optional only-present) |
| 31 | "Return a string based on FORMAT and SPECIFICATION. | 31 | "Return a string based on FORMAT and SPECIFICATION. |
| 32 | FORMAT is a string containing `format'-like specs like \"su - %u %k\", | 32 | FORMAT is a string containing `format'-like specs like \"su - %u %k\". |
| 33 | while SPECIFICATION is an alist mapping from format spec characters | 33 | SPECIFICATION is an alist mapping format specification characters |
| 34 | to values. | 34 | to their substitutions. |
| 35 | 35 | ||
| 36 | For instance: | 36 | For instance: |
| 37 | 37 | ||
| 38 | (format-spec \"su - %u %l\" | 38 | (format-spec \"su - %u %l\" |
| 39 | `((?u . ,(user-login-name)) | 39 | \\=`((?u . ,(user-login-name)) |
| 40 | (?l . \"ls\"))) | 40 | (?l . \"ls\"))) |
| 41 | 41 | ||
| 42 | Each format spec can have modifiers, where \"%<010b\" means \"if | 42 | Each %-spec may contain optional flag and width modifiers, as |
| 43 | the expansion is shorter than ten characters, zero-pad it, and if | 43 | follows: |
| 44 | it's longer, chop off characters from the left side\". | ||
| 45 | 44 | ||
| 46 | The following modifiers are allowed: | 45 | %<flags><width>character |
| 47 | 46 | ||
| 48 | * 0: Use zero-padding. | 47 | The following flags are allowed: |
| 49 | * -: Pad to the right. | ||
| 50 | * ^: Upper-case the expansion. | ||
| 51 | * _: Lower-case the expansion. | ||
| 52 | * <: Limit the length by removing chars from the left. | ||
| 53 | * >: Limit the length by removing chars from the right. | ||
| 54 | 48 | ||
| 55 | Any text properties on a %-spec itself are propagated to the text | 49 | * 0: Pad to the width, if given, with zeros instead of spaces. |
| 56 | that it generates. | 50 | * -: Pad to the width, if given, on the right instead of the left. |
| 51 | * <: Truncate to the width, if given, on the left. | ||
| 52 | * >: Truncate to the width, if given, on the right. | ||
| 53 | * ^: Convert to upper case. | ||
| 54 | * _: Convert to lower case. | ||
| 57 | 55 | ||
| 58 | If ONLY-PRESENT, format spec characters not present in | 56 | The width modifier behaves like the corresponding one in `format' |
| 59 | SPECIFICATION are ignored, and the \"%\" characters are left | 57 | when applied to %s. |
| 60 | where they are, including \"%%\" strings." | 58 | |
| 59 | For example, \"%<010b\" means \"substitute into the output the | ||
| 60 | value associated with ?b in SPECIFICATION, either padding it with | ||
| 61 | leading zeros or truncating leading characters until it's ten | ||
| 62 | characters wide\". | ||
| 63 | |||
| 64 | Any text properties of FORMAT are copied to the result, with any | ||
| 65 | text properties of a %-spec itself copied to its substitution. | ||
| 66 | |||
| 67 | ONLY-PRESENT indicates how to handle %-spec characters not | ||
| 68 | present in SPECIFICATION. If it is nil or omitted, emit an | ||
| 69 | error; otherwise leave those %-specs and any occurrences of | ||
| 70 | \"%%\" in FORMAT verbatim in the result, including their text | ||
| 71 | properties, if any." | ||
| 61 | (with-temp-buffer | 72 | (with-temp-buffer |
| 62 | (insert format) | 73 | (insert format) |
| 63 | (goto-char (point-min)) | 74 | (goto-char (point-min)) |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 0277524a8c6..722969c21ba 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -663,7 +663,7 @@ A non-nil `specs' arg must be an alist with `nnir-query-spec' and | |||
| 663 | (let ((backend (car (gnus-server-to-method server)))) | 663 | (let ((backend (car (gnus-server-to-method server)))) |
| 664 | (if backend | 664 | (if backend |
| 665 | (nnoo-change-server backend server definitions) | 665 | (nnoo-change-server backend server definitions) |
| 666 | (add-hook 'gnus-summary-prepared-hook 'nnir-mode) | 666 | (add-hook 'gnus-summary-generate-hook 'nnir-mode) |
| 667 | (nnoo-change-server 'nnir server definitions)))) | 667 | (nnoo-change-server 'nnir server definitions)))) |
| 668 | 668 | ||
| 669 | (deffoo nnir-request-group (group &optional server dont-check _info) | 669 | (deffoo nnir-request-group (group &optional server dont-check _info) |
| @@ -1850,8 +1850,11 @@ is also searched." | |||
| 1850 | 1850 | ||
| 1851 | (defun nnir-mode () | 1851 | (defun nnir-mode () |
| 1852 | (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir) | 1852 | (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir) |
| 1853 | (setq gnus-summary-line-format | 1853 | (when (and nnir-summary-line-format |
| 1854 | (or nnir-summary-line-format gnus-summary-line-format)) | 1854 | (not (string= nnir-summary-line-format |
| 1855 | gnus-summary-line-format))) | ||
| 1856 | (setq gnus-summary-line-format nnir-summary-line-format) | ||
| 1857 | (gnus-update-format-specifications nil 'summary)) | ||
| 1855 | (when (bound-and-true-p gnus-registry-enabled) | 1858 | (when (bound-and-true-p gnus-registry-enabled) |
| 1856 | (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t) | 1859 | (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t) |
| 1857 | (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t) | 1860 | (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t) |
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index c12f3901f09..60ef0247bae 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el | |||
| @@ -330,7 +330,10 @@ if that doesn't produce a completion match." | |||
| 330 | icomplete-hide-common-prefix nil | 330 | icomplete-hide-common-prefix nil |
| 331 | completion-styles '(flex) | 331 | completion-styles '(flex) |
| 332 | completion-flex-nospace nil | 332 | completion-flex-nospace nil |
| 333 | completion-category-defaults nil))) | 333 | completion-category-defaults nil |
| 334 | completion-ignore-case t | ||
| 335 | read-buffer-completion-ignore-case t | ||
| 336 | read-file-name-completion-ignore-case t))) | ||
| 334 | 337 | ||
| 335 | ;;;###autoload | 338 | ;;;###autoload |
| 336 | (define-minor-mode fido-mode | 339 | (define-minor-mode fido-mode |
diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el index e7a12675905..a3a6f3fdd94 100644 --- a/lisp/language/cyril-util.el +++ b/lisp/language/cyril-util.el | |||
| @@ -152,6 +152,7 @@ If the argument is nil, we return the display table to its standard state." | |||
| 152 | (aset standard-display-table ?љ [?l ?j]) | 152 | (aset standard-display-table ?љ [?l ?j]) |
| 153 | (aset standard-display-table ?њ [?n ?j]) | 153 | (aset standard-display-table ?њ [?n ?j]) |
| 154 | (aset standard-display-table ?џ [?d ?z]) | 154 | (aset standard-display-table ?џ [?d ?z]) |
| 155 | (aset standard-display-table ?ґ [?g]) | ||
| 155 | 156 | ||
| 156 | (aset standard-display-table ?Є [?Y ?e]) | 157 | (aset standard-display-table ?Є [?Y ?e]) |
| 157 | (aset standard-display-table ?Ї [?Y ?i]) | 158 | (aset standard-display-table ?Ї [?Y ?i]) |
| @@ -166,6 +167,7 @@ If the argument is nil, we return the display table to its standard state." | |||
| 166 | (aset standard-display-table ?Љ [?L ?j]) | 167 | (aset standard-display-table ?Љ [?L ?j]) |
| 167 | (aset standard-display-table ?Њ [?N ?j]) | 168 | (aset standard-display-table ?Њ [?N ?j]) |
| 168 | (aset standard-display-table ?Џ [?D ?j]) | 169 | (aset standard-display-table ?Џ [?D ?j]) |
| 170 | (aset standard-display-table ?Ґ [?G]) | ||
| 169 | 171 | ||
| 170 | (when (equal cyrillic-language "Bulgarian") | 172 | (when (equal cyrillic-language "Bulgarian") |
| 171 | (aset standard-display-table ?щ [?s ?h ?t]) | 173 | (aset standard-display-table ?щ [?s ?h ?t]) |
| @@ -182,7 +184,9 @@ If the argument is nil, we return the display table to its standard state." | |||
| 182 | (aset standard-display-table ?й [?i]) | 184 | (aset standard-display-table ?й [?i]) |
| 183 | (aset standard-display-table ?Й [?Y]) | 185 | (aset standard-display-table ?Й [?Y]) |
| 184 | (aset standard-display-table ?ю [?i ?u]) | 186 | (aset standard-display-table ?ю [?i ?u]) |
| 185 | (aset standard-display-table ?я [?i ?a])))) | 187 | (aset standard-display-table ?я [?i ?a]) |
| 188 | (aset standard-display-table ?г [?h]) | ||
| 189 | (aset standard-display-table ?Г [?H])))) | ||
| 186 | 190 | ||
| 187 | ;; | 191 | ;; |
| 188 | (provide 'cyril-util) | 192 | (provide 'cyril-util) |
diff --git a/src/hbfont.c b/src/hbfont.c index 576c5fe7f60..4b3f64ef504 100644 --- a/src/hbfont.c +++ b/src/hbfont.c | |||
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 26 | #include "composite.h" | 26 | #include "composite.h" |
| 27 | #include "font.h" | 27 | #include "font.h" |
| 28 | #include "dispextern.h" | 28 | #include "dispextern.h" |
| 29 | #include "buffer.h" | ||
| 29 | 30 | ||
| 30 | #ifdef HAVE_NTGUI | 31 | #ifdef HAVE_NTGUI |
| 31 | 32 | ||
| @@ -438,7 +439,11 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 438 | 439 | ||
| 439 | /* If the caller didn't provide a meaningful DIRECTION, let HarfBuzz | 440 | /* If the caller didn't provide a meaningful DIRECTION, let HarfBuzz |
| 440 | guess it. */ | 441 | guess it. */ |
| 441 | if (!NILP (direction)) | 442 | if (!NILP (direction) |
| 443 | /* If they bind bidi-display-reordering to nil, the DIRECTION | ||
| 444 | they provide is meaningless, and we should let HarfBuzz guess | ||
| 445 | the real direction. */ | ||
| 446 | && !NILP (BVAR (current_buffer, bidi_display_reordering))) | ||
| 442 | { | 447 | { |
| 443 | hb_direction_t dir = HB_DIRECTION_LTR; | 448 | hb_direction_t dir = HB_DIRECTION_LTR; |
| 444 | if (EQ (direction, QL2R)) | 449 | if (EQ (direction, QL2R)) |
diff --git a/src/xdisp.c b/src/xdisp.c index 52f6ab8e709..bd0711471a2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10449,33 +10449,43 @@ in_display_vector_p (struct it *it) | |||
| 10449 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, | 10449 | DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, |
| 10450 | doc: /* Return the size of the text of WINDOW's buffer in pixels. | 10450 | doc: /* Return the size of the text of WINDOW's buffer in pixels. |
| 10451 | WINDOW must be a live window and defaults to the selected one. The | 10451 | WINDOW must be a live window and defaults to the selected one. The |
| 10452 | return value is a cons of the maximum pixel-width of any text line and | 10452 | return value is a cons of the maximum pixel-width of any text line |
| 10453 | the maximum pixel-height of all text lines. | 10453 | and the pixel-height of all the text lines in the accessible portion |
| 10454 | of buffer text. | ||
| 10455 | |||
| 10456 | This function exists to allow Lisp programs to adjust the dimensions | ||
| 10457 | of WINDOW to the buffer text it needs to display. | ||
| 10454 | 10458 | ||
| 10455 | The optional argument FROM, if non-nil, specifies the first text | 10459 | The optional argument FROM, if non-nil, specifies the first text |
| 10456 | position and defaults to the minimum accessible position of the buffer. | 10460 | position to consider, and defaults to the minimum accessible position |
| 10457 | If FROM is t, use the minimum accessible position that starts a | 10461 | of the buffer. If FROM is t, it stands for the minimum accessible |
| 10458 | non-empty line. TO, if non-nil, specifies the last text position and | 10462 | position that starts a non-empty line. TO, if non-nil, specifies the |
| 10459 | defaults to the maximum accessible position of the buffer. If TO is t, | 10463 | last text position and defaults to the maximum accessible position of |
| 10460 | use the maximum accessible position that ends a non-empty line. | 10464 | the buffer. If TO is t, it stands for the maximum accessible position |
| 10461 | 10465 | that ends a non-empty line. | |
| 10462 | The optional argument X-LIMIT, if non-nil, specifies the maximum text | 10466 | |
| 10463 | width that can be returned. X-LIMIT nil or omitted, means to use the | 10467 | The optional argument X-LIMIT, if non-nil, specifies the maximum X |
| 10464 | pixel-width of WINDOW's body; use this if you want to know how high | 10468 | coordinate beyond which the text should be ignored. It is therefore |
| 10465 | WINDOW should be become in order to fit all of its buffer's text with | 10469 | also the maximum width that the function can return. X-LIMIT nil or |
| 10466 | the width of WINDOW unaltered. Use the maximum width WINDOW may assume | 10470 | omitted means to use the pixel-width of WINDOW's body. This default |
| 10467 | if you intend to change WINDOW's width. In any case, text whose | 10471 | means text of truncated lines wider than the window will be ignored; |
| 10468 | x-coordinate is beyond X-LIMIT is ignored. Since calculating the width | 10472 | specify a large value for X-LIMIT if lines are truncated and you need |
| 10469 | of long lines can take some time, it's always a good idea to make this | 10473 | to account for the truncated text. Use nil for X-LIMIT if you want to |
| 10470 | argument as small as possible; in particular, if the buffer contains | 10474 | know how high WINDOW should become in order to fit all of its buffer's |
| 10471 | long lines that shall be truncated anyway. | 10475 | text with the width of WINDOW unaltered. Use the maximum width WINDOW |
| 10472 | 10476 | may assume if you intend to change WINDOW's width. Since calculating | |
| 10473 | The optional argument Y-LIMIT, if non-nil, specifies the maximum text | 10477 | the width of long lines can take some time, it's always a good idea to |
| 10474 | height (excluding the height of the mode- or header-line, if any) that | 10478 | make this argument as small as possible; in particular, if the buffer |
| 10475 | can be returned. Text lines whose y-coordinate is beyond Y-LIMIT are | 10479 | contains long lines that shall be truncated anyway. |
| 10476 | ignored. Since calculating the text height of a large buffer can take | 10480 | |
| 10477 | some time, it makes sense to specify this argument if the size of the | 10481 | The optional argument Y-LIMIT, if non-nil, specifies the maximum Y |
| 10478 | buffer is large or unknown. | 10482 | coordinate beyond which the text is to be ignored; it is therefore |
| 10483 | also the maxcomp height that the function can return (excluding the | ||
| 10484 | height of the mode- or header-line, if any). Y-LIMIT nil or omitted | ||
| 10485 | means consider all of the accessible portion of buffer text up to the | ||
| 10486 | position specified by TO. Since calculating the text height of a | ||
| 10487 | large buffer can take some time, it makes sense to specify this | ||
| 10488 | argument if the size of the buffer is large or unknown. | ||
| 10479 | 10489 | ||
| 10480 | Optional argument MODE-AND-HEADER-LINE nil or omitted means do not | 10490 | Optional argument MODE-AND-HEADER-LINE nil or omitted means do not |
| 10481 | include the height of the mode- or header-line of WINDOW in the return | 10491 | include the height of the mode- or header-line of WINDOW in the return |
diff --git a/test/lisp/battery-tests.el b/test/lisp/battery-tests.el new file mode 100644 index 00000000000..052ae49a800 --- /dev/null +++ b/test/lisp/battery-tests.el | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | ;;; battery-tests.el --- tests for battery.el -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2020 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'battery) | ||
| 23 | |||
| 24 | (ert-deftest battery-linux-proc-apm-regexp () | ||
| 25 | "Test `battery-linux-proc-apm-regexp'." | ||
| 26 | (let ((str "1.16 1.2 0x07 0x01 0xff 0x80 -1% -1 ?")) | ||
| 27 | (should (string-match battery-linux-proc-apm-regexp str)) | ||
| 28 | (should (equal (match-string 0 str) str)) | ||
| 29 | (should (equal (match-string 1 str) "1.16")) | ||
| 30 | (should (equal (match-string 2 str) "1.2")) | ||
| 31 | (should (equal (match-string 3 str) "07")) | ||
| 32 | (should (equal (match-string 4 str) "01")) | ||
| 33 | (should (equal (match-string 5 str) "ff")) | ||
| 34 | (should (equal (match-string 6 str) "80")) | ||
| 35 | (should (equal (match-string 7 str) "-1")) | ||
| 36 | (should (equal (match-string 8 str) "-1")) | ||
| 37 | (should (equal (match-string 9 str) "?"))) | ||
| 38 | (let ((str "1.16 1.2 0x03 0x00 0x00 0x01 99% 1792 min")) | ||
| 39 | (should (string-match battery-linux-proc-apm-regexp str)) | ||
| 40 | (should (equal (match-string 0 str) str)) | ||
| 41 | (should (equal (match-string 1 str) "1.16")) | ||
| 42 | (should (equal (match-string 2 str) "1.2")) | ||
| 43 | (should (equal (match-string 3 str) "03")) | ||
| 44 | (should (equal (match-string 4 str) "00")) | ||
| 45 | (should (equal (match-string 5 str) "00")) | ||
| 46 | (should (equal (match-string 6 str) "01")) | ||
| 47 | (should (equal (match-string 7 str) "99")) | ||
| 48 | (should (equal (match-string 8 str) "1792")) | ||
| 49 | (should (equal (match-string 9 str) "min")))) | ||
| 50 | |||
| 51 | (ert-deftest battery-format () | ||
| 52 | "Test `battery-format'." | ||
| 53 | (should (equal (battery-format "" ()) "")) | ||
| 54 | (should (equal (battery-format "" '((?b . "-"))) "")) | ||
| 55 | (should (equal (battery-format "%a%b%p%%" '((?b . "-") (?p . "99"))) | ||
| 56 | "-99%"))) | ||
| 57 | |||
| 58 | ;;; battery-tests.el ends here | ||
diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el index d9f1cb9ec43..51c9884ddc8 100644 --- a/test/lisp/emacs-lisp/cl-generic-tests.el +++ b/test/lisp/emacs-lisp/cl-generic-tests.el | |||
| @@ -23,9 +23,15 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (eval-when-compile (require 'ert)) ;Don't indirectly require cl-lib at run-time. | ||
| 27 | (require 'cl-generic) | 26 | (require 'cl-generic) |
| 28 | 27 | ||
| 28 | ;; Don't indirectly require `cl-lib' at run-time. | ||
| 29 | (eval-when-compile (require 'ert)) | ||
| 30 | (declare-function ert--should-signal-hook "ert") | ||
| 31 | (declare-function ert--signal-should-execution "ert") | ||
| 32 | (declare-function ert-fail "ert") | ||
| 33 | (declare-function ert-set-test "ert") | ||
| 34 | |||
| 29 | (fmakunbound 'cl--generic-1) | 35 | (fmakunbound 'cl--generic-1) |
| 30 | (cl-defgeneric cl--generic-1 (x y)) | 36 | (cl-defgeneric cl--generic-1 (x y)) |
| 31 | (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") | 37 | (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") |
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 732bf5e061f..90714af3061 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el | |||
| @@ -267,6 +267,9 @@ Must called from within a `tar-mode' buffer." | |||
| 267 | (should (package-installed-p 'simple-single)) | 267 | (should (package-installed-p 'simple-single)) |
| 268 | (should (package-installed-p 'simple-depend)))) | 268 | (should (package-installed-p 'simple-depend)))) |
| 269 | 269 | ||
| 270 | (declare-function macro-problem-func "macro-problem" ()) | ||
| 271 | (declare-function macro-problem-10-and-90 "macro-problem" ()) | ||
| 272 | |||
| 270 | (ert-deftest package-test-macro-compilation () | 273 | (ert-deftest package-test-macro-compilation () |
| 271 | "Install a package which includes a dependency." | 274 | "Install a package which includes a dependency." |
| 272 | (with-package-test (:basedir "package-resources") | 275 | (with-package-test (:basedir "package-resources") |
| @@ -616,6 +619,8 @@ Must called from within a `tar-mode' buffer." | |||
| 616 | (let ((process-environment | 619 | (let ((process-environment |
| 617 | (cons (concat "HOME=" homedir) | 620 | (cons (concat "HOME=" homedir) |
| 618 | process-environment))) | 621 | process-environment))) |
| 622 | (require 'epg-config) | ||
| 623 | (defvar epg-config--program-alist) | ||
| 619 | (epg-find-configuration | 624 | (epg-find-configuration |
| 620 | 'OpenPGP nil | 625 | 'OpenPGP nil |
| 621 | ;; By default we require gpg2 2.1+ due to some | 626 | ;; By default we require gpg2 2.1+ due to some |
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index ce8d728833d..16a04647723 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (require 'ert) | 28 | (require 'ert) |
| 29 | (require 'esh-mode) | ||
| 29 | (require 'eshell) | 30 | (require 'eshell) |
| 30 | 31 | ||
| 31 | (defmacro with-temp-eshell (&rest body) | 32 | (defmacro with-temp-eshell (&rest body) |
diff --git a/test/lisp/image/exif-tests.el b/test/lisp/image/exif-tests.el index 8a2231106f0..9e5da46b508 100644 --- a/test/lisp/image/exif-tests.el +++ b/test/lisp/image/exif-tests.el | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'exif) | 23 | (require 'exif) |
| 24 | (require 'seq) | ||
| 25 | 24 | ||
| 26 | (defun test-image-file (name) | 25 | (defun test-image-file (name) |
| 27 | (expand-file-name | 26 | (expand-file-name |
| @@ -49,7 +48,7 @@ | |||
| 49 | (should (equal (exif-elem exif 'artist) "z")))) | 48 | (should (equal (exif-elem exif 'artist) "z")))) |
| 50 | 49 | ||
| 51 | (ert-deftest test-exit-direct-ascii-value () | 50 | (ert-deftest test-exit-direct-ascii-value () |
| 52 | (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0)) | 51 | (should (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0))) |
| 53 | (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0))) | 52 | (should (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0)))) |
| 54 | 53 | ||
| 55 | ;;; exif-tests.el ends here | 54 | ;;; exif-tests.el ends here |
diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 283b2e1b32b..9277d0162e8 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el | |||
| @@ -96,6 +96,9 @@ At EOF: | |||
| 96 | (ccl-dump prog-pgg-code) | 96 | (ccl-dump prog-pgg-code) |
| 97 | (should (equal (buffer-string) prog-pgg-dump)))) | 97 | (should (equal (buffer-string) prog-pgg-dump)))) |
| 98 | 98 | ||
| 99 | (defvar pgg-parse-crc24) | ||
| 100 | (declare-function pgg-parse-crc24-string "pgg-parse" (string)) | ||
| 101 | |||
| 99 | (ert-deftest pgg-parse-crc24 () | 102 | (ert-deftest pgg-parse-crc24 () |
| 100 | ;; Compiler | 103 | ;; Compiler |
| 101 | (require 'pgg) | 104 | (require 'pgg) |
diff --git a/test/lisp/mail/footnote-tests.el b/test/lisp/mail/footnote-tests.el index 458964c306e..79f48072391 100644 --- a/test/lisp/mail/footnote-tests.el +++ b/test/lisp/mail/footnote-tests.el | |||
| @@ -18,12 +18,10 @@ | |||
| 18 | ;; You should have received a copy of the GNU General Public License | 18 | ;; You should have received a copy of the GNU General Public License |
| 19 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | 19 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | 20 | ||
| 21 | ;;; Commentary: | ||
| 22 | |||
| 23 | ;; | ||
| 24 | |||
| 25 | ;;; Code: | 21 | ;;; Code: |
| 26 | 22 | ||
| 23 | (require 'footnote) | ||
| 24 | |||
| 27 | (ert-deftest footnote-tests-same-place () | 25 | (ert-deftest footnote-tests-same-place () |
| 28 | (with-temp-buffer | 26 | (with-temp-buffer |
| 29 | (footnote-mode 1) | 27 | (footnote-mode 1) |
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index b793f7389b4..2ba00656862 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el | |||
| @@ -598,16 +598,17 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 598 | ;; Define some mode-local overloadable/overridden functions for xref to find | 598 | ;; Define some mode-local overloadable/overridden functions for xref to find |
| 599 | (require 'mode-local) | 599 | (require 'mode-local) |
| 600 | 600 | ||
| 601 | (declare-function xref-elisp-overloadable-no-methods-default "elisp-mode-tests") | ||
| 602 | (declare-function xref-elisp-overloadable-no-default-default "elisp-mode-tests") | ||
| 603 | |||
| 601 | (define-overloadable-function xref-elisp-overloadable-no-methods () | 604 | (define-overloadable-function xref-elisp-overloadable-no-methods () |
| 602 | "doc string overloadable no-methods") | 605 | "doc string overloadable no-methods") |
| 603 | 606 | ||
| 604 | (define-overloadable-function xref-elisp-overloadable-no-default () | 607 | (define-overloadable-function xref-elisp-overloadable-no-default () |
| 605 | "doc string overloadable no-default") | 608 | "doc string overloadable no-default") |
| 606 | 609 | ||
| 607 | ;; FIXME: byte compiler complains about unused lexical arguments | ||
| 608 | ;; generated by this macro. | ||
| 609 | (define-mode-local-override xref-elisp-overloadable-no-default c-mode | 610 | (define-mode-local-override xref-elisp-overloadable-no-default c-mode |
| 610 | (start end &optional nonterminal depth returnonerror) | 611 | (_start _end &optional _nonterminal _depth _returnonerror) |
| 611 | "doc string overloadable no-default c-mode." | 612 | "doc string overloadable no-default c-mode." |
| 612 | "result overloadable no-default c-mode.") | 613 | "result overloadable no-default c-mode.") |
| 613 | 614 | ||
| @@ -616,7 +617,7 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 616 | "result overloadable co-located-default.") | 617 | "result overloadable co-located-default.") |
| 617 | 618 | ||
| 618 | (define-mode-local-override xref-elisp-overloadable-co-located-default c-mode | 619 | (define-mode-local-override xref-elisp-overloadable-co-located-default c-mode |
| 619 | (start end &optional nonterminal depth returnonerror) | 620 | (_start _end &optional _nonterminal _depth _returnonerror) |
| 620 | "doc string overloadable co-located-default c-mode." | 621 | "doc string overloadable co-located-default c-mode." |
| 621 | "result overloadable co-located-default c-mode.") | 622 | "result overloadable co-located-default c-mode.") |
| 622 | 623 | ||
| @@ -628,7 +629,7 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 628 | "result overloadable separate-default.") | 629 | "result overloadable separate-default.") |
| 629 | 630 | ||
| 630 | (define-mode-local-override xref-elisp-overloadable-separate-default c-mode | 631 | (define-mode-local-override xref-elisp-overloadable-separate-default c-mode |
| 631 | (start end &optional nonterminal depth returnonerror) | 632 | (_start _end &optional _nonterminal _depth _returnonerror) |
| 632 | "doc string overloadable separate-default c-mode." | 633 | "doc string overloadable separate-default c-mode." |
| 633 | "result overloadable separate-default c-mode.") | 634 | "result overloadable separate-default c-mode.") |
| 634 | 635 | ||
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index d6f89341bed..65ed76bfb5d 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el | |||
| @@ -193,7 +193,7 @@ Perform ACTION and validate results" | |||
| 193 | "Add a product that already exists." | 193 | "Add a product that already exists." |
| 194 | 194 | ||
| 195 | (sql-test-product-feature-harness | 195 | (sql-test-product-feature-harness |
| 196 | (should-error (sql-add-feature 'a "Aaa")) | 196 | (should-error (sql-add-product 'a "Aaa")) |
| 197 | (should (equal (pp-to-string (assoc 'a sql-product-alist)) | 197 | (should (equal (pp-to-string (assoc 'a sql-product-alist)) |
| 198 | "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n")))) | 198 | "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n")))) |
| 199 | 199 | ||
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 88be74fd2cc..4adcacb279b 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el | |||
| @@ -758,8 +758,7 @@ See Bug#21722." | |||
| 758 | 758 | ||
| 759 | (defmacro with-shell-command-dont-erase-buffer (str output-buffer-is-current &rest body) | 759 | (defmacro with-shell-command-dont-erase-buffer (str output-buffer-is-current &rest body) |
| 760 | (declare (debug (sexp form body)) (indent 2)) | 760 | (declare (debug (sexp form body)) (indent 2)) |
| 761 | (let ((expected (make-symbol "expected")) | 761 | (let ((command (make-symbol "command")) |
| 762 | (command (make-symbol "command")) | ||
| 763 | (caller-buf (make-symbol "caller-buf")) | 762 | (caller-buf (make-symbol "caller-buf")) |
| 764 | (output-buf (make-symbol "output-buf"))) | 763 | (output-buf (make-symbol "output-buf"))) |
| 765 | `(let* ((,caller-buf (generate-new-buffer "caller-buf")) | 764 | `(let* ((,caller-buf (generate-new-buffer "caller-buf")) |
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el index baa547758ef..5b01c54cf24 100644 --- a/test/lisp/wdired-tests.el +++ b/test/lisp/wdired-tests.el | |||
| @@ -129,6 +129,8 @@ wdired-mode." | |||
| 129 | (delete-directory test-dir t))))) | 129 | (delete-directory test-dir t))))) |
| 130 | 130 | ||
| 131 | (defvar server-socket-dir) | 131 | (defvar server-socket-dir) |
| 132 | (declare-function dired-smart-shell-command "dired-x" | ||
| 133 | (command &optional output-buffer error-buffer)) | ||
| 132 | 134 | ||
| 133 | (ert-deftest wdired-test-bug34915 () | 135 | (ert-deftest wdired-test-bug34915 () |
| 134 | "Test editing when dired-listing-switches includes -F. | 136 | "Test editing when dired-listing-switches includes -F. |
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 6e9764625a9..0db66f97517 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'seq) | ||
| 23 | (eval-when-compile (require 'cl-lib)) | 24 | (eval-when-compile (require 'cl-lib)) |
| 24 | 25 | ||
| 25 | (ert-deftest overlay-modification-hooks-message-other-buf () | 26 | (ert-deftest overlay-modification-hooks-message-other-buf () |
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 3cebb3dfa57..ed092039078 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -174,7 +174,7 @@ most-positive-fixnum, which is just less than a power of 2.") | |||
| 174 | sum 1)) | 174 | sum 1)) |
| 175 | 175 | ||
| 176 | (defun test-bool-vector-bv-from-hex-string (desc) | 176 | (defun test-bool-vector-bv-from-hex-string (desc) |
| 177 | (let (bv nchars nibbles) | 177 | (let (bv nibbles) |
| 178 | (dolist (c (string-to-list desc)) | 178 | (dolist (c (string-to-list desc)) |
| 179 | (push (string-to-number | 179 | (push (string-to-number |
| 180 | (char-to-string c) | 180 | (char-to-string c) |
| @@ -244,9 +244,9 @@ comparing the subr with a much slower lisp implementation." | |||
| 244 | 244 | ||
| 245 | (defun test-bool-vector-apply-mock-op (mock a b c) | 245 | (defun test-bool-vector-apply-mock-op (mock a b c) |
| 246 | "Compute (slowly) the correct result of a bool-vector set operation." | 246 | "Compute (slowly) the correct result of a bool-vector set operation." |
| 247 | (let (changed nv) | 247 | (let (changed) |
| 248 | (cl-assert (eql (length b) (length c))) | 248 | (cl-assert (eql (length b) (length c))) |
| 249 | (if a (setf nv a) | 249 | (unless a |
| 250 | (setf a (make-bool-vector (length b) nil)) | 250 | (setf a (make-bool-vector (length b) nil)) |
| 251 | (setf changed t)) | 251 | (setf changed t)) |
| 252 | 252 | ||