diff options
| author | Helmut Eller | 2026-02-13 09:10:16 +0100 |
|---|---|---|
| committer | Helmut Eller | 2026-02-13 09:10:16 +0100 |
| commit | 91c9e9883488d715a30877dfd7641ef4b3c62658 (patch) | |
| tree | e2c4525147e443f86baf9d0144aeadec082d7564 /doc/lispref | |
| parent | 9a4a54af9192a6653164364c75721ee814ffb1e8 (diff) | |
| parent | f1fe4d46190263e164ccd1e066095d46a156297f (diff) | |
| download | emacs-feature/igc.tar.gz emacs-feature/igc.zip | |
Merge branch 'master' into feature/igcfeature/igc
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/commands.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 43 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 34 | ||||
| -rw-r--r-- | doc/lispref/functions.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 72 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 15 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 11 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 16 |
9 files changed, 173 insertions, 34 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index bd31798d431..0583179ed31 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -2778,12 +2778,12 @@ To test the signal handler, you can make Emacs send a signal to itself: | |||
| 2778 | @end smallexample | 2778 | @end smallexample |
| 2779 | 2779 | ||
| 2780 | @cindex @code{sleep-event} event | 2780 | @cindex @code{sleep-event} event |
| 2781 | @item (sleep-event @var{sleep-wake}) | 2781 | @item (sleep-event @var{state}) |
| 2782 | This event is injected when the device Emacs is running on enters or | 2782 | This event is injected when the device Emacs is running on is about to |
| 2783 | leaves the sleep state. A non-@code{nil} @var{sleep-wake} indicates | 2783 | enter a sleep state, or has just awoken from one. @var{state} will be |
| 2784 | entering the sleep state. | 2784 | the symbol @code{pre-sleep} or @code{post-wake}. |
| 2785 | 2785 | ||
| 2786 | This is implemented only on GNU/Linux. | 2786 | This is implemented on GNU/Linux, macOS, and MS-Windows. |
| 2787 | 2787 | ||
| 2788 | @cindex @code{language-change} event | 2788 | @cindex @code{language-change} event |
| 2789 | @item language-change | 2789 | @item language-change |
| @@ -4062,7 +4062,8 @@ definition to find the actual event. | |||
| 4062 | user signals like @code{sigusr1} are normally handled in this way. | 4062 | user signals like @code{sigusr1} are normally handled in this way. |
| 4063 | The keymap which defines how to handle special events---and which | 4063 | The keymap which defines how to handle special events---and which |
| 4064 | events are special---is in the variable @code{special-event-map} | 4064 | events are special---is in the variable @code{special-event-map} |
| 4065 | (@pxref{Controlling Active Maps}). | 4065 | (@pxref{Controlling Active Maps}). @xref{Misc Events}, for more details |
| 4066 | about these and other special events. | ||
| 4066 | 4067 | ||
| 4067 | @defun insert-special-event | 4068 | @defun insert-special-event |
| 4068 | @cindex inserting special events | 4069 | @cindex inserting special events |
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index a4776030cf2..85e13952cfb 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -1493,25 +1493,27 @@ argument: | |||
| 1493 | @subsection The @code{cond*} macro | 1493 | @subsection The @code{cond*} macro |
| 1494 | @findex cond*@r{, a macro} | 1494 | @findex cond*@r{, a macro} |
| 1495 | 1495 | ||
| 1496 | The @code{cond*} macro is an alternative to @code{pcase}, and supports | 1496 | You can use the @code{cond*} macro as an alternative to @code{pcase} |
| 1497 | the same functionality, but using syntax that some might find less | 1497 | if you find @code{pcase}'s syntax too cryptic. In addition, |
| 1498 | cryptic. | 1498 | @code{cond*} offers some new forms of control flow that aren't related |
| 1499 | to being an alternative to @code{pcase}. | ||
| 1499 | 1500 | ||
| 1500 | @defmac cond* &rest clauses | 1501 | @defmac cond* &rest clauses |
| 1501 | The @code{cond*} macro is an extended form of the traditional | 1502 | The @code{cond*} macro is an extended form of the traditional |
| 1502 | @code{cond}. A @code{cond*} expression contains a series of | 1503 | @code{cond}. A @code{cond*} expression contains a series of |
| 1503 | @var{clauses}, each of which can use @code{bind*} to specify binding | 1504 | @var{clauses}, each of which can use @code{bind*} or @code{bind-and*} to |
| 1504 | variables, use @code{match*} to specify matching a pattern as a | 1505 | specify binding variables, use @code{match*} or @code{pcase*} to specify |
| 1505 | condition, or specify an expression as a condition to evaluate as a | 1506 | matching a pattern as a condition, or specify an expression as a |
| 1506 | test. | 1507 | condition to evaluate as a test. |
| 1507 | 1508 | ||
| 1508 | Each clause normally has the form @w{@code{(@var{condition} | 1509 | Each clause normally has the form @w{@code{(@var{condition} |
| 1509 | @var{body}@dots{})}}. | 1510 | @var{body}@dots{})}}. |
| 1510 | 1511 | ||
| 1511 | @var{condition} can be a Lisp expression, as in @code{cond} | 1512 | @var{condition} can be a Lisp expression, as in @code{cond} |
| 1512 | (@pxref{Conditionals}). Or it can be @w{@code{(bind* | 1513 | (@pxref{Conditionals}). Or it can be @w{@code{(bind* |
| 1513 | @var{bindings}@dots{})}} or @w{@code{(match* @var{pattern} | 1514 | @var{bindings}@dots{})}}, @w{@code{(match* @var{pattern} @var{datum})}}, |
| 1514 | @var{datum})}}. | 1515 | @w{@code{(bind-and* @var{bindings}@dots{})}} or @w{@code{(pcase* |
| 1516 | @var{pattern} @var{datum})}} | ||
| 1515 | 1517 | ||
| 1516 | @findex bind* | 1518 | @findex bind* |
| 1517 | @code{(bind* @var{bindings}@dots{})} means to bind @var{bindings} (like | 1519 | @code{(bind* @var{bindings}@dots{})} means to bind @var{bindings} (like |
| @@ -1536,21 +1538,22 @@ bind to the parts of @var{datum} that they match. | |||
| 1536 | @code{(pcase* @var{pattern} @var{datum})} works in the same way except it | 1538 | @code{(pcase* @var{pattern} @var{datum})} works in the same way except it |
| 1537 | uses the Pcase syntax for @var{pattern}. | 1539 | uses the Pcase syntax for @var{pattern}. |
| 1538 | 1540 | ||
| 1539 | @code{bind*}, @code{match*}, and @code{pcase*} normally bind their bindings over | 1541 | @code{match*}, and @code{pcase*} normally bind their bindings over the |
| 1540 | the execution of the whole containing clause. However, if the clause is | 1542 | execution of the whole containing clause. However, if the clause is |
| 1541 | written to specify ``non-exit'', the clause's bindings cover the whole | 1543 | written to specify ``non-exit'' (see below), the clause's bindings cover |
| 1542 | rest of the @code{cond*}. | 1544 | the whole rest of the @code{cond*}. |
| 1543 | 1545 | ||
| 1544 | When a clause's condition is true, and it exits the @code{cond*} or is | 1546 | When a clause's condition is true, and it exits the @code{cond*} or is |
| 1545 | the last clause, the value of the last expression in the clause's body | 1547 | the last clause, the value of the last expression in the clause's body |
| 1546 | becomes the return value of the @code{cond*} construct. | 1548 | becomes the return value of the @code{cond*} construct. |
| 1547 | 1549 | ||
| 1548 | @subheading Non-exit clause | 1550 | @subheading Non-exit clauses |
| 1549 | 1551 | ||
| 1550 | If a clause has only one element, or if its first element is @code{t}, | 1552 | If a clause has only one element, or if its first element is @code{t} or |
| 1551 | or if it ends with the keyword @code{:non-exit}, then this clause never | 1553 | a @code{bind*} form, or if it ends with the keyword @code{:non-exit}, |
| 1552 | exits the @code{cond*} construct. Instead, control falls through to the | 1554 | then this clause never exits the @code{cond*} construct. Instead, |
| 1553 | next clause (if any). The bindings made in @var{condition} for the | 1555 | control falls through to the next clause (if any). Except for a |
| 1556 | @code{bind-and*} clause, the bindings made in @var{condition} for the | ||
| 1554 | @var{body} of the non-exit clause are passed along to the rest of the | 1557 | @var{body} of the non-exit clause are passed along to the rest of the |
| 1555 | clauses in this @code{cond*} construct. | 1558 | clauses in this @code{cond*} construct. |
| 1556 | 1559 | ||
| @@ -2344,7 +2347,9 @@ the other usual filtering mechanisms say it should. @xref{Error Debugging}. | |||
| 2344 | The macro @code{condition-case-unless-debug} provides another way to | 2347 | The macro @code{condition-case-unless-debug} provides another way to |
| 2345 | handle debugging of such forms. It behaves exactly like | 2348 | handle debugging of such forms. It behaves exactly like |
| 2346 | @code{condition-case}, unless the variable @code{debug-on-error} is | 2349 | @code{condition-case}, unless the variable @code{debug-on-error} is |
| 2347 | non-@code{nil}, in which case it does not handle any errors at all. | 2350 | non-@code{nil}, in which case it causes Emacs to enter the debugger |
| 2351 | before executing any applicable handler. (The applicable handler, if | ||
| 2352 | any, will still run when the debugger exits.) | ||
| 2348 | @end defmac | 2353 | @end defmac |
| 2349 | 2354 | ||
| 2350 | Once Emacs decides that a certain handler handles the error, it | 2355 | Once Emacs decides that a certain handler handles the error, it |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 4211b435db5..464c0badc36 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2243,6 +2243,9 @@ means hide the excess parts of @var{string} with a @code{display} text | |||
| 2243 | property (@pxref{Display Property}) showing the ellipsis, instead of | 2243 | property (@pxref{Display Property}) showing the ellipsis, instead of |
| 2244 | actually truncating the string. | 2244 | actually truncating the string. |
| 2245 | 2245 | ||
| 2246 | See also the function @code{truncate-string-pixelwise} for pixel-level | ||
| 2247 | resolution. | ||
| 2248 | |||
| 2246 | @example | 2249 | @example |
| 2247 | @group | 2250 | @group |
| 2248 | (truncate-string-to-width "\tab\t" 12 4) | 2251 | (truncate-string-to-width "\tab\t" 12 4) |
| @@ -2440,6 +2443,37 @@ non-@code{nil}, use any face remappings (@pxref{Face Remapping}) from | |||
| 2440 | that buffer when computing the width of @var{string}. | 2443 | that buffer when computing the width of @var{string}. |
| 2441 | @end defun | 2444 | @end defun |
| 2442 | 2445 | ||
| 2446 | @defun truncate-string-pixelwise string max-pixels &optional buffer ellipsis ellipsis-pixels | ||
| 2447 | This is a convenience function that uses @code{window-text-pixel-size} | ||
| 2448 | to truncate @var{string} to @var{max-pixels} pixels. Caveat: if you | ||
| 2449 | call this function to measure the width of a string with embedded | ||
| 2450 | newlines, it will then return the width of the widest substring that | ||
| 2451 | does not include newlines. The meaning of this result is the widest | ||
| 2452 | line taken by the string if inserted into a buffer. If @var{buffer} is | ||
| 2453 | non-@code{nil}, use any face remappings (@pxref{Face Remapping}) from | ||
| 2454 | that buffer when computing the width of @var{string}. | ||
| 2455 | |||
| 2456 | If @var{ellipsis} is non-@code{nil}, it should be a string which will | ||
| 2457 | replace the end of @var{string} when it is truncated. In this case, | ||
| 2458 | more characters will be removed from @var{string} to free enough space | ||
| 2459 | for @var{ellipsis} to fit within @var{max-pixels} pixels. However, if | ||
| 2460 | the pixel width of @var{string} is less than the pixel width of | ||
| 2461 | @var{ellipsis}, @var{ellipsis} will not be appended to the result. If | ||
| 2462 | @var{ellipsis} is non-@code{nil} and not a string, it stands for the | ||
| 2463 | value returned by the function @code{truncate-string-ellipsis}, | ||
| 2464 | described above. | ||
| 2465 | |||
| 2466 | If @var{ellipsis-pixels} is non-@code{nil} and @var{ellipsis} is | ||
| 2467 | non-@code{nil}, it should be the number of pixels of @var{ellipsis} that | ||
| 2468 | you should precompute using @code{string-pixel-width}, specifying the | ||
| 2469 | same buffer. This is useful to avoid the cost of recomputing this value | ||
| 2470 | repeatedly when you have many strings to truncate using the same | ||
| 2471 | ellipsis string. | ||
| 2472 | |||
| 2473 | See also the function @code{truncate-string-to-width} for | ||
| 2474 | character-level resolution. | ||
| 2475 | @end defun | ||
| 2476 | |||
| 2443 | @defun line-pixel-height | 2477 | @defun line-pixel-height |
| 2444 | This function returns the height in pixels of the line at point in the | 2478 | This function returns the height in pixels of the line at point in the |
| 2445 | selected window. The value includes the line spacing of the line | 2479 | selected window. The value includes the line spacing of the line |
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index c64ec3ea715..5444cea7fa9 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi | |||
| @@ -674,6 +674,7 @@ variable; these two uses of a symbol are independent and do not | |||
| 674 | conflict. (This is not the case in some dialects of Lisp, like | 674 | conflict. (This is not the case in some dialects of Lisp, like |
| 675 | Scheme.) | 675 | Scheme.) |
| 676 | 676 | ||
| 677 | @cindex internal functions, naming conventions | ||
| 677 | By convention, if a function's symbol consists of two names | 678 | By convention, if a function's symbol consists of two names |
| 678 | separated by @samp{--}, the function is intended for internal use and | 679 | separated by @samp{--}, the function is intended for internal use and |
| 679 | the first part names the file defining the function. For example, a | 680 | the first part names the file defining the function. For example, a |
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 2214a30c170..13a8ec46a8a 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -5026,7 +5026,7 @@ should return the @var{offset} to use to indent @var{arg} itself. | |||
| 5026 | @item | 5026 | @item |
| 5027 | @code{:elem}, in which case the function should return either the offset | 5027 | @code{:elem}, in which case the function should return either the offset |
| 5028 | to use to indent function arguments (if @var{arg} is the symbol | 5028 | to use to indent function arguments (if @var{arg} is the symbol |
| 5029 | @code{arg}) or the basic indentation step (if @var{arg} is the symbol | 5029 | @code{args}) or the basic indentation step (if @var{arg} is the symbol |
| 5030 | @code{basic}). | 5030 | @code{basic}). |
| 5031 | @item | 5031 | @item |
| 5032 | @code{:list-intro}, in which case @var{arg} is a token and the function | 5032 | @code{:list-intro}, in which case @var{arg} is a token and the function |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index f5ca6efa21b..ccc0f69a12d 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -35,6 +35,7 @@ terminal and the screen. | |||
| 35 | * Session Management:: Saving and restoring state with X Session Management. | 35 | * Session Management:: Saving and restoring state with X Session Management. |
| 36 | * Desktop Notifications:: Desktop notifications. | 36 | * Desktop Notifications:: Desktop notifications. |
| 37 | * System Taskbar:: Controlling system GUI taskbar features. | 37 | * System Taskbar:: Controlling system GUI taskbar features. |
| 38 | * System Sleep:: Block system sleep and process sleep events. | ||
| 38 | * File Notifications:: File notifications. | 39 | * File Notifications:: File notifications. |
| 39 | * Dynamic Libraries:: On-demand loading of support libraries. | 40 | * Dynamic Libraries:: On-demand loading of support libraries. |
| 40 | * Security Considerations:: Running Emacs in an unfriendly environment. | 41 | * Security Considerations:: Running Emacs in an unfriendly environment. |
| @@ -2285,7 +2286,7 @@ be protected by wrapping the timer function body with | |||
| 2285 | 2286 | ||
| 2286 | @lisp | 2287 | @lisp |
| 2287 | @group | 2288 | @group |
| 2288 | (ignore-error 'remote-file-error | 2289 | (ignore-error remote-file-error |
| 2289 | @dots{}) | 2290 | @dots{}) |
| 2290 | @end group | 2291 | @end group |
| 2291 | @end lisp | 2292 | @end lisp |
| @@ -3493,6 +3494,75 @@ Examples of system taskbar functions: | |||
| 3493 | @end group | 3494 | @end group |
| 3494 | @end lisp | 3495 | @end lisp |
| 3495 | 3496 | ||
| 3497 | @node System Sleep | ||
| 3498 | @section Block System Sleep and Process Sleep Events | ||
| 3499 | @cindex system sleep | ||
| 3500 | @cindex mode, system sleep | ||
| 3501 | |||
| 3502 | @defun system-sleep-block-sleep &optional why allow-display-sleep | ||
| 3503 | This function blocks the system from entering its idle sleep state. | ||
| 3504 | |||
| 3505 | It returns a token that must be passed to | ||
| 3506 | @code{system-sleep-unblock-sleep} to unblock this specific block (other | ||
| 3507 | sleep blocks may be simultaneously in force for other purposes). | ||
| 3508 | Otherwise, it returns @code{nil} if the sleep blocking fails. | ||
| 3509 | |||
| 3510 | @var{why} is a string and, when non-@code{nil}, is used to identify the | ||
| 3511 | sleep block as it may appear on the system's inspectable block lists. | ||
| 3512 | It defaults to @samp{Emacs}. | ||
| 3513 | |||
| 3514 | If @var{allow-display-sleep} is non-@code{nil}, allow the display to | ||
| 3515 | sleep. By default, the display is kept active. | ||
| 3516 | |||
| 3517 | Note that when the Emacs process terminates, blocks are released on all | ||
| 3518 | platforms. | ||
| 3519 | @end defun | ||
| 3520 | |||
| 3521 | @defun system-sleep-unblock-sleep token | ||
| 3522 | This function unblocks the sleep block associated with @var{token}. It | ||
| 3523 | returns non-@code{nil} on success, otherwise it returns @code{nil}. | ||
| 3524 | @end defun | ||
| 3525 | |||
| 3526 | @defmac with-system-sleep-block (&optional why allow-display-sleep) body@dots{} | ||
| 3527 | This is a convenience macro that lets you wrap the forms in @var{body} | ||
| 3528 | with a sleep block that is unblocked for you when @var{body} completes. | ||
| 3529 | This guarantees that the system will never go to sleep while @var{body} | ||
| 3530 | executes. The arguments have the same meaning as in | ||
| 3531 | @code{system-sleep-block-sleep}, above. | ||
| 3532 | @end defmac | ||
| 3533 | |||
| 3534 | @defun system-sleep-sleep-blocked-p | ||
| 3535 | This predicate function returns non-@code{nil} if there are any | ||
| 3536 | active @code{system-sleep} blocks, otherwise it returns @code{nil}. | ||
| 3537 | @end defun | ||
| 3538 | |||
| 3539 | @defun system-sleep-unblock-all-sleep-blocks | ||
| 3540 | This function unblocks all active sleep blocks. It is unlikely that you | ||
| 3541 | will need to call this function. | ||
| 3542 | @end defun | ||
| 3543 | |||
| 3544 | @defopt system-sleep-event-functions | ||
| 3545 | When the system is about to enter a sleep state or after it wakes from | ||
| 3546 | one, each function on this abnormal hook is called with one argument, | ||
| 3547 | @var{event}, a sleep event. Its state can be retrieved via | ||
| 3548 | @samp{@code{(sleep-event-state event)}}. State will be one of the | ||
| 3549 | symbols @code{pre-sleep} or @code{post-wake}. | ||
| 3550 | |||
| 3551 | Handling @code{pre-sleep} events should be done as fast as possible and | ||
| 3552 | avoid user prompting. Systems often grant a very short pre-sleep | ||
| 3553 | processing interval, typically ranging between 2 and 5 seconds. The | ||
| 3554 | system may sleep even if your processing is not complete, so be sure you | ||
| 3555 | do as little as possible. For example, your function could close active | ||
| 3556 | connections or serial ports. | ||
| 3557 | |||
| 3558 | Handling @code{post-wake} events offers more leeway. Use this, for | ||
| 3559 | example, to reestablish connections. | ||
| 3560 | |||
| 3561 | Note: Your code, or the functions it calls, should not raise any signals | ||
| 3562 | or all hooks will be halted. You can wrap your code in a | ||
| 3563 | @code{condition-case} block (@pxref{Errors}). | ||
| 3564 | @end defopt | ||
| 3565 | |||
| 3496 | @node File Notifications | 3566 | @node File Notifications |
| 3497 | @section Notifications on File Changes | 3567 | @section Notifications on File Changes |
| 3498 | @cindex file notifications | 3568 | @cindex file notifications |
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 4de739aa915..afee255346c 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -1110,9 +1110,9 @@ instead of the default @code{equal}. | |||
| 1110 | @cindex sequences, intersection of | 1110 | @cindex sequences, intersection of |
| 1111 | @cindex intersection of sequences | 1111 | @cindex intersection of sequences |
| 1112 | This function returns a copy of @var{sequence1} from which the | 1112 | This function returns a copy of @var{sequence1} from which the |
| 1113 | elements that appear in @var{sequence2} where removed. If the optional | 1113 | elements that do not appear in @var{sequence2} were removed. If the |
| 1114 | argument @var{function} is non-@code{nil}, it is a function of two | 1114 | optional argument @var{function} is non-@code{nil}, it is a function of |
| 1115 | arguments to use to compare elements instead of the default | 1115 | two arguments to use to compare elements instead of the default |
| 1116 | @code{equal}. | 1116 | @code{equal}. |
| 1117 | 1117 | ||
| 1118 | @example | 1118 | @example |
| @@ -1125,10 +1125,11 @@ arguments to use to compare elements instead of the default | |||
| 1125 | 1125 | ||
| 1126 | 1126 | ||
| 1127 | @defun seq-difference sequence1 sequence2 &optional function | 1127 | @defun seq-difference sequence1 sequence2 &optional function |
| 1128 | This function returns a list of the elements that appear in | 1128 | This function returns a copy of @var{sequence1} from which the |
| 1129 | @var{sequence1} but not in @var{sequence2}. If the optional argument | 1129 | elements that appear in @var{sequence2} were removed. If the optional |
| 1130 | @var{function} is non-@code{nil}, it is a function of two arguments to | 1130 | argument @var{function} is non-@code{nil}, it is a function of two |
| 1131 | use to compare elements instead of the default @code{equal}. | 1131 | arguments to use to compare elements instead of the default |
| 1132 | @code{equal}. | ||
| 1132 | 1133 | ||
| 1133 | @example | 1134 | @example |
| 1134 | @group | 1135 | @group |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 44be529d562..d073d3ffe2f 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -281,6 +281,17 @@ another string, alter a constant string in the program, or even raise | |||
| 281 | an error. To obtain a string that you can safely mutate, use | 281 | an error. To obtain a string that you can safely mutate, use |
| 282 | @code{copy-sequence} on the result. | 282 | @code{copy-sequence} on the result. |
| 283 | 283 | ||
| 284 | If you need to create a string made from @var{n} copies of a given | ||
| 285 | source string @var{source}, you can use @code{concat} as follows: | ||
| 286 | |||
| 287 | @lisp | ||
| 288 | (apply #'concat (make-list @var{n} @var{source})) | ||
| 289 | @end lisp | ||
| 290 | |||
| 291 | @noindent | ||
| 292 | This uses the fact that @code{concat} can take any kind of sequence as | ||
| 293 | its arguments. | ||
| 294 | |||
| 284 | For information about other concatenation functions, see the | 295 | For information about other concatenation functions, see the |
| 285 | description of @code{mapconcat} in @ref{Mapping Functions}, | 296 | description of @code{mapconcat} in @ref{Mapping Functions}, |
| 286 | @code{vconcat} in @ref{Vector Functions}, and @code{append} in @ref{Building | 297 | @code{vconcat} in @ref{Vector Functions}, and @code{append} in @ref{Building |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 29a272eec92..e89b28eb0c0 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -617,6 +617,8 @@ float-pi | |||
| 617 | 617 | ||
| 618 | @node Tips for Defining | 618 | @node Tips for Defining |
| 619 | @section Tips for Defining Variables Robustly | 619 | @section Tips for Defining Variables Robustly |
| 620 | @cindex variables, naming conventions | ||
| 621 | @cindex naming conventions, variables | ||
| 620 | 622 | ||
| 621 | When you define a variable whose value is a function, or a list of | 623 | When you define a variable whose value is a function, or a list of |
| 622 | functions, use a name that ends in @samp{-function} or | 624 | functions, use a name that ends in @samp{-function} or |
| @@ -659,6 +661,7 @@ The value is a whole shell command. | |||
| 659 | @item @dots{}-switches | 661 | @item @dots{}-switches |
| 660 | The value specifies options for a command. | 662 | The value specifies options for a command. |
| 661 | 663 | ||
| 664 | @cindex internal variables, naming conventions | ||
| 662 | @item @var{prefix}--@dots{} | 665 | @item @var{prefix}--@dots{} |
| 663 | The variable is intended for internal use and is defined in the file | 666 | The variable is intended for internal use and is defined in the file |
| 664 | @file{@var{prefix}.el}. (Emacs code contributed before 2018 may | 667 | @file{@var{prefix}.el}. (Emacs code contributed before 2018 may |
| @@ -2653,6 +2656,19 @@ This macro returns the connection-local value of @var{symbol} for | |||
| 2653 | 2656 | ||
| 2654 | If @var{symbol} does not have a connection-local | 2657 | If @var{symbol} does not have a connection-local |
| 2655 | binding, the value is the default binding of the variable. | 2658 | binding, the value is the default binding of the variable. |
| 2659 | |||
| 2660 | The difference to @code{with-connection-local@{-application@}-variables} | ||
| 2661 | is, that @code{symbol} is not set buffer-local. A typical usage pattern | ||
| 2662 | is to use only the the connection value of a variable if it exists, and | ||
| 2663 | not to use its default value otherwise (using @code{my-app-variable} | ||
| 2664 | initialized above): | ||
| 2665 | |||
| 2666 | @lisp | ||
| 2667 | (if (connection-local-p my-app-variable 'my-app) | ||
| 2668 | (connection-local-value my-app-variable 'my-app) | ||
| 2669 | ;; Something else. | ||
| 2670 | ) | ||
| 2671 | @end lisp | ||
| 2656 | @end defmac | 2672 | @end defmac |
| 2657 | 2673 | ||
| 2658 | @defvar enable-connection-local-variables | 2674 | @defvar enable-connection-local-variables |