diff options
| author | Karl Heuer | 1995-06-06 19:21:15 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-06 19:21:15 +0000 |
| commit | bfe721d172158ccdcd925e55f5a658421ca0d4fe (patch) | |
| tree | 2d2882c335a04acb20662d2b5aa6dc2246a6f0aa | |
| parent | 5c4276bc6de449d416cc83dd034892da66badcb7 (diff) | |
| download | emacs-bfe721d172158ccdcd925e55f5a658421ca0d4fe.tar.gz emacs-bfe721d172158ccdcd925e55f5a658421ca0d4fe.zip | |
*** empty log message ***
42 files changed, 1533 insertions, 1122 deletions
diff --git a/lispref/backups.texi b/lispref/backups.texi index ec1980957e2..d25908fe57c 100644 --- a/lispref/backups.texi +++ b/lispref/backups.texi | |||
| @@ -65,11 +65,12 @@ permanent local; @code{kill-local-variables} does not alter it. | |||
| 65 | @end defvar | 65 | @end defvar |
| 66 | 66 | ||
| 67 | @defopt make-backup-files | 67 | @defopt make-backup-files |
| 68 | This variable determines whether or not to make backup files. If it | 68 | This variable determines whether or not to make backup files. If it |
| 69 | is non-@code{nil}, then Emacs creates a backup of each file when it is | 69 | is non-@code{nil}, then Emacs creates a backup of each file when it is |
| 70 | saved for the first time. | 70 | saved for the first time---provided that @code{backup-inhibited} |
| 71 | is @code{nil} (see below). | ||
| 71 | 72 | ||
| 72 | The following example shows how to change the @code{make-backup-files} | 73 | The following example shows how to change the @code{make-backup-files} |
| 73 | variable only in the @file{RMAIL} buffer and not elsewhere. Setting it | 74 | variable only in the @file{RMAIL} buffer and not elsewhere. Setting it |
| 74 | @code{nil} stops Emacs from making backups of the @file{RMAIL} file, | 75 | @code{nil} stops Emacs from making backups of the @file{RMAIL} file, |
| 75 | which may save disk space. (You would put this code in your | 76 | which may save disk space. (You would put this code in your |
| @@ -107,10 +108,12 @@ The default value is this: | |||
| 107 | If this variable is non-@code{nil}, backups are inhibited. It records | 108 | If this variable is non-@code{nil}, backups are inhibited. It records |
| 108 | the result of testing @code{backup-enable-predicate} on the visited file | 109 | the result of testing @code{backup-enable-predicate} on the visited file |
| 109 | name. It can also coherently be used by other mechanisms that inhibit | 110 | name. It can also coherently be used by other mechanisms that inhibit |
| 110 | backups based on which file is visited. This is a permanent local, | 111 | backups based on which file is visited. For example, VC sets this |
| 111 | so that changing the major mode does not lose its value. | 112 | variable non-@code{nil} to prevent making backups for files managed |
| 113 | with a version control system. | ||
| 112 | 114 | ||
| 113 | Major modes should not set this variable---they should set | 115 | This is a permanent local, so that changing the major mode does not lose |
| 116 | its value. Major modes should not set this variable---they should set | ||
| 114 | @code{make-backup-files} instead. | 117 | @code{make-backup-files} instead. |
| 115 | @end defvar | 118 | @end defvar |
| 116 | 119 | ||
| @@ -506,7 +509,7 @@ If this variable is non-@code{nil}, buffers that are visiting files | |||
| 506 | have auto-saving enabled by default. Otherwise, they do not. | 509 | have auto-saving enabled by default. Otherwise, they do not. |
| 507 | @end defopt | 510 | @end defopt |
| 508 | 511 | ||
| 509 | @deffn Command do-auto-save &optional no-message | 512 | @deffn Command do-auto-save &optional no-message current-only |
| 510 | This function auto-saves all buffers that need to be auto-saved. It | 513 | This function auto-saves all buffers that need to be auto-saved. It |
| 511 | saves all buffers for which auto-saving is enabled and that have been | 514 | saves all buffers for which auto-saving is enabled and that have been |
| 512 | changed since the previous auto-save. | 515 | changed since the previous auto-save. |
| @@ -515,6 +518,9 @@ Normally, if any buffers are auto-saved, a message that says | |||
| 515 | @samp{Auto-saving...} is displayed in the echo area while auto-saving is | 518 | @samp{Auto-saving...} is displayed in the echo area while auto-saving is |
| 516 | going on. However, if @var{no-message} is non-@code{nil}, the message | 519 | going on. However, if @var{no-message} is non-@code{nil}, the message |
| 517 | is inhibited. | 520 | is inhibited. |
| 521 | |||
| 522 | If @var{current-only} is non-@code{nil}, only the current buffer | ||
| 523 | is auto-saved. | ||
| 518 | @end deffn | 524 | @end deffn |
| 519 | 525 | ||
| 520 | @defun delete-auto-save-file-if-necessary | 526 | @defun delete-auto-save-file-if-necessary |
| @@ -545,17 +551,22 @@ in response. | |||
| 545 | 551 | ||
| 546 | If it is -1, that means auto-saving is temporarily shut off in this | 552 | If it is -1, that means auto-saving is temporarily shut off in this |
| 547 | buffer due to a substantial deletion. Explicitly saving the buffer | 553 | buffer due to a substantial deletion. Explicitly saving the buffer |
| 548 | stores a positive value in this variable, thus reenabling auto-save. | 554 | stores a positive value in this variable, thus reenabling auto-saving. |
| 549 | Turning auto-save mode off or on also alters this variable. | 555 | Turning auto-save mode off or on also alters this variable. |
| 550 | @end defvar | 556 | @end defvar |
| 551 | 557 | ||
| 552 | @defvar auto-save-list-file-name | 558 | @defvar auto-save-list-file-name |
| 553 | This variable (if non-@code{nil}) specifies a file for recording the | 559 | This variable (if non-@code{nil}) specifies a file for recording the |
| 554 | names of all the auto-save files. Each time Emacs does auto-saving, it | 560 | names of all the auto-save files. Each time Emacs does auto-saving, it |
| 555 | writes into this file the names of all the auto-save files of all the | 561 | writes two lines into this file for each buffer that has auto-saving |
| 556 | buffers that have auto-save enabled. If Emacs crashes, you can look in | 562 | enabled. The first line gives the name of the visited file (it's empty |
| 557 | this file to find all the auto-save files that might contain work that | 563 | if the buffer has none), and the second gives the name of the auto-save |
| 558 | was otherwise lost. The @code{multi-replace} command uses these files. | 564 | file. |
| 565 | |||
| 566 | If Emacs exits normally, it deletes this file. If Emacs crashes, you | ||
| 567 | can look in the file to find all the auto-save files that might contain | ||
| 568 | work that was otherwise lost. The @code{recover-session} command uses | ||
| 569 | these files. | ||
| 559 | 570 | ||
| 560 | The default name for this file is in your home directory and starts with | 571 | The default name for this file is in your home directory and starts with |
| 561 | @samp{.saves-}. It also contains the Emacs process @sc{id} and the host | 572 | @samp{.saves-}. It also contains the Emacs process @sc{id} and the host |
| @@ -612,9 +623,9 @@ regenerate the contents. | |||
| 612 | 623 | ||
| 613 | @defvar revert-buffer-insert-file-contents-function | 624 | @defvar revert-buffer-insert-file-contents-function |
| 614 | The value of this variable, if non-@code{nil}, is the function to use to | 625 | The value of this variable, if non-@code{nil}, is the function to use to |
| 615 | insert contents when reverting this buffer. The function receives two | 626 | insert the updated contents when reverting this buffer. The function |
| 616 | arguments, first the file name to use; second, @code{t} if the user has | 627 | receives two arguments: first the file name to use; second, @code{t} if |
| 617 | asked to read the auto-save file. | 628 | the user has asked to read the auto-save file. |
| 618 | @end defvar | 629 | @end defvar |
| 619 | 630 | ||
| 620 | @defvar before-revert-hook | 631 | @defvar before-revert-hook |
| @@ -635,16 +646,3 @@ Font Lock mode uses this hook to recompute the fonts for the updated | |||
| 635 | buffer contents. | 646 | buffer contents. |
| 636 | @end defvar | 647 | @end defvar |
| 637 | 648 | ||
| 638 | @deffn Command recover-file filename | ||
| 639 | This function visits @var{filename}, but gets the contents from its | ||
| 640 | last auto-save file. This is useful after the system has crashed, to | ||
| 641 | resume editing the same file without losing all the work done in the | ||
| 642 | previous session. | ||
| 643 | |||
| 644 | An error is signaled if there is no auto-save file for @var{filename}, | ||
| 645 | or if @var{filename} is newer than its auto-save file. If | ||
| 646 | @var{filename} does not exist, but its auto-save file does, then the | ||
| 647 | auto-save file is read as usual. This last situation may occur if you | ||
| 648 | visited a nonexistent file and never actually saved it. | ||
| 649 | @end deffn | ||
| 650 | |||
diff --git a/lispref/buffers.texi b/lispref/buffers.texi index bfa8f020c62..801698408aa 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi | |||
| @@ -45,11 +45,11 @@ current buffer. Each buffer, including the current buffer, may or may | |||
| 45 | not be displayed in any windows. | 45 | not be displayed in any windows. |
| 46 | @end ifinfo | 46 | @end ifinfo |
| 47 | 47 | ||
| 48 | Buffers in Emacs editing are objects that have distinct names and | 48 | Buffers in Emacs editing are objects that have distinct names and hold |
| 49 | hold text that can be edited. Buffers appear to Lisp programs as a | 49 | text that can be edited. Buffers appear to Lisp programs as a special |
| 50 | special data type. The contents of a buffer may be viewed as an | 50 | data type. You can think of the contents of a buffer as an extendable |
| 51 | extendable string; insertions and deletions may occur in any part of the | 51 | string; insertions and deletions may occur in any part of the buffer. |
| 52 | buffer. @xref{Text}. | 52 | @xref{Text}. |
| 53 | 53 | ||
| 54 | A Lisp buffer object contains numerous pieces of information. Some of | 54 | A Lisp buffer object contains numerous pieces of information. Some of |
| 55 | this information is directly accessible to the programmer through | 55 | this information is directly accessible to the programmer through |
| @@ -212,7 +212,7 @@ Any argument called @var{buffer} must be an actual buffer | |||
| 212 | object, not a name. | 212 | object, not a name. |
| 213 | 213 | ||
| 214 | Buffers that are ephemeral and generally uninteresting to the user | 214 | Buffers that are ephemeral and generally uninteresting to the user |
| 215 | have names starting with a space, so that the @code{list-buffers} or | 215 | have names starting with a space, so that the @code{list-buffers} and |
| 216 | @code{buffer-menu} commands don't mention them. A name starting with | 216 | @code{buffer-menu} commands don't mention them. A name starting with |
| 217 | space also initially disables recording undo information; see | 217 | space also initially disables recording undo information; see |
| 218 | @ref{Undo}. | 218 | @ref{Undo}. |
| @@ -567,7 +567,7 @@ A buffer visiting a write-protected file is normally read-only. | |||
| 567 | Here, the purpose is to show the user that editing the buffer with the | 567 | Here, the purpose is to show the user that editing the buffer with the |
| 568 | aim of saving it in the file may be futile or undesirable. The user who | 568 | aim of saving it in the file may be futile or undesirable. The user who |
| 569 | wants to change the buffer text despite this can do so after clearing | 569 | wants to change the buffer text despite this can do so after clearing |
| 570 | the read-only flag with @kbd{C-M-q}. | 570 | the read-only flag with @kbd{C-x C-q}. |
| 571 | 571 | ||
| 572 | @item | 572 | @item |
| 573 | Modes such as Dired and Rmail make buffers read-only when altering the | 573 | Modes such as Dired and Rmail make buffers read-only when altering the |
| @@ -779,6 +779,9 @@ Therefore, when you kill a buffer, you should also take the precautions | |||
| 779 | associated with changing the current buffer (unless you happen to know | 779 | associated with changing the current buffer (unless you happen to know |
| 780 | that the buffer being killed isn't current). @xref{Current Buffer}. | 780 | that the buffer being killed isn't current). @xref{Current Buffer}. |
| 781 | 781 | ||
| 782 | If you kill a buffer that is the base buffer of one or more indirect | ||
| 783 | buffers, the indirect buffers are automatically killed as well. | ||
| 784 | |||
| 782 | The @code{buffer-name} of a killed buffer is @code{nil}. You can use | 785 | The @code{buffer-name} of a killed buffer is @code{nil}. You can use |
| 783 | this feature to test whether a buffer has been killed: | 786 | this feature to test whether a buffer has been killed: |
| 784 | 787 | ||
| @@ -853,7 +856,7 @@ when set for any reason. @xref{Buffer-Local Variables}. | |||
| 853 | 856 | ||
| 854 | An @dfn{indirect buffer} shares the text of some other buffer, which | 857 | An @dfn{indirect buffer} shares the text of some other buffer, which |
| 855 | is called the @dfn{base buffer} of the indirect buffer. In some ways it | 858 | is called the @dfn{base buffer} of the indirect buffer. In some ways it |
| 856 | is the equivalent, for buffers, of a symbolic link among files. The base | 859 | is the analogue, for buffers, of a symbolic link among files. The base |
| 857 | buffer may not itself be an indirect buffer. | 860 | buffer may not itself be an indirect buffer. |
| 858 | 861 | ||
| 859 | The text of the indirect buffer is always identical to the text of its | 862 | The text of the indirect buffer is always identical to the text of its |
diff --git a/lispref/commands.texi b/lispref/commands.texi index aa7ad7d2852..c03e9169ad6 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -82,40 +82,10 @@ and also when the command loop is first entered. At that time, | |||
| 82 | @code{last-command} describes the command before that. @xref{Hooks}. | 82 | @code{last-command} describes the command before that. @xref{Hooks}. |
| 83 | @end defvar | 83 | @end defvar |
| 84 | 84 | ||
| 85 | An erroneous function in the @code{pre-command-hook} list could easily | ||
| 86 | make Emacs go into an infinite loop of errors. To protect you from this | ||
| 87 | sort of painful problem, Emacs sets the hook variable to @code{nil} | ||
| 88 | temporarily while running the functions in the hook. Thus, if a hook | ||
| 89 | function gets an error, the hook variable is left as @code{nil}. Emacs | ||
| 90 | does the same thing for @code{post-command-hook}. | ||
| 91 | |||
| 92 | Quitting is suppressed while running @code{pre-command-hook} and | 85 | Quitting is suppressed while running @code{pre-command-hook} and |
| 93 | @code{post-command-hook}; this is because otherwise a quit, happening by | 86 | @code{post-command-hook}. If an error happens while executing one of |
| 94 | chance within one of these hooks, would turn off the hook. | 87 | these hooks, it terminates execution of the hook, but that is all it |
| 95 | 88 | does. | |
| 96 | One inconvenient result of these protective features is that you | ||
| 97 | cannot have a function in @code{post-command-hook} or | ||
| 98 | @code{pre-command-hook} which changes the value of that variable. But | ||
| 99 | that's not a real limitation. If you want hook functions to change the | ||
| 100 | hook, simply add one fixed function to the hook, and code that function | ||
| 101 | to look in another hook variable for other functions to call. Here is | ||
| 102 | an example: | ||
| 103 | |||
| 104 | @example | ||
| 105 | ;; @r{Set up the mechanism.} | ||
| 106 | (defvar current-post-command-function nil) | ||
| 107 | (defun run-current-post-command-function () | ||
| 108 | (if current-post-command-function | ||
| 109 | (funcall current-post-command-function))) | ||
| 110 | (add-hooks 'post-command-hook | ||
| 111 | 'run-current-post-command-function) | ||
| 112 | |||
| 113 | ;; @r{Here's a hook function which replaces itself} | ||
| 114 | ;; @r{with a different hook function to run next time.} | ||
| 115 | (defun first-post-command-function () | ||
| 116 | (setq current-post-command-function | ||
| 117 | 'second-post-command-function)) | ||
| 118 | @end example | ||
| 119 | 89 | ||
| 120 | @node Defining Commands | 90 | @node Defining Commands |
| 121 | @section Defining Commands | 91 | @section Defining Commands |
| @@ -502,7 +472,7 @@ that is, if @var{object} is a command. Otherwise, returns @code{nil}. | |||
| 502 | 472 | ||
| 503 | The interactively callable objects include strings and vectors (treated | 473 | The interactively callable objects include strings and vectors (treated |
| 504 | as keyboard macros), lambda expressions that contain a top-level call to | 474 | as keyboard macros), lambda expressions that contain a top-level call to |
| 505 | @code{interactive}, compiled function objects made from such lambda | 475 | @code{interactive}, byte-code function objects made from such lambda |
| 506 | expressions, autoload objects that are declared as interactive | 476 | expressions, autoload objects that are declared as interactive |
| 507 | (non-@code{nil} fourth argument to @code{autoload}), and some of the | 477 | (non-@code{nil} fourth argument to @code{autoload}), and some of the |
| 508 | primitive functions. | 478 | primitive functions. |
| @@ -647,6 +617,9 @@ is a symbol with a function definition, but this is not guaranteed. | |||
| 647 | The value is copied from @code{this-command} when a command returns to | 617 | The value is copied from @code{this-command} when a command returns to |
| 648 | the command loop, except when the command specifies a prefix argument | 618 | the command loop, except when the command specifies a prefix argument |
| 649 | for the following command. | 619 | for the following command. |
| 620 | |||
| 621 | This variable is always local to the current terminal and cannot be | ||
| 622 | buffer-local. @xref{Multiple Displays}. | ||
| 650 | @end defvar | 623 | @end defvar |
| 651 | 624 | ||
| 652 | @defvar this-command | 625 | @defvar this-command |
| @@ -662,7 +635,7 @@ command). | |||
| 662 | 635 | ||
| 663 | @cindex kill command repetition | 636 | @cindex kill command repetition |
| 664 | Some commands set this variable during their execution, as a flag for | 637 | Some commands set this variable during their execution, as a flag for |
| 665 | whatever command runs next. In particular, the functions that kill text | 638 | whatever command runs next. In particular, the functions for killing text |
| 666 | set @code{this-command} to @code{kill-region} so that any kill commands | 639 | set @code{this-command} to @code{kill-region} so that any kill commands |
| 667 | immediately following will know to append the killed text to the | 640 | immediately following will know to append the killed text to the |
| 668 | previous kill. | 641 | previous kill. |
| @@ -737,17 +710,6 @@ frame, the value is the frame to which the event was redirected. | |||
| 737 | @xref{Input Focus}. | 710 | @xref{Input Focus}. |
| 738 | @end defvar | 711 | @end defvar |
| 739 | 712 | ||
| 740 | @defvar echo-keystrokes | ||
| 741 | This variable determines how much time should elapse before command | ||
| 742 | characters echo. Its value must be an integer, which specifies the | ||
| 743 | number of seconds to wait before echoing. If the user types a prefix | ||
| 744 | key (such as @kbd{C-x}) and then delays this many seconds before | ||
| 745 | continuing, the prefix key is echoed in the echo area. Any subsequent | ||
| 746 | characters in the same command will be echoed as well. | ||
| 747 | |||
| 748 | If the value is zero, then command input is not echoed. | ||
| 749 | @end defvar | ||
| 750 | |||
| 751 | @node Input Events | 713 | @node Input Events |
| 752 | @section Input Events | 714 | @section Input Events |
| 753 | @cindex events | 715 | @cindex events |
| @@ -798,11 +760,25 @@ An input character event consists of a @dfn{basic code} between 0 and | |||
| 798 | 760 | ||
| 799 | @table @asis | 761 | @table @asis |
| 800 | @item meta | 762 | @item meta |
| 801 | The 2**23 bit in the character code indicates a character | 763 | The |
| 764 | @iftex | ||
| 765 | $2^{27}$ | ||
| 766 | @end iftex | ||
| 767 | @ifinfo | ||
| 768 | 2**27 | ||
| 769 | @end ifinfo | ||
| 770 | bit in the character code indicates a character | ||
| 802 | typed with the meta key held down. | 771 | typed with the meta key held down. |
| 803 | 772 | ||
| 804 | @item control | 773 | @item control |
| 805 | The 2**22 bit in the character code indicates a non-@sc{ASCII} | 774 | The |
| 775 | @iftex | ||
| 776 | $2^{26}$ | ||
| 777 | @end iftex | ||
| 778 | @ifinfo | ||
| 779 | 2**26 | ||
| 780 | @end ifinfo | ||
| 781 | bit in the character code indicates a non-@sc{ASCII} | ||
| 806 | control character. | 782 | control character. |
| 807 | 783 | ||
| 808 | @sc{ASCII} control characters such as @kbd{C-a} have special basic | 784 | @sc{ASCII} control characters such as @kbd{C-a} have special basic |
| @@ -811,42 +787,95 @@ Thus, the code for @kbd{C-a} is just 1. | |||
| 811 | 787 | ||
| 812 | But if you type a control combination not in @sc{ASCII}, such as | 788 | But if you type a control combination not in @sc{ASCII}, such as |
| 813 | @kbd{%} with the control key, the numeric value you get is the code | 789 | @kbd{%} with the control key, the numeric value you get is the code |
| 814 | for @kbd{%} plus 2**22 (assuming the terminal supports non-@sc{ASCII} | 790 | for @kbd{%} plus |
| 791 | @iftex | ||
| 792 | $2^{26}$ | ||
| 793 | @end iftex | ||
| 794 | @ifinfo | ||
| 795 | 2**26 | ||
| 796 | @end ifinfo | ||
| 797 | (assuming the terminal supports non-@sc{ASCII} | ||
| 815 | control characters). | 798 | control characters). |
| 816 | 799 | ||
| 817 | @item shift | 800 | @item shift |
| 818 | The 2**21 bit in the character code indicates an @sc{ASCII} control | 801 | The |
| 802 | @iftex | ||
| 803 | $2^{25}$ | ||
| 804 | @end iftex | ||
| 805 | @ifinfo | ||
| 806 | 2**25 | ||
| 807 | @end ifinfo | ||
| 808 | bit in the character code indicates an @sc{ASCII} control | ||
| 819 | character typed with the shift key held down. | 809 | character typed with the shift key held down. |
| 820 | 810 | ||
| 821 | For letters, the basic code indicates upper versus lower case; for | 811 | For letters, the basic code indicates upper versus lower case; for |
| 822 | digits and punctuation, the shift key selects an entirely different | 812 | digits and punctuation, the shift key selects an entirely different |
| 823 | character with a different basic code. In order to keep within | 813 | character with a different basic code. In order to keep within |
| 824 | the @sc{ASCII} character set whenever possible, Emacs avoids using | 814 | the @sc{ASCII} character set whenever possible, Emacs avoids using |
| 825 | the 2**21 bit for those characters. | 815 | the |
| 816 | @iftex | ||
| 817 | $2^{25}$ | ||
| 818 | @end iftex | ||
| 819 | @ifinfo | ||
| 820 | 2**25 | ||
| 821 | @end ifinfo | ||
| 822 | bit for those characters. | ||
| 826 | 823 | ||
| 827 | However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from | 824 | However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from |
| 828 | @kbd{C-a}, so Emacs uses the 2**21 bit in @kbd{C-A} and not in | 825 | @kbd{C-a}, so Emacs uses the |
| 826 | @iftex | ||
| 827 | $2^{25}$ | ||
| 828 | @end iftex | ||
| 829 | @ifinfo | ||
| 830 | 2**25 | ||
| 831 | @end ifinfo | ||
| 832 | bit in @kbd{C-A} and not in | ||
| 829 | @kbd{C-a}. | 833 | @kbd{C-a}. |
| 830 | 834 | ||
| 831 | @item hyper | 835 | @item hyper |
| 832 | The 2**20 bit in the character code indicates a character | 836 | The |
| 837 | @iftex | ||
| 838 | $2^{24}$ | ||
| 839 | @end iftex | ||
| 840 | @ifinfo | ||
| 841 | 2**24 | ||
| 842 | @end ifinfo | ||
| 843 | bit in the character code indicates a character | ||
| 833 | typed with the hyper key held down. | 844 | typed with the hyper key held down. |
| 834 | 845 | ||
| 835 | @item super | 846 | @item super |
| 836 | The 2**19 bit in the character code indicates a character | 847 | The |
| 848 | @iftex | ||
| 849 | $2^{23}$ | ||
| 850 | @end iftex | ||
| 851 | @ifinfo | ||
| 852 | 2**23 | ||
| 853 | @end ifinfo | ||
| 854 | bit in the character code indicates a character | ||
| 837 | typed with the super key held down. | 855 | typed with the super key held down. |
| 838 | 856 | ||
| 839 | @item alt | 857 | @item alt |
| 840 | The 2**18 bit in the character code indicates a character typed with | 858 | The |
| 859 | @iftex | ||
| 860 | $2^{22}$ | ||
| 861 | @end iftex | ||
| 862 | @ifinfo | ||
| 863 | 2**22 | ||
| 864 | @end ifinfo | ||
| 865 | bit in the character code indicates a character typed with | ||
| 841 | the alt key held down. (On some terminals, the key labeled @key{ALT} | 866 | the alt key held down. (On some terminals, the key labeled @key{ALT} |
| 842 | is actually the meta key.) | 867 | is actually the meta key.) |
| 843 | @end table | 868 | @end table |
| 844 | 869 | ||
| 845 | In the future, Emacs may support a larger range of basic codes. We | 870 | It is best to avoid mentioning specific bit numbers in your program. |
| 846 | may also move the modifier bits to larger bit numbers. Therefore, you | 871 | To test the modifier bits of a character, use the function |
| 847 | should avoid mentioning specific bit numbers in your program. | 872 | @code{event-modifiers} (@pxref{Classifying Events}). When making key |
| 848 | Instead, the way to test the modifier bits of a character is with the | 873 | bindings, you can use the read syntax for characters with modifier bits |
| 849 | function @code{event-modifiers} (@pxref{Classifying Events}). | 874 | (@samp{\C-}, @samp{\M-}, and so on). For making key bindings with |
| 875 | @code{define-key}, you can use lists such as @code{(control hyper ?x)} to | ||
| 876 | specify the characters (@pxref{Changing Key Bindings}). The function | ||
| 877 | @code{event-convert-list} converts such a list into an event type | ||
| 878 | (@pxref{Classifying Events}). | ||
| 850 | 879 | ||
| 851 | @node Function Keys | 880 | @node Function Keys |
| 852 | @subsection Function Keys | 881 | @subsection Function Keys |
| @@ -1258,6 +1287,11 @@ the window manager. Its standard definition is @code{ignore}; since the | |||
| 1258 | frame has already been iconified, Emacs has no work to do. | 1287 | frame has already been iconified, Emacs has no work to do. |
| 1259 | @end table | 1288 | @end table |
| 1260 | 1289 | ||
| 1290 | If one of these events arrives in the middle of a key sequence---that | ||
| 1291 | is, after a prefix key---then Emacs reorders the events so that this | ||
| 1292 | event comes either before or after the multi-event key sequence, not | ||
| 1293 | within it. | ||
| 1294 | |||
| 1261 | @node Event Examples | 1295 | @node Event Examples |
| 1262 | @subsection Event Examples | 1296 | @subsection Event Examples |
| 1263 | 1297 | ||
| @@ -1380,6 +1414,20 @@ This function returns non-@code{nil} if @var{object} is a mouse movement | |||
| 1380 | event. | 1414 | event. |
| 1381 | @end defun | 1415 | @end defun |
| 1382 | 1416 | ||
| 1417 | @defun event-convert-list list | ||
| 1418 | This function converts a list of modifier names and a basic event type | ||
| 1419 | to an event type which specifies all of them. For example, | ||
| 1420 | |||
| 1421 | @example | ||
| 1422 | (event-convert-list '(control ?a)) | ||
| 1423 | @result{} 1 | ||
| 1424 | (event-convert-list '(control meta ?a)) | ||
| 1425 | @result{} -134217727 | ||
| 1426 | (event-convert-list '(control super f1)) | ||
| 1427 | @result{} C-s-f1 | ||
| 1428 | @end example | ||
| 1429 | @end defun | ||
| 1430 | |||
| 1383 | @node Accessing Events | 1431 | @node Accessing Events |
| 1384 | @subsection Accessing Events | 1432 | @subsection Accessing Events |
| 1385 | 1433 | ||
| @@ -1476,7 +1524,13 @@ limited to the range of 0 to 255 as text characters are. | |||
| 1476 | 1524 | ||
| 1477 | A keyboard character typed using the @key{META} key is called a | 1525 | A keyboard character typed using the @key{META} key is called a |
| 1478 | @dfn{meta character}. The numeric code for such an event includes the | 1526 | @dfn{meta character}. The numeric code for such an event includes the |
| 1479 | 2**23 bit; it does not even come close to fitting in a string. However, | 1527 | @iftex |
| 1528 | $2^{27}$ | ||
| 1529 | @end iftex | ||
| 1530 | @ifinfo | ||
| 1531 | 2**27 | ||
| 1532 | @end ifinfo | ||
| 1533 | bit; it does not even come close to fitting in a string. However, | ||
| 1480 | earlier Emacs versions used a different representation for these | 1534 | earlier Emacs versions used a different representation for these |
| 1481 | characters, which gave them codes in the range of 128 to 255. That did | 1535 | characters, which gave them codes in the range of 128 to 255. That did |
| 1482 | fit in a string, and many Lisp programs contain string constants that | 1536 | fit in a string, and many Lisp programs contain string constants that |
| @@ -1493,9 +1547,36 @@ If the keyboard character value is in the range of 0 to 127, it can go | |||
| 1493 | in the string unchanged. | 1547 | in the string unchanged. |
| 1494 | 1548 | ||
| 1495 | @item | 1549 | @item |
| 1496 | The meta variants of those characters, with codes in the range of 2**23 | 1550 | The meta variants of those characters, with codes in the range of |
| 1497 | to 2**23+127, can also go in the string, but you must change their | 1551 | @iftex |
| 1498 | numeric values. You must set the 2**7 bit instead of the 2**23 bit, | 1552 | $2^{27}$ |
| 1553 | @end iftex | ||
| 1554 | @ifinfo | ||
| 1555 | 2**27 | ||
| 1556 | @end ifinfo | ||
| 1557 | to | ||
| 1558 | @iftex | ||
| 1559 | $2^{27} + 127$, | ||
| 1560 | @end iftex | ||
| 1561 | @ifinfo | ||
| 1562 | 2**27+127, | ||
| 1563 | @end ifinfo | ||
| 1564 | can also go in the string, but you must change their | ||
| 1565 | numeric values. You must set the | ||
| 1566 | @iftex | ||
| 1567 | $2^{7}$ | ||
| 1568 | @end iftex | ||
| 1569 | @ifinfo | ||
| 1570 | 2**7 | ||
| 1571 | @end ifinfo | ||
| 1572 | bit instead of the | ||
| 1573 | @iftex | ||
| 1574 | $2^{27}$ | ||
| 1575 | @end iftex | ||
| 1576 | @ifinfo | ||
| 1577 | 2**27 | ||
| 1578 | @end ifinfo | ||
| 1579 | bit, | ||
| 1499 | resulting in a value between 128 and 255. | 1580 | resulting in a value between 128 and 255. |
| 1500 | 1581 | ||
| 1501 | @item | 1582 | @item |
| @@ -1609,8 +1690,9 @@ not perform case conversion in this way. | |||
| 1609 | 1690 | ||
| 1610 | The function @code{read-key-sequence} also transforms some mouse events. | 1691 | The function @code{read-key-sequence} also transforms some mouse events. |
| 1611 | It converts unbound drag events into click events, and discards unbound | 1692 | It converts unbound drag events into click events, and discards unbound |
| 1612 | button-down events entirely. It also reshuffles focus events so that they | 1693 | button-down events entirely. It also reshuffles focus events and |
| 1613 | never appear in a key sequence with any other events. | 1694 | miscellaneous window events so that they never appear in a key sequence |
| 1695 | with any other events. | ||
| 1614 | 1696 | ||
| 1615 | When mouse events occur in special parts of a window, such as a mode | 1697 | When mouse events occur in special parts of a window, such as a mode |
| 1616 | line or a scroll bar, the event type shows nothing special---it is the | 1698 | line or a scroll bar, the event type shows nothing special---it is the |
| @@ -1626,7 +1708,7 @@ You can define meanings for mouse clicks in special window parts by | |||
| 1626 | defining key sequences using these imaginary prefix keys. | 1708 | defining key sequences using these imaginary prefix keys. |
| 1627 | 1709 | ||
| 1628 | For example, if you call @code{read-key-sequence} and then click the | 1710 | For example, if you call @code{read-key-sequence} and then click the |
| 1629 | mouse on the window's mode line, you get an event like this: | 1711 | mouse on the window's mode line, you get two events, like this: |
| 1630 | 1712 | ||
| 1631 | @example | 1713 | @example |
| 1632 | (read-key-sequence "Click on the mode line: ") | 1714 | (read-key-sequence "Click on the mode line: ") |
| @@ -1686,8 +1768,9 @@ the echo area. | |||
| 1686 | @end group | 1768 | @end group |
| 1687 | 1769 | ||
| 1688 | @group | 1770 | @group |
| 1771 | ;; @r{We assume here you use @kbd{M-:} to evaluate this.} | ||
| 1689 | (symbol-function 'foo) | 1772 | (symbol-function 'foo) |
| 1690 | @result{} "^[^[(read-char)^M1" | 1773 | @result{} "^[:(read-char)^M1" |
| 1691 | @end group | 1774 | @end group |
| 1692 | @group | 1775 | @group |
| 1693 | (execute-kbd-macro 'foo) | 1776 | (execute-kbd-macro 'foo) |
| @@ -1794,8 +1877,8 @@ as part of a command or explicitly by a Lisp program. | |||
| 1794 | 1877 | ||
| 1795 | In the example below, the Lisp program reads the character @kbd{1}, | 1878 | In the example below, the Lisp program reads the character @kbd{1}, |
| 1796 | @sc{ASCII} code 49. It becomes the value of @code{last-input-event}, | 1879 | @sc{ASCII} code 49. It becomes the value of @code{last-input-event}, |
| 1797 | while @kbd{C-e} (from the @kbd{C-x C-e} command used to evaluate this | 1880 | while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate |
| 1798 | expression) remains the value of @code{last-command-event}. | 1881 | this expression) remains the value of @code{last-command-event}. |
| 1799 | 1882 | ||
| 1800 | @example | 1883 | @example |
| 1801 | @group | 1884 | @group |
| @@ -1852,12 +1935,15 @@ available. The value is @code{t} if @code{sit-for} waited the full | |||
| 1852 | time with no input arriving (see @code{input-pending-p} in @ref{Event | 1935 | time with no input arriving (see @code{input-pending-p} in @ref{Event |
| 1853 | Input Misc}). Otherwise, the value is @code{nil}. | 1936 | Input Misc}). Otherwise, the value is @code{nil}. |
| 1854 | 1937 | ||
| 1855 | @c Emacs 19 feature ??? maybe not working yet | 1938 | The argument @var{seconds} need not be an integer. If it is a floating |
| 1939 | point number, @code{sit-for} waits for a fractional number of seconds. | ||
| 1940 | Some systems support only a whole number of seconds; on these systems, | ||
| 1941 | @var{seconds} is rounded down. | ||
| 1942 | |||
| 1856 | The optional argument @var{millisec} specifies an additional waiting | 1943 | The optional argument @var{millisec} specifies an additional waiting |
| 1857 | period measured in milliseconds. This adds to the period specified by | 1944 | period measured in milliseconds. This adds to the period specified by |
| 1858 | @var{seconds}. Not all operating systems support waiting periods other | 1945 | @var{seconds}. If the system doesn't support waiting fractions of a |
| 1859 | than multiples of a second; on those that do not, you get an error if | 1946 | second, you get an error if you specify nonzero @var{millisec}. |
| 1860 | you specify nonzero @var{millisec}. | ||
| 1861 | 1947 | ||
| 1862 | @cindex forcing redisplay | 1948 | @cindex forcing redisplay |
| 1863 | Redisplay is always preempted if input arrives, and does not happen at | 1949 | Redisplay is always preempted if input arrives, and does not happen at |
| @@ -1882,12 +1968,15 @@ This function simply pauses for @var{seconds} seconds without updating | |||
| 1882 | the display. It pays no attention to available input. It returns | 1968 | the display. It pays no attention to available input. It returns |
| 1883 | @code{nil}. | 1969 | @code{nil}. |
| 1884 | 1970 | ||
| 1885 | @c Emacs 19 feature ??? maybe not working yet | 1971 | The argument @var{seconds} need not be an integer. If it is a floating |
| 1972 | point number, @code{sleep-for} waits for a fractional number of seconds. | ||
| 1973 | Some systems support only a whole number of seconds; on these systems, | ||
| 1974 | @var{seconds} is rounded down. | ||
| 1975 | |||
| 1886 | The optional argument @var{millisec} specifies an additional waiting | 1976 | The optional argument @var{millisec} specifies an additional waiting |
| 1887 | period measured in milliseconds. This adds to the period specified by | 1977 | period measured in milliseconds. This adds to the period specified by |
| 1888 | @var{seconds}. Not all operating systems support waiting periods other | 1978 | @var{seconds}. If the system doesn't support waiting fractions of a |
| 1889 | than multiples of a second; on those that do not, you get an error if | 1979 | second, you get an error if you specify nonzero @var{millisec}. |
| 1890 | you specify nonzero @var{millisec}. | ||
| 1891 | 1980 | ||
| 1892 | Use @code{sleep-for} when you wish to guarantee a delay. | 1981 | Use @code{sleep-for} when you wish to guarantee a delay. |
| 1893 | @end defun | 1982 | @end defun |
| @@ -2312,7 +2401,7 @@ the user whether to proceed. | |||
| 2312 | been executed, to make it convenient to repeat these commands. A | 2401 | been executed, to make it convenient to repeat these commands. A |
| 2313 | @dfn{complex command} is one for which the interactive argument reading | 2402 | @dfn{complex command} is one for which the interactive argument reading |
| 2314 | uses the minibuffer. This includes any @kbd{M-x} command, any | 2403 | uses the minibuffer. This includes any @kbd{M-x} command, any |
| 2315 | @kbd{M-ESC} command, and any command whose @code{interactive} | 2404 | @kbd{M-:} command, and any command whose @code{interactive} |
| 2316 | specification reads an argument from the minibuffer. Explicit use of | 2405 | specification reads an argument from the minibuffer. Explicit use of |
| 2317 | the minibuffer during the execution of the command itself does not cause | 2406 | the minibuffer during the execution of the command itself does not cause |
| 2318 | the command to be considered complex. | 2407 | the command to be considered complex. |
| @@ -2374,14 +2463,6 @@ executed once. If it is 0, @var{macro} is executed over and over until it | |||
| 2374 | encounters an error or a failing search. | 2463 | encounters an error or a failing search. |
| 2375 | @end defun | 2464 | @end defun |
| 2376 | 2465 | ||
| 2377 | @defvar last-kbd-macro | ||
| 2378 | This variable is the definition of the most recently defined keyboard | ||
| 2379 | macro. Its value is a string or vector, or @code{nil}. | ||
| 2380 | |||
| 2381 | The variable is always local to the current X terminal and cannot be | ||
| 2382 | buffer-local. @xref{Multiple Displays}. | ||
| 2383 | @end defvar | ||
| 2384 | |||
| 2385 | @defvar executing-macro | 2466 | @defvar executing-macro |
| 2386 | This variable contains the string or vector that defines the keyboard | 2467 | This variable contains the string or vector that defines the keyboard |
| 2387 | macro that is currently executing. It is @code{nil} if no macro is | 2468 | macro that is currently executing. It is @code{nil} if no macro is |
| @@ -2396,7 +2477,15 @@ command can test this variable to behave differently while a macro is | |||
| 2396 | being defined. The commands @code{start-kbd-macro} and | 2477 | being defined. The commands @code{start-kbd-macro} and |
| 2397 | @code{end-kbd-macro} set this variable---do not set it yourself. | 2478 | @code{end-kbd-macro} set this variable---do not set it yourself. |
| 2398 | 2479 | ||
| 2399 | The variable is always local to the current X terminal and cannot be | 2480 | The variable is always local to the current terminal and cannot be |
| 2481 | buffer-local. @xref{Multiple Displays}. | ||
| 2482 | @end defvar | ||
| 2483 | |||
| 2484 | @defvar last-kbd-macro | ||
| 2485 | This variable is the definition of the most recently defined keyboard | ||
| 2486 | macro. Its value is a string or vector, or @code{nil}. | ||
| 2487 | |||
| 2488 | The variable is always local to the current terminal and cannot be | ||
| 2400 | buffer-local. @xref{Multiple Displays}. | 2489 | buffer-local. @xref{Multiple Displays}. |
| 2401 | @end defvar | 2490 | @end defvar |
| 2402 | 2491 | ||
diff --git a/lispref/compile.texi b/lispref/compile.texi index 413adc085a3..7fcaf0f9b76 100644 --- a/lispref/compile.texi +++ b/lispref/compile.texi | |||
| @@ -24,6 +24,12 @@ however, as fast as true compiled code. | |||
| 24 | by recent earlier versions of Emacs, but the reverse is not true. In | 24 | by recent earlier versions of Emacs, but the reverse is not true. In |
| 25 | particular, if you compile a program with Emacs 19.29, the compiled | 25 | particular, if you compile a program with Emacs 19.29, the compiled |
| 26 | code does not run in earlier versions. | 26 | code does not run in earlier versions. |
| 27 | @iftex | ||
| 28 | @xref{Docs and Compilation}. | ||
| 29 | @end iftex | ||
| 30 | Files compiled in versions before 19.29 may not work in 19.29 if they | ||
| 31 | contain character constants with modifier bits, because the bits were | ||
| 32 | renumbered in Emacs 19.29. | ||
| 27 | 33 | ||
| 28 | @xref{Compilation Errors}, for how to investigate errors occurring in | 34 | @xref{Compilation Errors}, for how to investigate errors occurring in |
| 29 | byte compilation. | 35 | byte compilation. |
| @@ -98,10 +104,13 @@ expanded when they are compiled, so the macros must already be defined | |||
| 98 | for proper compilation. For more details, see @ref{Compiling Macros}. | 104 | for proper compilation. For more details, see @ref{Compiling Macros}. |
| 99 | 105 | ||
| 100 | Normally, compiling a file does not evaluate the file's contents or | 106 | Normally, compiling a file does not evaluate the file's contents or |
| 101 | load the file. But it does execute any @code{require} calls at | 107 | load the file. But it does execute any @code{require} calls at top |
| 102 | top level in the file. One way to ensure that necessary macro | 108 | level in the file. One way to ensure that necessary macro definitions |
| 103 | definitions are available during compilation is to require the file that | 109 | are available during compilation is to require the file that defines |
| 104 | defines them. @xref{Features}. | 110 | them (@pxref{Named Features}). To avoid loading the macro definition files |
| 111 | when someone @emph{runs} the compiled program, write | ||
| 112 | @code{eval-when-compile} around the @code{require} calls (@pxref{Eval | ||
| 113 | During Compile}). | ||
| 105 | 114 | ||
| 106 | @defun byte-compile symbol | 115 | @defun byte-compile symbol |
| 107 | This function byte-compiles the function definition of @var{symbol}, | 116 | This function byte-compiles the function definition of @var{symbol}, |
| @@ -191,10 +200,10 @@ This function recompiles every @samp{.el} file in @var{directory} that | |||
| 191 | needs recompilation. A file needs recompilation if a @samp{.elc} file | 200 | needs recompilation. A file needs recompilation if a @samp{.elc} file |
| 192 | exists but is older than the @samp{.el} file. | 201 | exists but is older than the @samp{.el} file. |
| 193 | 202 | ||
| 194 | If a @samp{.el} file exists, but there is no corresponding @samp{.elc} | 203 | When a @samp{.el} file has no corresponding @samp{.elc} file, then |
| 195 | file, then @var{flag} says what to do. If it is @code{nil}, the file is | 204 | @var{flag} says what to do. If it is @code{nil}, these files are |
| 196 | ignored. If it is non-@code{nil}, the user is asked whether to compile | 205 | ignored. If it is non-@code{nil}, the user is asked whether to compile |
| 197 | the file. | 206 | each such file. |
| 198 | 207 | ||
| 199 | The returned value of this command is unpredictable. | 208 | The returned value of this command is unpredictable. |
| 200 | @end deffn | 209 | @end deffn |
| @@ -265,7 +274,7 @@ turn off this feature by setting @code{byte-compile-dynamic-docstrings} | |||
| 265 | to @code{nil}. Once this is done, you can compile files that will load | 274 | to @code{nil}. Once this is done, you can compile files that will load |
| 266 | into older Emacs versions. You can do this globally, or for one source | 275 | into older Emacs versions. You can do this globally, or for one source |
| 267 | file by specifying a file-local binding for the variable. Here's one | 276 | file by specifying a file-local binding for the variable. Here's one |
| 268 | way: | 277 | way to do that: |
| 269 | 278 | ||
| 270 | @example | 279 | @example |
| 271 | -*-byte-compile-dynamic-docstrings: nil;-*- | 280 | -*-byte-compile-dynamic-docstrings: nil;-*- |
| @@ -372,7 +381,7 @@ At top level, this is analogous to the Common Lisp idiom | |||
| 372 | @end defspec | 381 | @end defspec |
| 373 | 382 | ||
| 374 | @node Byte-Code Objects | 383 | @node Byte-Code Objects |
| 375 | @section Byte-Code Objects | 384 | @section Byte-Code Function Objects |
| 376 | @cindex compiled function | 385 | @cindex compiled function |
| 377 | @cindex byte-code function | 386 | @cindex byte-code function |
| 378 | 387 | ||
| @@ -408,10 +417,10 @@ symbols used as function names and variable names. | |||
| 408 | The maximum stack size this function needs. | 417 | The maximum stack size this function needs. |
| 409 | 418 | ||
| 410 | @item docstring | 419 | @item docstring |
| 411 | The documentation string (if any); otherwise, @code{nil}. For functions | 420 | The documentation string (if any); otherwise, @code{nil}. The value may |
| 412 | preloaded before Emacs is dumped, this is usually an integer which is an | 421 | be a number or a list, in case the documentation string is stored in a |
| 413 | index into the @file{DOC} file; use @code{documentation} to convert this | 422 | file. Use the function @code{documentation} to get the real |
| 414 | into a string (@pxref{Accessing Documentation}). | 423 | documentation string (@pxref{Accessing Documentation}). |
| 415 | 424 | ||
| 416 | @item interactive | 425 | @item interactive |
| 417 | The interactive spec (if any). This can be a string or a Lisp | 426 | The interactive spec (if any). This can be a string or a Lisp |
diff --git a/lispref/control.texi b/lispref/control.texi index aea1c535588..c7367894919 100644 --- a/lispref/control.texi +++ b/lispref/control.texi | |||
| @@ -940,11 +940,11 @@ including those signaled with @code{error}: | |||
| 940 | (if (eq baz 35) | 940 | (if (eq baz 35) |
| 941 | t | 941 | t |
| 942 | ;; @r{This is a call to the function @code{error}.} | 942 | ;; @r{This is a call to the function @code{error}.} |
| 943 | (error "Rats! The variable %s was %s, not 35." 'baz baz)) | 943 | (error "Rats! The variable %s was %s, not 35" 'baz baz)) |
| 944 | ;; @r{This is the handler; it is not a form.} | 944 | ;; @r{This is the handler; it is not a form.} |
| 945 | (error (princ (format "The error was: %s" err)) | 945 | (error (princ (format "The error was: %s" err)) |
| 946 | 2)) | 946 | 2)) |
| 947 | @print{} The error was: (error "Rats! The variable baz was 34, not 35.") | 947 | @print{} The error was: (error "Rats! The variable baz was 34, not 35") |
| 948 | @result{} 2 | 948 | @result{} 2 |
| 949 | @end group | 949 | @end group |
| 950 | @end smallexample | 950 | @end smallexample |
| @@ -1005,6 +1005,9 @@ message @samp{peculiar error} is used. | |||
| 1005 | This error has three condition names: @code{new-error}, the narrowest | 1005 | This error has three condition names: @code{new-error}, the narrowest |
| 1006 | classification; @code{my-own-errors}, which we imagine is a wider | 1006 | classification; @code{my-own-errors}, which we imagine is a wider |
| 1007 | classification; and @code{error}, which is the widest of all. | 1007 | classification; and @code{error}, which is the widest of all. |
| 1008 | |||
| 1009 | The error string should start with a capital letter but it should | ||
| 1010 | not end with a period. This is for consistency with the rest of Emacs. | ||
| 1008 | 1011 | ||
| 1009 | Naturally, Emacs will never signal @code{new-error} on its own; only | 1012 | Naturally, Emacs will never signal @code{new-error} on its own; only |
| 1010 | an explicit call to @code{signal} (@pxref{Signaling Errors}) in your | 1013 | an explicit call to @code{signal} (@pxref{Signaling Errors}) in your |
diff --git a/lispref/debugging.texi b/lispref/debugging.texi index 3fa300d02f9..6775323049d 100644 --- a/lispref/debugging.texi +++ b/lispref/debugging.texi | |||
| @@ -172,8 +172,8 @@ for @var{function-name} in the minibuffer. | |||
| 172 | If the function is already set up to invoke the debugger on entry, | 172 | If the function is already set up to invoke the debugger on entry, |
| 173 | @code{debug-on-entry} does nothing. | 173 | @code{debug-on-entry} does nothing. |
| 174 | 174 | ||
| 175 | Caveat: if you redefine a function after using @code{debug-on-entry} | 175 | @strong{Note:} if you redefine a function after using |
| 176 | on it, the code to enter the debugger is lost. | 176 | @code{debug-on-entry} on it, the code to enter the debugger is lost. |
| 177 | 177 | ||
| 178 | @code{debug-on-entry} returns @var{function-name}. | 178 | @code{debug-on-entry} returns @var{function-name}. |
| 179 | 179 | ||
| @@ -217,7 +217,8 @@ Entering: | |||
| 217 | @deffn Command cancel-debug-on-entry function-name | 217 | @deffn Command cancel-debug-on-entry function-name |
| 218 | This function undoes the effect of @code{debug-on-entry} on | 218 | This function undoes the effect of @code{debug-on-entry} on |
| 219 | @var{function-name}. When called interactively, it prompts for | 219 | @var{function-name}. When called interactively, it prompts for |
| 220 | @var{function-name} in the minibuffer. | 220 | @var{function-name} in the minibuffer. If @var{function-name} is |
| 221 | @code{nil} or the empty string, it cancels debugging for all functions. | ||
| 221 | 222 | ||
| 222 | If @code{cancel-debug-on-entry} is called more than once on the same | 223 | If @code{cancel-debug-on-entry} is called more than once on the same |
| 223 | function, the second call does nothing. @code{cancel-debug-on-entry} | 224 | function, the second call does nothing. @code{cancel-debug-on-entry} |
| @@ -329,12 +330,12 @@ cancels a @kbd{b} command on that frame. | |||
| 329 | 330 | ||
| 330 | @item e | 331 | @item e |
| 331 | Read a Lisp expression in the minibuffer, evaluate it, and print the | 332 | Read a Lisp expression in the minibuffer, evaluate it, and print the |
| 332 | value in the echo area. The debugger alters certain important variables | 333 | value in the echo area. The debugger alters certain important |
| 333 | as part of its operation; @kbd{e} temporarily restores their | 334 | variables, and the current buffer, as part of its operation; @kbd{e} |
| 334 | outside-the-debugger values so you can examine them. This makes the | 335 | temporarily restores their outside-the-debugger values so you can |
| 335 | debugger more transparent. By contrast, @kbd{M-@key{ESC}} does nothing | 336 | examine them. This makes the debugger more transparent. By contrast, |
| 336 | special in the debugger; it shows you the variable values within the | 337 | @kbd{M-:} does nothing special in the debugger; it shows you the |
| 337 | debugger. | 338 | variable values within the debugger. |
| 338 | 339 | ||
| 339 | @item q | 340 | @item q |
| 340 | Terminate the program being debugged; return to top-level Emacs | 341 | Terminate the program being debugged; return to top-level Emacs |
| @@ -376,7 +377,7 @@ whatever called @code{debug}. This is the only way the function | |||
| 376 | 377 | ||
| 377 | If the first of the @var{debugger-args} passed to @code{debug} is | 378 | If the first of the @var{debugger-args} passed to @code{debug} is |
| 378 | @code{nil} (or if it is not one of the special values in the table | 379 | @code{nil} (or if it is not one of the special values in the table |
| 379 | below), then @code{debug} displays the rest of its arguments at the the | 380 | below), then @code{debug} displays the rest of its arguments at the |
| 380 | top of the @samp{*Backtrace*} buffer. This mechanism is used to display | 381 | top of the @samp{*Backtrace*} buffer. This mechanism is used to display |
| 381 | a message to the user. | 382 | a message to the user. |
| 382 | 383 | ||
| @@ -564,7 +565,7 @@ This function is used only by the debugger. | |||
| 564 | @end defun | 565 | @end defun |
| 565 | 566 | ||
| 566 | @defvar command-debug-status | 567 | @defvar command-debug-status |
| 567 | This variable records the debugging status of current interactive | 568 | This variable records the debugging status of the current interactive |
| 568 | command. Each time a command is called interactively, this variable is | 569 | command. Each time a command is called interactively, this variable is |
| 569 | bound to @code{nil}. The debugger can set this variable to leave | 570 | bound to @code{nil}. The debugger can set this variable to leave |
| 570 | information for future debugger invocations during the same command. | 571 | information for future debugger invocations during the same command. |
diff --git a/lispref/display.texi b/lispref/display.texi index 146dee69531..8545f23b8c2 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -45,6 +45,11 @@ Even more powerful is @code{redraw-display}: | |||
| 45 | This function clears and redisplays all visible frames. | 45 | This function clears and redisplays all visible frames. |
| 46 | @end deffn | 46 | @end deffn |
| 47 | 47 | ||
| 48 | Processing user input takes absolute priority over redisplay. If you | ||
| 49 | call these functions when input is available, they do nothing | ||
| 50 | immediately, but a full redisplay does happen eventually---after all the | ||
| 51 | input has been processed. | ||
| 52 | |||
| 48 | Normally, suspending and resuming Emacs also refreshes the screen. | 53 | Normally, suspending and resuming Emacs also refreshes the screen. |
| 49 | Some terminal emulators record separate contents for display-oriented | 54 | Some terminal emulators record separate contents for display-oriented |
| 50 | programs such as Emacs and for ordinary sequential display. If you are | 55 | programs such as Emacs and for ordinary sequential display. If you are |
| @@ -59,11 +64,6 @@ has been suspended and resumed. Non-@code{nil} means yes, @code{nil} | |||
| 59 | means no. | 64 | means no. |
| 60 | @end defvar | 65 | @end defvar |
| 61 | 66 | ||
| 62 | Processing user input takes absolute priority over redisplay. If you | ||
| 63 | call these functions when input is available, they do nothing | ||
| 64 | immediately, but a full redisplay does happen eventually---after all the | ||
| 65 | input has been processed. | ||
| 66 | |||
| 67 | @node Screen Size | 67 | @node Screen Size |
| 68 | @section Screen Size | 68 | @section Screen Size |
| 69 | @cindex size of screen | 69 | @cindex size of screen |
| @@ -154,10 +154,10 @@ then truncation is always used for side-by-side windows (within one | |||
| 154 | frame) regardless of the value of @code{truncate-lines}. | 154 | frame) regardless of the value of @code{truncate-lines}. |
| 155 | @end defopt | 155 | @end defopt |
| 156 | 156 | ||
| 157 | @defvar default-truncate-lines | 157 | @defopt default-truncate-lines |
| 158 | This variable is the default value for @code{truncate-lines}, for | 158 | This variable is the default value for @code{truncate-lines}, for |
| 159 | buffers that do not have local values for it. | 159 | buffers that do not have local values for it. |
| 160 | @end defvar | 160 | @end defopt |
| 161 | 161 | ||
| 162 | @defopt truncate-partial-width-windows | 162 | @defopt truncate-partial-width-windows |
| 163 | This variable controls display of lines that extend beyond the right | 163 | This variable controls display of lines that extend beyond the right |
| @@ -171,15 +171,17 @@ with the display table; see @ref{Display Tables}. | |||
| 171 | 171 | ||
| 172 | If your buffer contains @strong{very} long lines, and you use | 172 | If your buffer contains @strong{very} long lines, and you use |
| 173 | continuation to display them, just thinking about them can make Emacs | 173 | continuation to display them, just thinking about them can make Emacs |
| 174 | redisplay slow. | 174 | redisplay slow. The column computation and indentation functions also |
| 175 | become slow. Then you might find it advisable to set | ||
| 176 | @code{cache-long-line-scans} to @code{t}. | ||
| 175 | 177 | ||
| 176 | @defvar cache-long-line-scans | 178 | @defvar cache-long-line-scans |
| 177 | If this variable is non-@code{nil}, various indentation and motion | 179 | If this variable is non-@code{nil}, various indentation and motion |
| 178 | functions, and Emacs redisplay, cache the results of their scans for | 180 | functions, and Emacs redisplay, cache the results of scanning the |
| 179 | newlines, and consult the cache to avoid rescanning regions of the | 181 | buffer, and consult the cache to avoid rescanning regions of the buffer |
| 180 | buffer unless they are modified. | 182 | unless they are modified. |
| 181 | 183 | ||
| 182 | Turning on the newline cache slows down processing of short lines. | 184 | Turning on the cache slows down processing of short lines somewhat. |
| 183 | 185 | ||
| 184 | This variable is automatically local in every buffer. | 186 | This variable is automatically local in every buffer. |
| 185 | @end defvar | 187 | @end defvar |
| @@ -248,6 +250,17 @@ how to display a message and prevent it from being logged: | |||
| 248 | @end example | 250 | @end example |
| 249 | @end defopt | 251 | @end defopt |
| 250 | 252 | ||
| 253 | @defvar echo-keystrokes | ||
| 254 | This variable determines how much time should elapse before command | ||
| 255 | characters echo. Its value must be an integer, which specifies the | ||
| 256 | number of seconds to wait before echoing. If the user types a prefix | ||
| 257 | key (such as @kbd{C-x}) and then delays this many seconds before | ||
| 258 | continuing, the prefix key is echoed in the echo area. Any subsequent | ||
| 259 | characters in the same command will be echoed as well. | ||
| 260 | |||
| 261 | If the value is zero, then command input is not echoed. | ||
| 262 | @end defvar | ||
| 263 | |||
| 251 | @defvar cursor-in-echo-area | 264 | @defvar cursor-in-echo-area |
| 252 | This variable controls where the cursor appears when a message is | 265 | This variable controls where the cursor appears when a message is |
| 253 | displayed in the echo area. If it is non-@code{nil}, then the cursor | 266 | displayed in the echo area. If it is non-@code{nil}, then the cursor |
| @@ -284,7 +297,7 @@ especially useful in a program to display the list of entries in a data | |||
| 284 | base. It permits the implementation of convenient filtering commands to | 297 | base. It permits the implementation of convenient filtering commands to |
| 285 | view just a part of the entries in the data base. Setting this variable | 298 | view just a part of the entries in the data base. Setting this variable |
| 286 | is very fast, much faster than scanning all the text in the buffer | 299 | is very fast, much faster than scanning all the text in the buffer |
| 287 | looking for things to change. | 300 | looking for properties to change. |
| 288 | 301 | ||
| 289 | @defvar buffer-invisibility-spec | 302 | @defvar buffer-invisibility-spec |
| 290 | This variable specifies which kinds of @code{invisible} properties | 303 | This variable specifies which kinds of @code{invisible} properties |
| @@ -314,13 +327,16 @@ by a visible newline, it displays an ellipsis. | |||
| 314 | @end table | 327 | @end table |
| 315 | @end defvar | 328 | @end defvar |
| 316 | 329 | ||
| 330 | Ordinarily, commands that operate on text or move point do not care | ||
| 331 | whether the text is invisible. However, the user-level line motion | ||
| 332 | commands explicitly ignore invisible newlines. | ||
| 333 | |||
| 317 | @node Selective Display | 334 | @node Selective Display |
| 318 | @section Selective Display | 335 | @section Selective Display |
| 319 | @cindex selective display | 336 | @cindex selective display |
| 320 | 337 | ||
| 321 | @dfn{Selective display} is a class of minor modes in which specially | 338 | @dfn{Selective display} is a pair of features that hide certain |
| 322 | marked lines do not appear on the screen, or in which highly indented | 339 | lines on the screen. |
| 323 | lines do not appear. | ||
| 324 | 340 | ||
| 325 | The first variant, explicit selective display, is designed for use in | 341 | The first variant, explicit selective display, is designed for use in |
| 326 | a Lisp program. The program controls which lines are hidden by altering | 342 | a Lisp program. The program controls which lines are hidden by altering |
| @@ -329,7 +345,7 @@ been partially replaced by the invisible text feature (@pxref{Invisible | |||
| 329 | Text}); there is a new version of Outline mode which uses that instead. | 345 | Text}); there is a new version of Outline mode which uses that instead. |
| 330 | 346 | ||
| 331 | In the second variant, the choice of lines to hide is made | 347 | In the second variant, the choice of lines to hide is made |
| 332 | automatically based on indentation. This variant is designed as a | 348 | automatically based on indentation. This variant is designed to be a |
| 333 | user-level feature. | 349 | user-level feature. |
| 334 | 350 | ||
| 335 | The way you control explicit selective display is by replacing a | 351 | The way you control explicit selective display is by replacing a |
| @@ -469,9 +485,7 @@ given time. | |||
| 469 | 485 | ||
| 470 | Temporary displays are used by commands to put output into a buffer | 486 | Temporary displays are used by commands to put output into a buffer |
| 471 | and then present it to the user for perusal rather than for editing. | 487 | and then present it to the user for perusal rather than for editing. |
| 472 | Many of the help commands use this feature. Nowadays you can do the | 488 | Many of the help commands use this feature. |
| 473 | same job by creating an overlay with a @code{before-string} property. | ||
| 474 | @xref{Overlay Properties}. | ||
| 475 | 489 | ||
| 476 | @defspec with-output-to-temp-buffer buffer-name forms@dots{} | 490 | @defspec with-output-to-temp-buffer buffer-name forms@dots{} |
| 477 | This function executes @var{forms} while arranging to insert any | 491 | This function executes @var{forms} while arranging to insert any |
| @@ -539,6 +553,10 @@ the display and later (presumably) move point forward. The argument | |||
| 539 | 553 | ||
| 540 | The return value of @code{momentary-string-display} is not meaningful. | 554 | The return value of @code{momentary-string-display} is not meaningful. |
| 541 | 555 | ||
| 556 | If the string @var{string} does not contain control characters, you can | ||
| 557 | do the same job in a more general way by creating an overlay with a | ||
| 558 | @code{before-string} property. @xref{Overlay Properties}. | ||
| 559 | |||
| 542 | If @var{message} is non-@code{nil}, it is displayed in the echo area | 560 | If @var{message} is non-@code{nil}, it is displayed in the echo area |
| 543 | while @var{string} is displayed in the buffer. If it is @code{nil}, a | 561 | while @var{string} is displayed in the buffer. If it is @code{nil}, a |
| 544 | default message says to type @var{char} to continue. | 562 | default message says to type @var{char} to continue. |
| @@ -580,10 +598,10 @@ Type RET when done reading | |||
| 580 | @cindex overlays | 598 | @cindex overlays |
| 581 | 599 | ||
| 582 | You can use @dfn{overlays} to alter the appearance of a buffer's text on | 600 | You can use @dfn{overlays} to alter the appearance of a buffer's text on |
| 583 | the screen. An overlay is an object that belongs to a particular | 601 | the screen, for the sake of presentation features. An overlay is an |
| 584 | buffer, and has a specified beginning and end. It also has properties | 602 | object that belongs to a particular buffer, and has a specified |
| 585 | that you can examine and set; these affect the display of the text | 603 | beginning and end. It also has properties that you can examine and set; |
| 586 | within the overlay. | 604 | these affect the display of the text within the overlay. |
| 587 | 605 | ||
| 588 | @menu | 606 | @menu |
| 589 | * Overlay Properties:: How to read and set properties. | 607 | * Overlay Properties:: How to read and set properties. |
| @@ -626,7 +644,7 @@ applies only on that window. | |||
| 626 | @item category | 644 | @item category |
| 627 | @kindex category @r{(overlay property)} | 645 | @kindex category @r{(overlay property)} |
| 628 | If an overlay has a @code{category} property, we call it the | 646 | If an overlay has a @code{category} property, we call it the |
| 629 | @dfn{category} of the character. It should be a symbol. The properties | 647 | @dfn{category} of the overlay. It should be a symbol. The properties |
| 630 | of the symbol serve as defaults for the properties of the overlay. | 648 | of the symbol serve as defaults for the properties of the overlay. |
| 631 | 649 | ||
| 632 | @item face | 650 | @item face |
| @@ -662,7 +680,7 @@ overlay, @code{t}, the beginning and end of the text range just | |||
| 662 | modified, and the length of the pre-change text replaced by that range. | 680 | modified, and the length of the pre-change text replaced by that range. |
| 663 | (For an insertion, the pre-change length is zero; for a deletion, that | 681 | (For an insertion, the pre-change length is zero; for a deletion, that |
| 664 | length is the number of characters deleted, and the post-change | 682 | length is the number of characters deleted, and the post-change |
| 665 | beginning and end are at the same place.) | 683 | beginning and end are equal.) |
| 666 | 684 | ||
| 667 | @item insert-in-front-hooks | 685 | @item insert-in-front-hooks |
| 668 | @kindex insert-in-front-hooks @r{(overlay property)} | 686 | @kindex insert-in-front-hooks @r{(overlay property)} |
| @@ -685,7 +703,7 @@ invisible, which means that it does not appear on the screen. | |||
| 685 | @item intangible | 703 | @item intangible |
| 686 | @kindex intangible @r{(overlay property)} | 704 | @kindex intangible @r{(overlay property)} |
| 687 | The @code{intangible} property on an overlay works just like the | 705 | The @code{intangible} property on an overlay works just like the |
| 688 | @code{intangible} text propert. @xref{Special Properties}, for details. | 706 | @code{intangible} text property. @xref{Special Properties}, for details. |
| 689 | 707 | ||
| 690 | @item before-string | 708 | @item before-string |
| 691 | @kindex before-string @r{(overlay property)} | 709 | @kindex before-string @r{(overlay property)} |
| @@ -891,6 +909,10 @@ With overlays. An overlay may have @code{face} and @code{mouse-face} | |||
| 891 | properties too; they apply to all the text covered by the overlay. | 909 | properties too; they apply to all the text covered by the overlay. |
| 892 | 910 | ||
| 893 | @item | 911 | @item |
| 912 | With a region that is active. In Transient Mark mode, the region is | ||
| 913 | highlighted with a particular face (see @code{region-face}, below). | ||
| 914 | |||
| 915 | @item | ||
| 894 | With special glyphs. Each glyph can specify a particular face id | 916 | With special glyphs. Each glyph can specify a particular face id |
| 895 | number. @xref{Glyphs}. | 917 | number. @xref{Glyphs}. |
| 896 | @end itemize | 918 | @end itemize |
| @@ -898,6 +920,7 @@ number. @xref{Glyphs}. | |||
| 898 | If these various sources together specify more than one face for a | 920 | If these various sources together specify more than one face for a |
| 899 | particular character, Emacs merges the attributes of the various faces | 921 | particular character, Emacs merges the attributes of the various faces |
| 900 | specified. The attributes of the faces of special glyphs come first; | 922 | specified. The attributes of the faces of special glyphs come first; |
| 923 | then comes the face for region highlighting, if appropriate; | ||
| 901 | then come attributes of faces from overlays, followed by those from text | 924 | then come attributes of faces from overlays, followed by those from text |
| 902 | properties, and last the default face. | 925 | properties, and last the default face. |
| 903 | 926 | ||
| @@ -951,6 +974,19 @@ new frames. | |||
| 951 | These functions set the foreground (or background, respectively) color | 974 | These functions set the foreground (or background, respectively) color |
| 952 | of face @var{face} to @var{color}. The argument @var{color} should be a | 975 | of face @var{face} to @var{color}. The argument @var{color} should be a |
| 953 | string, the name of a color. | 976 | string, the name of a color. |
| 977 | |||
| 978 | Certain shades of gray are implemented by stipple patterns on | ||
| 979 | black-and-white screens. | ||
| 980 | @end defun | ||
| 981 | |||
| 982 | @defun set-face-stipple face pattern &optional frame | ||
| 983 | This function sets the background stipple pattern of face @var{face} to | ||
| 984 | @var{pattern}. The argument @var{pattern} should be the name of a | ||
| 985 | stipple pattern defined by the X server, or @code{nil} meaning don't use | ||
| 986 | stipple. | ||
| 987 | |||
| 988 | Normally there is no need to pay attention to stipple patterns, because | ||
| 989 | they are used automatically to handle certain shades of gray. | ||
| 954 | @end defun | 990 | @end defun |
| 955 | 991 | ||
| 956 | @defun set-face-font face font &optional frame | 992 | @defun set-face-font face font &optional frame |
| @@ -979,6 +1015,11 @@ These functions return the foreground color (or background color, | |||
| 979 | respectively) of face @var{face}, as a string. | 1015 | respectively) of face @var{face}, as a string. |
| 980 | @end defun | 1016 | @end defun |
| 981 | 1017 | ||
| 1018 | @defun face-stipple face &optional frame | ||
| 1019 | This function returns the name of the background stipple pattern of face | ||
| 1020 | @var{face}, or @code{nil} if it doesn't have one. | ||
| 1021 | @end defun | ||
| 1022 | |||
| 982 | @defun face-font face &optional frame | 1023 | @defun face-font face &optional frame |
| 983 | This function returns the name of the font of face @var{face}. | 1024 | This function returns the name of the font of face @var{face}. |
| 984 | @end defun | 1025 | @end defun |
| @@ -987,7 +1028,7 @@ This function returns the name of the font of face @var{face}. | |||
| 987 | This function returns the underline attribute of face @var{face}. | 1028 | This function returns the underline attribute of face @var{face}. |
| 988 | @end defun | 1029 | @end defun |
| 989 | 1030 | ||
| 990 | @defun face-id-number face | 1031 | @defun face-id face |
| 991 | This function returns the face id number of face @var{face}. | 1032 | This function returns the face id number of face @var{face}. |
| 992 | @end defun | 1033 | @end defun |
| 993 | 1034 | ||
| @@ -1048,6 +1089,12 @@ This variable specifies the maximum distance to scan for a matching | |||
| 1048 | parenthesis before giving up. | 1089 | parenthesis before giving up. |
| 1049 | @end defvar | 1090 | @end defvar |
| 1050 | 1091 | ||
| 1092 | @defvar blink-matching-paren-delay | ||
| 1093 | This variable specifies the number of seconds for the cursor to remain | ||
| 1094 | at the matching parenthesis. A fraction of a second often gives | ||
| 1095 | good results, but the default is 1, which works on all systems. | ||
| 1096 | @end defvar | ||
| 1097 | |||
| 1051 | @defun blink-matching-open | 1098 | @defun blink-matching-open |
| 1052 | This function is the default value of @code{blink-paren-function}. It | 1099 | This function is the default value of @code{blink-paren-function}. It |
| 1053 | assumes that point follows a character with close parenthesis syntax and | 1100 | assumes that point follows a character with close parenthesis syntax and |
| @@ -1089,10 +1136,13 @@ default is @code{nil}. | |||
| 1089 | 1136 | ||
| 1090 | @defopt mode-line-inverse-video | 1137 | @defopt mode-line-inverse-video |
| 1091 | This variable controls the use of inverse video for mode lines. If it | 1138 | This variable controls the use of inverse video for mode lines. If it |
| 1092 | is non-@code{nil}, then mode lines are displayed in inverse video (under | 1139 | is non-@code{nil}, then mode lines are displayed in inverse video. |
| 1093 | X, this uses the face named @code{modeline}, which you can set as you | 1140 | Otherwise, mode lines are displayed normally, just like text. The |
| 1094 | wish). Otherwise, mode lines are displayed normally, just like text. | 1141 | default is @code{t}. |
| 1095 | The default is @code{t}. | 1142 | |
| 1143 | For X window frames, this displays mode lines using the face named | ||
| 1144 | @code{modeline}, which is normally the inverse of the default face | ||
| 1145 | unless you change it. | ||
| 1096 | @end defopt | 1146 | @end defopt |
| 1097 | 1147 | ||
| 1098 | @node Usual Display | 1148 | @node Usual Display |
| @@ -1132,7 +1182,7 @@ specify a glyph to use instead of @samp{\}.) | |||
| 1132 | The usual display conventions apply even when there is a display | 1182 | The usual display conventions apply even when there is a display |
| 1133 | table, for any character whose entry in the active display table is | 1183 | table, for any character whose entry in the active display table is |
| 1134 | @code{nil}. Thus, when you set up a display table, you need only | 1184 | @code{nil}. Thus, when you set up a display table, you need only |
| 1135 | specify the the characters for which you want unusual behavior. | 1185 | specify the characters for which you want unusual behavior. |
| 1136 | 1186 | ||
| 1137 | These variables affect the way certain characters are displayed on the | 1187 | These variables affect the way certain characters are displayed on the |
| 1138 | screen. Since they change the number of columns the characters occupy, | 1188 | screen. Since they change the number of columns the characters occupy, |
| @@ -1390,11 +1440,6 @@ running under X) or @code{nil} (if Emacs is running on an ordinary | |||
| 1390 | terminal). | 1440 | terminal). |
| 1391 | @end defvar | 1441 | @end defvar |
| 1392 | 1442 | ||
| 1393 | @defvar window-system-version | ||
| 1394 | This variable distinguishes between different versions of the X Window | ||
| 1395 | System. Its value is 10 or 11 when using X; @code{nil} otherwise. | ||
| 1396 | @end defvar | ||
| 1397 | |||
| 1398 | @defvar window-setup-hook | 1443 | @defvar window-setup-hook |
| 1399 | This variable is a normal hook which Emacs runs after loading your | 1444 | This variable is a normal hook which Emacs runs after loading your |
| 1400 | @file{.emacs} file and the default initialization file (if any), after | 1445 | @file{.emacs} file and the default initialization file (if any), after |
diff --git a/lispref/edebug.texi b/lispref/edebug.texi index f32b516199e..5aec9f96f46 100644 --- a/lispref/edebug.texi +++ b/lispref/edebug.texi | |||
| @@ -214,7 +214,7 @@ must tell it; @xref{Instrumenting Macro Calls}, for details. | |||
| 214 | definition in a way that does not instrument. There are two ways of | 214 | definition in a way that does not instrument. There are two ways of |
| 215 | evaluating forms that never instrument them: from a file with | 215 | evaluating forms that never instrument them: from a file with |
| 216 | @code{load}, and from the minibuffer with @code{eval-expression} | 216 | @code{load}, and from the minibuffer with @code{eval-expression} |
| 217 | (@kbd{M-ESC}). | 217 | (@kbd{M-:}). |
| 218 | 218 | ||
| 219 | If Edebug detects a syntax error while instrumenting, it leaves point | 219 | If Edebug detects a syntax error while instrumenting, it leaves point |
| 220 | at the erroneous code and signals an @code{invalid-read-syntax} error. | 220 | at the erroneous code and signals an @code{invalid-read-syntax} error. |
| @@ -626,7 +626,7 @@ Evaluate expression @var{exp} in the context outside of Edebug | |||
| 626 | (@code{edebug-eval-expression}). That is, Edebug tries to minimize its | 626 | (@code{edebug-eval-expression}). That is, Edebug tries to minimize its |
| 627 | interference with the evaluation. | 627 | interference with the evaluation. |
| 628 | 628 | ||
| 629 | @item M-@key{ESC} @var{exp} @key{RET} | 629 | @item M-: @var{exp} @key{RET} |
| 630 | Evaluate expression @var{exp} in the context of Edebug itself. | 630 | Evaluate expression @var{exp} in the context of Edebug itself. |
| 631 | 631 | ||
| 632 | @item C-x C-e | 632 | @item C-x C-e |
diff --git a/lispref/elisp.texi b/lispref/elisp.texi index e1e21b9417c..5ac4053d662 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi | |||
| @@ -180,8 +180,6 @@ Appendices | |||
| 180 | * Standard Keymaps:: List of standard keymaps. | 180 | * Standard Keymaps:: List of standard keymaps. |
| 181 | * Standard Hooks:: List of standard hook variables. | 181 | * Standard Hooks:: List of standard hook variables. |
| 182 | 182 | ||
| 183 | * Antinews:: Information about Emacs 18. | ||
| 184 | |||
| 185 | * Index:: Index including concepts, functions, variables, | 183 | * Index:: Index including concepts, functions, variables, |
| 186 | and other terms. | 184 | and other terms. |
| 187 | 185 | ||
| @@ -422,7 +420,7 @@ Loading | |||
| 422 | 420 | ||
| 423 | * How Programs Do Loading:: The @code{load} function and others. | 421 | * How Programs Do Loading:: The @code{load} function and others. |
| 424 | * Autoload:: Setting up a function to autoload. | 422 | * Autoload:: Setting up a function to autoload. |
| 425 | * Features:: Loading a library if it isn't already loaded. | 423 | * Named Features:: Loading a library if it isn't already loaded. |
| 426 | * Repeated Loading:: Precautions about loading a file twice. | 424 | * Repeated Loading:: Precautions about loading a file twice. |
| 427 | 425 | ||
| 428 | Byte Compilation | 426 | Byte Compilation |
| @@ -650,6 +648,32 @@ Windows | |||
| 650 | * Resizing Windows:: Changing the size of a window. | 648 | * Resizing Windows:: Changing the size of a window. |
| 651 | * Window Configurations:: Saving and restoring the state of the screen. | 649 | * Window Configurations:: Saving and restoring the state of the screen. |
| 652 | 650 | ||
| 651 | Frames | ||
| 652 | |||
| 653 | * Creating Frames:: Creating additional frames. | ||
| 654 | * Multiple Displays:: Creating frames on other X displays. | ||
| 655 | * Frame Parameters:: Controlling frame size, position, font, etc. | ||
| 656 | * Frame Titles:: Automatic updating of frame titles. | ||
| 657 | * Deleting Frames:: Frames last until explicitly deleted. | ||
| 658 | * Finding All Frames:: How to examine all existing frames. | ||
| 659 | * Frames and Windows:: A frame contains windows; | ||
| 660 | display of text always works through windows. | ||
| 661 | * Minibuffers and Frames:: How a frame finds the minibuffer to use. | ||
| 662 | * Input Focus:: Specifying the selected frame. | ||
| 663 | * Visibility of Frames:: Frames may be visible or invisible, or icons. | ||
| 664 | * Raising and Lowering:: Raising a frame makes it hide other X windows; | ||
| 665 | lowering it makes the others hide them. | ||
| 666 | * Frame Configurations:: Saving the state of all frames. | ||
| 667 | * Mouse Tracking:: Getting events that say when the mouse moves. | ||
| 668 | * Mouse Position:: Asking where the mouse is, or moving it. | ||
| 669 | * Pop-Up Menus:: Displaying a menu for the user to select from. | ||
| 670 | * Dialog Boxes:: Displaying a box to ask yes or no. | ||
| 671 | * Pointer Shapes:: Specifying the shape of the mouse pointer. | ||
| 672 | * X Selections:: Transferring text to and from other X clients. | ||
| 673 | * Color Names:: Getting the definitions of color names. | ||
| 674 | * Resources:: Getting resource values from the server. | ||
| 675 | * Server Data:: Getting info about the X server. | ||
| 676 | |||
| 653 | Positions | 677 | Positions |
| 654 | 678 | ||
| 655 | * Point:: The special position where editing takes place. | 679 | * Point:: The special position where editing takes place. |
| @@ -664,8 +688,6 @@ Motion | |||
| 664 | * Buffer End Motion:: Moving to the beginning or end of the buffer. | 688 | * Buffer End Motion:: Moving to the beginning or end of the buffer. |
| 665 | * Text Lines:: Moving in terms of lines of text. | 689 | * Text Lines:: Moving in terms of lines of text. |
| 666 | * Screen Lines:: Moving in terms of lines as displayed. | 690 | * Screen Lines:: Moving in terms of lines as displayed. |
| 667 | * Vertical Motion:: Implementation of @code{next-line} and | ||
| 668 | @code{previous-line}. | ||
| 669 | * List Motion:: Moving by parsing lists and sexps. | 691 | * List Motion:: Moving by parsing lists and sexps. |
| 670 | * Skipping Characters:: Skipping characters belonging to a certain set. | 692 | * Skipping Characters:: Skipping characters belonging to a certain set. |
| 671 | 693 | ||
| @@ -693,6 +715,7 @@ Text | |||
| 693 | * Undo:: Undoing changes to the text of a buffer. | 715 | * Undo:: Undoing changes to the text of a buffer. |
| 694 | * Auto Filling:: How auto-fill mode is implemented to break lines. | 716 | * Auto Filling:: How auto-fill mode is implemented to break lines. |
| 695 | * Filling:: Functions for explicit filling. | 717 | * Filling:: Functions for explicit filling. |
| 718 | * Margins:: How to specify margins for filling commands. | ||
| 696 | * Sorting:: Functions for sorting parts of the buffer. | 719 | * Sorting:: Functions for sorting parts of the buffer. |
| 697 | * Indentation:: Functions to insert or adjust indentation. | 720 | * Indentation:: Functions to insert or adjust indentation. |
| 698 | * Columns:: Computing horizontal positions, and using them. | 721 | * Columns:: Computing horizontal positions, and using them. |
| @@ -769,7 +792,7 @@ Processes | |||
| 769 | an asynchronous subprocess. | 792 | an asynchronous subprocess. |
| 770 | * Output from Processes:: Collecting output from an asynchronous subprocess. | 793 | * Output from Processes:: Collecting output from an asynchronous subprocess. |
| 771 | * Sentinels:: Sentinels run when process run-status changes. | 794 | * Sentinels:: Sentinels run when process run-status changes. |
| 772 | * TCP:: Opening network connections. | 795 | * Network:: Opening network connections. |
| 773 | 796 | ||
| 774 | Receiving Output from Processes | 797 | Receiving Output from Processes |
| 775 | 798 | ||
| @@ -886,7 +909,6 @@ Object Internals | |||
| 886 | @include locals.texi | 909 | @include locals.texi |
| 887 | @include maps.texi | 910 | @include maps.texi |
| 888 | @include hooks.texi | 911 | @include hooks.texi |
| 889 | @include anti.texi | ||
| 890 | 912 | ||
| 891 | @include index.texi | 913 | @include index.texi |
| 892 | 914 | ||
diff --git a/lispref/errors.texi b/lispref/errors.texi index 8cedced5c32..36290012285 100644 --- a/lispref/errors.texi +++ b/lispref/errors.texi | |||
| @@ -52,6 +52,10 @@ See @code{/} and @code{%} in @ref{Numbers}. | |||
| 52 | @code{"Buffer is read-only"}@* | 52 | @code{"Buffer is read-only"}@* |
| 53 | @xref{Read Only Buffers}. | 53 | @xref{Read Only Buffers}. |
| 54 | 54 | ||
| 55 | @item cyclic-function-indirection | ||
| 56 | @code{"Symbol's chain of function indirections contains a loop"}@* | ||
| 57 | @xref{Function Indirection}. | ||
| 58 | |||
| 55 | @item end-of-buffer | 59 | @item end-of-buffer |
| 56 | @code{"End of buffer"}@* | 60 | @code{"End of buffer"}@* |
| 57 | @xref{Motion}. | 61 | @xref{Motion}. |
| @@ -105,6 +109,10 @@ The values of the symbols @code{nil} and @code{t} | |||
| 105 | may not be changed.@* | 109 | may not be changed.@* |
| 106 | @xref{Constant Variables, , Variables that Never Change}. | 110 | @xref{Constant Variables, , Variables that Never Change}. |
| 107 | 111 | ||
| 112 | @item undefined-color | ||
| 113 | @code{"Undefined color"}@* | ||
| 114 | @xref{Color Names}. | ||
| 115 | |||
| 108 | @item void-function | 116 | @item void-function |
| 109 | @code{"Symbol's function definition is void"}@* | 117 | @code{"Symbol's function definition is void"}@* |
| 110 | @xref{Function Cells}. | 118 | @xref{Function Cells}. |
| @@ -121,3 +129,29 @@ may not be changed.@* | |||
| 121 | @code{"Wrong type argument"}@* | 129 | @code{"Wrong type argument"}@* |
| 122 | @xref{Type Predicates}. | 130 | @xref{Type Predicates}. |
| 123 | @end table | 131 | @end table |
| 132 | |||
| 133 | These error types, which are all classified as special cases of | ||
| 134 | @code{arith-error}, can occur on certain systems for invalid use of | ||
| 135 | mathematical functions. | ||
| 136 | |||
| 137 | @table @code | ||
| 138 | @item domain-error | ||
| 139 | @code{"Arithmetic domain error"}@* | ||
| 140 | @xref{Math Functions}. | ||
| 141 | |||
| 142 | @item overflow-error | ||
| 143 | @code{"Arithmetic overflow error"}@* | ||
| 144 | @xref{Math Functions}. | ||
| 145 | |||
| 146 | @item range-error | ||
| 147 | @code{"Arithmetic range error"}@* | ||
| 148 | @xref{Math Functions}. | ||
| 149 | |||
| 150 | @item singularity-error | ||
| 151 | @code{"Arithmetic singularity error"}@* | ||
| 152 | @xref{Math Functions}. | ||
| 153 | |||
| 154 | @item underflow-error | ||
| 155 | @code{"Arithmetic underflow error"}@* | ||
| 156 | @xref{Math Functions}. | ||
| 157 | @end table | ||
diff --git a/lispref/eval.texi b/lispref/eval.texi index 1bbd672f5fc..494a8145baf 100644 --- a/lispref/eval.texi +++ b/lispref/eval.texi | |||
| @@ -73,6 +73,12 @@ of the form @code{(car x)}: the subform @code{x} must first be evaluated | |||
| 73 | recursively, so that its value can be passed as an argument to the | 73 | recursively, so that its value can be passed as an argument to the |
| 74 | function @code{car}. | 74 | function @code{car}. |
| 75 | 75 | ||
| 76 | Evaluation of a function call ultimately calls the function specified | ||
| 77 | in it. @xref{Functions}. The execution of the function may itself work | ||
| 78 | by evaluating the function definition; or the function may be a Lisp | ||
| 79 | primitive implemented in C, or it may be a byte-compiled function | ||
| 80 | (@pxref{Byte Compilation}). | ||
| 81 | |||
| 76 | @cindex environment | 82 | @cindex environment |
| 77 | The evaluation of forms takes place in a context called the | 83 | The evaluation of forms takes place in a context called the |
| 78 | @dfn{environment}, which consists of the current values and bindings of | 84 | @dfn{environment}, which consists of the current values and bindings of |
| @@ -90,17 +96,12 @@ is complete. The form may also make changes that persist; these changes | |||
| 90 | are called @dfn{side effects}. An example of a form that produces side | 96 | are called @dfn{side effects}. An example of a form that produces side |
| 91 | effects is @code{(setq foo 1)}. | 97 | effects is @code{(setq foo 1)}. |
| 92 | 98 | ||
| 93 | Finally, evaluation of one particular function call, @code{byte-code}, | ||
| 94 | invokes the @dfn{byte-code interpreter} on its arguments. Although the | ||
| 95 | byte-code interpreter is not the same as the Lisp interpreter, it uses | ||
| 96 | the same environment as the Lisp interpreter, and may on occasion invoke | ||
| 97 | the Lisp interpreter. (@xref{Byte Compilation}.) | ||
| 98 | |||
| 99 | The details of what evaluation means for each kind of form are | 99 | The details of what evaluation means for each kind of form are |
| 100 | described below (@pxref{Forms}). | 100 | described below (@pxref{Forms}). |
| 101 | 101 | ||
| 102 | @node Eval | 102 | @node Eval |
| 103 | @section Eval | 103 | @section Eval |
| 104 | @c ??? Perhaps this should be the last section in the chapter. | ||
| 104 | 105 | ||
| 105 | Most often, forms are evaluated automatically, by virtue of their | 106 | Most often, forms are evaluated automatically, by virtue of their |
| 106 | occurrence in a program being run. On rare occasions, you may need to | 107 | occurrence in a program being run. On rare occasions, you may need to |
| @@ -108,10 +109,14 @@ write code that evaluates a form that is computed at run time, such as | |||
| 108 | after reading a form from text being edited or getting one from a | 109 | after reading a form from text being edited or getting one from a |
| 109 | property list. On these occasions, use the @code{eval} function. | 110 | property list. On these occasions, use the @code{eval} function. |
| 110 | 111 | ||
| 111 | The functions and variables described in this section evaluate | 112 | @strong{Note:} it is generally cleaner and more flexible to call |
| 112 | forms, specify limits to the evaluation process, or record recently | 113 | functions that are stored in data structures, rather than to evaluate |
| 113 | returned values. Loading a file also does evaluation | 114 | expressions stored in data structures. Using functions provides the |
| 114 | (@pxref{Loading}). | 115 | ability to pass information to them as arguments. |
| 116 | |||
| 117 | The functions and variables described in this section evaluate forms, | ||
| 118 | specify limits to the evaluation process, or record recently returned | ||
| 119 | values. Loading a file also does evaluation (@pxref{Loading}). | ||
| 115 | 120 | ||
| 116 | @defun eval form | 121 | @defun eval form |
| 117 | This is the basic function for performing evaluation. It evaluates | 122 | This is the basic function for performing evaluation. It evaluates |
| @@ -143,19 +148,6 @@ The number of currently active calls to @code{eval} is limited to | |||
| 143 | @code{max-lisp-eval-depth} (see below). | 148 | @code{max-lisp-eval-depth} (see below). |
| 144 | @end defun | 149 | @end defun |
| 145 | 150 | ||
| 146 | @cindex evaluation of buffer contents | ||
| 147 | @deffn Command eval-current-buffer &optional stream | ||
| 148 | This function evaluates the forms in the current buffer. It reads | ||
| 149 | forms from the buffer and calls @code{eval} on them until the end of the | ||
| 150 | buffer is reached, or until an error is signaled and not handled. | ||
| 151 | |||
| 152 | If @var{stream} is supplied, the variable @code{standard-output} is | ||
| 153 | bound to @var{stream} during the evaluation (@pxref{Output | ||
| 154 | Functions}). | ||
| 155 | |||
| 156 | @code{eval-current-buffer} always returns @code{nil}. | ||
| 157 | @end deffn | ||
| 158 | |||
| 159 | @deffn Command eval-region start end &optional stream | 151 | @deffn Command eval-region start end &optional stream |
| 160 | This function evaluates the forms in the current buffer in the region | 152 | This function evaluates the forms in the current buffer in the region |
| 161 | defined by the positions @var{start} and @var{end}. It reads forms from | 153 | defined by the positions @var{start} and @var{end}. It reads forms from |
| @@ -172,6 +164,12 @@ expressions. @xref{How Programs Do Loading}. | |||
| 172 | @code{eval-region} always returns @code{nil}. | 164 | @code{eval-region} always returns @code{nil}. |
| 173 | @end deffn | 165 | @end deffn |
| 174 | 166 | ||
| 167 | @cindex evaluation of buffer contents | ||
| 168 | @deffn Command eval-current-buffer &optional stream | ||
| 169 | This is like @code{eval-region} except that it operates on the whole | ||
| 170 | buffer. | ||
| 171 | @end deffn | ||
| 172 | |||
| 175 | @defvar max-lisp-eval-depth | 173 | @defvar max-lisp-eval-depth |
| 176 | This variable defines the maximum depth allowed in calls to @code{eval}, | 174 | This variable defines the maximum depth allowed in calls to @code{eval}, |
| 177 | @code{apply}, and @code{funcall} before an error is signaled (with error | 175 | @code{apply}, and @code{funcall} before an error is signaled (with error |
| @@ -296,9 +294,9 @@ unchanged. | |||
| 296 | It is common to write numbers, characters, strings, and even vectors | 294 | It is common to write numbers, characters, strings, and even vectors |
| 297 | in Lisp code, taking advantage of the fact that they self-evaluate. | 295 | in Lisp code, taking advantage of the fact that they self-evaluate. |
| 298 | However, it is quite unusual to do this for types that lack a read | 296 | However, it is quite unusual to do this for types that lack a read |
| 299 | syntax, because there's no way to write them textually; however, it is | 297 | syntax, because there's no way to write them textually. It is possible |
| 300 | possible to construct Lisp expressions containing these types by means | 298 | to construct Lisp expressions containing these types by means of a Lisp |
| 301 | of a Lisp program. Here is an example: | 299 | program. Here is an example: |
| 302 | 300 | ||
| 303 | @example | 301 | @example |
| 304 | @group | 302 | @group |
| @@ -654,14 +652,15 @@ definition loaded from that file. @xref{Autoload}. | |||
| 654 | @section Quoting | 652 | @section Quoting |
| 655 | @cindex quoting | 653 | @cindex quoting |
| 656 | 654 | ||
| 657 | The special form @code{quote} returns its single argument | 655 | The special form @code{quote} returns its single argument, as written, |
| 658 | ``unchanged''. | 656 | without evaluating it. This provides a way to include constant symbols |
| 657 | and lists, which are not self-evaluating objects, in a program. (It is | ||
| 658 | not necessary to quote self-evaluating objects such as numbers, strings, | ||
| 659 | and vectors.) | ||
| 659 | 660 | ||
| 660 | @defspec quote object | 661 | @defspec quote object |
| 661 | This special form returns @var{object}, without evaluating it. This | 662 | This special form returns @var{object}, without evaluating it. |
| 662 | provides a way to include constant symbols and lists, which are not | 663 | @end defspec |
| 663 | self-evaluating objects, in a program. (It is not necessary to quote | ||
| 664 | self-evaluating objects such as numbers, strings, and vectors.) | ||
| 665 | 664 | ||
| 666 | @cindex @samp{'} for quoting | 665 | @cindex @samp{'} for quoting |
| 667 | @cindex quoting using apostrophe | 666 | @cindex quoting using apostrophe |
| @@ -700,9 +699,8 @@ Here are some examples of expressions that use @code{quote}: | |||
| 700 | @result{} [(quote foo)] | 699 | @result{} [(quote foo)] |
| 701 | @end group | 700 | @end group |
| 702 | @end example | 701 | @end example |
| 703 | @end defspec | ||
| 704 | 702 | ||
| 705 | Other quoting constructs include @code{function} (@pxref{Anonymous | 703 | Other quoting constructs include @code{function} (@pxref{Anonymous |
| 706 | Functions}), which causes an anonymous lambda expression written in Lisp | 704 | Functions}), which causes an anonymous lambda expression written in Lisp |
| 707 | to be compiled, and @code{`} (@pxref{Backquote}), which is used to quote | 705 | to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote |
| 708 | only part of a list, while computing and substituting other parts. | 706 | only part of a list, while computing and substituting other parts. |
diff --git a/lispref/files.texi b/lispref/files.texi index cfcab286d7b..1fa70df853d 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -79,6 +79,11 @@ For historical reasons, these functions have names starting with | |||
| 79 | functions and variables that access the visited file name of a buffer or | 79 | functions and variables that access the visited file name of a buffer or |
| 80 | that find an existing buffer by its visited file name. | 80 | that find an existing buffer by its visited file name. |
| 81 | 81 | ||
| 82 | In a Lisp program, if you want to look at the contents of a file but | ||
| 83 | not alter it, the fastest way is to use @code{insert-file-contents} in a | ||
| 84 | temporary buffer. Visiting the file is not necessary and takes longer. | ||
| 85 | @xref{Reading from Files}. | ||
| 86 | |||
| 82 | @deffn Command find-file filename | 87 | @deffn Command find-file filename |
| 83 | This command selects a buffer visiting the file @var{filename}, | 88 | This command selects a buffer visiting the file @var{filename}, |
| 84 | using an existing buffer if there is one, and otherwise creating a | 89 | using an existing buffer if there is one, and otherwise creating a |
| @@ -132,16 +137,6 @@ visiting the file @var{filename}. | |||
| 132 | @end example | 137 | @end example |
| 133 | @end defun | 138 | @end defun |
| 134 | 139 | ||
| 135 | @deffn Command find-alternate-file filename | ||
| 136 | This command selects a buffer visiting the file @var{filename}, then | ||
| 137 | kills the buffer that was previously displayed in the selected window. | ||
| 138 | It is useful if you have visited the wrong file by mistake, so that you | ||
| 139 | can get rid of the buffer that you did not want to create, at the same | ||
| 140 | time as you visit the file you intended. | ||
| 141 | |||
| 142 | When this command is called interactively, it prompts for @var{filename}. | ||
| 143 | @end deffn | ||
| 144 | |||
| 145 | @deffn Command find-file-other-window filename | 140 | @deffn Command find-file-other-window filename |
| 146 | This command selects a buffer visiting the file @var{filename}, but | 141 | This command selects a buffer visiting the file @var{filename}, but |
| 147 | does so in a window other than the selected window. It may use another | 142 | does so in a window other than the selected window. It may use another |
| @@ -161,10 +156,11 @@ When this command is called interactively, it prompts for | |||
| 161 | @end deffn | 156 | @end deffn |
| 162 | 157 | ||
| 163 | @deffn Command view-file filename | 158 | @deffn Command view-file filename |
| 164 | This command visits @var{filename} in View mode, returning to the | 159 | This command visits @var{filename} in View mode, and displays it in a |
| 165 | previous buffer when done. View mode is a mode that allows you to skim | 160 | recursive edit, returning to the previous buffer when done. View mode |
| 166 | rapidly through the file but does not let you modify it. Entering View | 161 | is a mode that allows you to skim rapidly through the file but does not |
| 167 | mode runs the normal hook @code{view-mode-hook}. @xref{Hooks}. | 162 | let you modify it. Entering View mode runs the normal hook |
| 163 | @code{view-mode-hook}. @xref{Hooks}. | ||
| 168 | 164 | ||
| 169 | When @code{view-file} is called interactively, it prompts for | 165 | When @code{view-file} is called interactively, it prompts for |
| 170 | @var{filename}. | 166 | @var{filename}. |
| @@ -208,6 +204,7 @@ as the name if that name is free; otherwise, it appends a string such as | |||
| 208 | 204 | ||
| 209 | @strong{Please note:} @code{create-file-buffer} does @emph{not} | 205 | @strong{Please note:} @code{create-file-buffer} does @emph{not} |
| 210 | associate the new buffer with a file and does not select the buffer. | 206 | associate the new buffer with a file and does not select the buffer. |
| 207 | It also does not use the default major mode. | ||
| 211 | 208 | ||
| 212 | @example | 209 | @example |
| 213 | @group | 210 | @group |
| @@ -368,9 +365,11 @@ the intended name after it is clear there are no errors. This procedure | |||
| 368 | prevents problems such as a lack of disk space from resulting in an | 365 | prevents problems such as a lack of disk space from resulting in an |
| 369 | invalid file. | 366 | invalid file. |
| 370 | 367 | ||
| 371 | (This feature worked differently in older Emacs versions.) | 368 | As a side effect, backups must be made by copying. |
| 369 | @xref{Rename or Copy}. | ||
| 372 | 370 | ||
| 373 | Some modes set this non-@code{nil} locally in particular buffers. | 371 | Some modes set this variable non-@code{nil} locally in particular |
| 372 | buffers. | ||
| 374 | @end defvar | 373 | @end defvar |
| 375 | 374 | ||
| 376 | @defopt require-final-newline | 375 | @defopt require-final-newline |
| @@ -401,9 +400,11 @@ current buffer after point. It returns a list of the absolute file name | |||
| 401 | and the length of the data inserted. An error is signaled if | 400 | and the length of the data inserted. An error is signaled if |
| 402 | @var{filename} is not the name of a file that can be read. | 401 | @var{filename} is not the name of a file that can be read. |
| 403 | 402 | ||
| 404 | To set up saved text properties, @code{insert-file-contents} calls the | 403 | The function @code{insert-file-contents} checks the file contents |
| 405 | functions in the list @code{after-insert-file-functions}. For more | 404 | against the defined file formats, and converts the file contents if |
| 406 | information, see @ref{Saving Properties}. | 405 | appropriate. @xref{Format Conversion}. It also calls the functions in |
| 406 | the list @code{after-insert-file-functions}; see @ref{Saving | ||
| 407 | Properties}. | ||
| 407 | 408 | ||
| 408 | If @var{visit} is non-@code{nil}, this function additionally marks the | 409 | If @var{visit} is non-@code{nil}, this function additionally marks the |
| 409 | buffer as unmodified and sets up various fields in the buffer so that it | 410 | buffer as unmodified and sets up various fields in the buffer so that it |
| @@ -427,10 +428,6 @@ contents of the buffer (actually, just the accessible portion) with the | |||
| 427 | contents of the file. This is better than simply deleting the buffer | 428 | contents of the file. This is better than simply deleting the buffer |
| 428 | contents and inserting the whole file, because (1) it preserves some | 429 | contents and inserting the whole file, because (1) it preserves some |
| 429 | marker positions and (2) it puts less data in the undo list. | 430 | marker positions and (2) it puts less data in the undo list. |
| 430 | |||
| 431 | The function @code{insert-file-contents} checks the file contents | ||
| 432 | against the defined file formats, and converts the file contents if | ||
| 433 | appropriate. @xref{Format Conversion}. | ||
| 434 | @end defun | 431 | @end defun |
| 435 | 432 | ||
| 436 | If you want to pass a file name to another process so that another | 433 | If you want to pass a file name to another process so that another |
| @@ -484,19 +481,16 @@ the buffer as visiting another file (@var{visit}). The argument | |||
| 484 | to implement @code{file-precious-flag}; don't use it yourself unless you | 481 | to implement @code{file-precious-flag}; don't use it yourself unless you |
| 485 | really know what you're doing. | 482 | really know what you're doing. |
| 486 | 483 | ||
| 487 | To output information about text properties, @code{write-region} calls | 484 | The function @code{write-region} converts the data which it writes to |
| 488 | the functions in the list @code{write-region-annotation-functions}. For | 485 | the appropriate file formats specified by @code{buffer-file-format}. |
| 489 | more information, see @ref{Saving Properties}. | 486 | @xref{Format Conversion}. It also calls the functions in the list |
| 487 | @code{write-region-annotate-functions}; see @ref{Saving Properties}. | ||
| 490 | 488 | ||
| 491 | Normally, @code{write-region} displays a message @samp{Wrote file | 489 | Normally, @code{write-region} displays a message @samp{Wrote file |
| 492 | @var{filename}} in the echo area. If @var{visit} is neither @code{t} | 490 | @var{filename}} in the echo area. If @var{visit} is neither @code{t} |
| 493 | nor @code{nil} nor a string, then this message is inhibited. This | 491 | nor @code{nil} nor a string, then this message is inhibited. This |
| 494 | feature is useful for programs that use files for internal purposes, | 492 | feature is useful for programs that use files for internal purposes, |
| 495 | files that the user does not need to know about. | 493 | files that the user does not need to know about. |
| 496 | |||
| 497 | The function @code{write-region} converts the data which it writes to | ||
| 498 | the appropriate file formats specified by @code{buffer-file-format}. | ||
| 499 | @xref{Format Conversion}. | ||
| 500 | @end deffn | 494 | @end deffn |
| 501 | 495 | ||
| 502 | @node File Locks | 496 | @node File Locks |
| @@ -737,8 +731,8 @@ time as a list of two numbers. @xref{File Attributes}. | |||
| 737 | @comment node-name, next, previous, up | 731 | @comment node-name, next, previous, up |
| 738 | @subsection Distinguishing Kinds of Files | 732 | @subsection Distinguishing Kinds of Files |
| 739 | 733 | ||
| 740 | This section describes how to distinguish directories and symbolic | 734 | This section describes how to distinguish various kinds of files, such |
| 741 | links from ordinary files. | 735 | as directories, symbolic links, and ordinary files. |
| 742 | 736 | ||
| 743 | @defun file-symlink-p filename | 737 | @defun file-symlink-p filename |
| 744 | @cindex file symbolic links | 738 | @cindex file symbolic links |
| @@ -1330,9 +1324,16 @@ backup version numbers, or trailing tildes. | |||
| 1330 | @end defun | 1324 | @end defun |
| 1331 | 1325 | ||
| 1332 | @defun file-name-sans-extension filename | 1326 | @defun file-name-sans-extension filename |
| 1333 | This function returns @var{filename} sans its final ``extension'', if | 1327 | This function returns @var{filename} minus its ``extension,'' if any. |
| 1334 | any. The extension, in a file name, is the part that follows the last | 1328 | The extension, in a file name, is the part that starts with the last |
| 1335 | @samp{.}. | 1329 | @samp{.} in the last name component. For example, |
| 1330 | |||
| 1331 | @example | ||
| 1332 | (file-name-sans-extension "foo.lose.c") | ||
| 1333 | @result{} "foo.lose" | ||
| 1334 | (file-name-sans-extension "big.hack/foo") | ||
| 1335 | @result{} "big.hack/foo" | ||
| 1336 | @end example | ||
| 1336 | @end defun | 1337 | @end defun |
| 1337 | 1338 | ||
| 1338 | @node Directory Names | 1339 | @node Directory Names |
| @@ -1825,7 +1826,8 @@ This function creates a directory named @var{dirname}. | |||
| 1825 | @defun delete-directory dirname | 1826 | @defun delete-directory dirname |
| 1826 | This function deletes the directory named @var{dirname}. The function | 1827 | This function deletes the directory named @var{dirname}. The function |
| 1827 | @code{delete-file} does not work for files that are directories; you | 1828 | @code{delete-file} does not work for files that are directories; you |
| 1828 | must use @code{delete-directory} in that case. | 1829 | must use @code{delete-directory} for them. If the directory contains |
| 1830 | any files, @code{delete-directory} signals an error. | ||
| 1829 | @end defun | 1831 | @end defun |
| 1830 | 1832 | ||
| 1831 | @node Magic File Names | 1833 | @node Magic File Names |
| @@ -1887,7 +1889,8 @@ Here are the operations that a magic file name handler gets to handle: | |||
| 1887 | @code{file-name-directory}, @code{file-name-nondirectory}, | 1889 | @code{file-name-directory}, @code{file-name-nondirectory}, |
| 1888 | @code{file-name-sans-versions}, @code{file-newer-than-file-p}, | 1890 | @code{file-name-sans-versions}, @code{file-newer-than-file-p}, |
| 1889 | @code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, | 1891 | @code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, |
| 1890 | @code{file-truename}, @code{file-writable-p}, @code{insert-directory}, | 1892 | @code{file-truename}, @code{get-file-buffer}, @code{file-writable-p}, |
| 1893 | @code{insert-directory}, | ||
| 1891 | @code{insert-file-contents}, @code{load}, @code{make-directory}, | 1894 | @code{insert-file-contents}, @code{load}, @code{make-directory}, |
| 1892 | @code{make-symbolic-link}, @code{rename-file}, @code{set-file-modes}, | 1895 | @code{make-symbolic-link}, @code{rename-file}, @code{set-file-modes}, |
| 1893 | @code{set-visited-file-modtime}, @code{unhandled-file-name-directory}, | 1896 | @code{set-visited-file-modtime}, @code{unhandled-file-name-directory}, |
| @@ -1977,9 +1980,10 @@ is a good way to come up with one. | |||
| 1977 | @cindex encoding file formats | 1980 | @cindex encoding file formats |
| 1978 | @cindex decoding file formats | 1981 | @cindex decoding file formats |
| 1979 | The variable @code{format-alist} defines a list of @dfn{file formats}, | 1982 | The variable @code{format-alist} defines a list of @dfn{file formats}, |
| 1980 | which are textual representations used in files for the data (text, | 1983 | which describe textual representations used in files for the data (text, |
| 1981 | text-properties, and possibly other information) in an Emacs buffer. | 1984 | text-properties, and possibly other information) in an Emacs buffer. |
| 1982 | Emacs performs format conversion when reading and writing files. | 1985 | Emacs performs format conversion if appropriate when reading and writing |
| 1986 | files. | ||
| 1983 | 1987 | ||
| 1984 | @defvar format-alist | 1988 | @defvar format-alist |
| 1985 | This list contains one format definition for each defined file format. | 1989 | This list contains one format definition for each defined file format. |
| @@ -2014,7 +2018,7 @@ which specify the part of the buffer it should convert. It should convert | |||
| 2014 | the text by editing it in place. Since this can change the length of the | 2018 | the text by editing it in place. Since this can change the length of the |
| 2015 | text, @var{from-fn} should return the modified end position. | 2019 | text, @var{from-fn} should return the modified end position. |
| 2016 | 2020 | ||
| 2017 | One responsibility of @var{from-fm} is to make sure that the beginning | 2021 | One responsibility of @var{from-fn} is to make sure that the beginning |
| 2018 | of the file no longer matches @var{regexp}. Otherwise it is likely to | 2022 | of the file no longer matches @var{regexp}. Otherwise it is likely to |
| 2019 | get called again. | 2023 | get called again. |
| 2020 | 2024 | ||
| @@ -2061,23 +2065,26 @@ It keeps checking them until none of them is applicable. | |||
| 2061 | 2065 | ||
| 2062 | Visiting a file, with @code{find-file-noselect} or the commands that use | 2066 | Visiting a file, with @code{find-file-noselect} or the commands that use |
| 2063 | it, performs conversion likewise (because it calls | 2067 | it, performs conversion likewise (because it calls |
| 2064 | @code{insert-file-contents}); but it also calls the mode function for | 2068 | @code{insert-file-contents}); it also calls the mode function for each |
| 2065 | each format that it decodes. It stores a list of the format names | 2069 | format that it decodes. It stores a list of the format names in the |
| 2066 | in the buffer-local variable @code{buffer-file-format}. | 2070 | buffer-local variable @code{buffer-file-format}. |
| 2067 | 2071 | ||
| 2068 | @defvar buffer-file-format | 2072 | @defvar buffer-file-format |
| 2069 | This variable holds a list of the file formats that were decoded in the | 2073 | This variable states the format of the visited file. More precisely, |
| 2070 | course of visiting the current buffer's file. It is always local in all | 2074 | this is a list of the file format names that were decoded in the course |
| 2075 | of visiting the current buffer's file. It is always local in all | ||
| 2071 | buffers. | 2076 | buffers. |
| 2072 | @end defvar | 2077 | @end defvar |
| 2073 | 2078 | ||
| 2074 | When @code{write-region} writes data into a file, it first calls the | 2079 | When @code{write-region} writes data into a file, it first calls the |
| 2075 | encoding functions for the formats listed in @code{buffer-file-format}. | 2080 | encoding functions for the formats listed in @code{buffer-file-format}, |
| 2081 | in the order of appearance in the list. | ||
| 2076 | 2082 | ||
| 2077 | @defun format-write-file file format | 2083 | @defun format-write-file file format |
| 2078 | This command writes the current buffer contents into the file @var{file} | 2084 | This command writes the current buffer contents into the file @var{file} |
| 2079 | in format @var{format}, and makes that format the default for future | 2085 | in format @var{format}, and makes that format the default for future |
| 2080 | saves of the buffer. | 2086 | saves of the buffer. The argument @var{format} is a list of format |
| 2087 | names. | ||
| 2081 | @end defun | 2088 | @end defun |
| 2082 | 2089 | ||
| 2083 | @defvar auto-save-file-format | 2090 | @defvar auto-save-file-format |
| @@ -2098,7 +2105,7 @@ is always local in all buffers. | |||
| 2098 | Emacs on MS-DOS makes a distinction between text files and binary | 2105 | Emacs on MS-DOS makes a distinction between text files and binary |
| 2099 | files. This is necessary because ordinary text files on MS-DOS use a | 2106 | files. This is necessary because ordinary text files on MS-DOS use a |
| 2100 | two character sequence between lines: carriage-return and linefeed | 2107 | two character sequence between lines: carriage-return and linefeed |
| 2101 | (CRLF). Emacs expects just a newline character (a linefeed) between | 2108 | (@sc{crlf}). Emacs expects just a newline character (a linefeed) between |
| 2102 | lines. When Emacs reads or writes a text file on MS-DOS, it needs to | 2109 | lines. When Emacs reads or writes a text file on MS-DOS, it needs to |
| 2103 | convert the line separators. This means it needs to know which files | 2110 | convert the line separators. This means it needs to know which files |
| 2104 | are text files and which are binary. It makes this decision when | 2111 | are text files and which are binary. It makes this decision when |
diff --git a/lispref/frames.texi b/lispref/frames.texi index 97d8e3e940a..b7d64e55332 100644 --- a/lispref/frames.texi +++ b/lispref/frames.texi | |||
| @@ -18,9 +18,10 @@ horizontally into smaller windows. | |||
| 18 | @dfn{terminal frames}. If you create additional ones, Emacs displays | 18 | @dfn{terminal frames}. If you create additional ones, Emacs displays |
| 19 | one and only one at any given time---on the terminal screen, of course. | 19 | one and only one at any given time---on the terminal screen, of course. |
| 20 | 20 | ||
| 21 | When Emacs uses X for display, it does not have a terminal frame; | 21 | When Emacs communicates directly with an X server, it does not have a |
| 22 | instead, it starts with a single @dfn{X window frame}. It can display | 22 | terminal frame; instead, it starts with a single @dfn{X window frame}. |
| 23 | multiple X window frames at the same time, each in its own X window. | 23 | It can display multiple X window frames at the same time, each in its |
| 24 | own X window. | ||
| 24 | 25 | ||
| 25 | @defun framep object | 26 | @defun framep object |
| 26 | This predicate returns @code{t} if @var{object} is a frame, and | 27 | This predicate returns @code{t} if @var{object} is a frame, and |
| @@ -48,7 +49,7 @@ This predicate returns @code{t} if @var{object} is a frame, and | |||
| 48 | * Dialog Boxes:: Displaying a box to ask yes or no. | 49 | * Dialog Boxes:: Displaying a box to ask yes or no. |
| 49 | * Pointer Shapes:: Specifying the shape of the mouse pointer. | 50 | * Pointer Shapes:: Specifying the shape of the mouse pointer. |
| 50 | * X Selections:: Transferring text to and from other X clients. | 51 | * X Selections:: Transferring text to and from other X clients. |
| 51 | * X Connections:: Opening and closing the X server connection. | 52 | * Color Names:: Getting the definitions of color names. |
| 52 | * Resources:: Getting resource values from the server. | 53 | * Resources:: Getting resource values from the server. |
| 53 | * Server Data:: Getting info about the X server. | 54 | * Server Data:: Getting info about the X server. |
| 54 | @end menu | 55 | @end menu |
| @@ -66,8 +67,8 @@ an X window frame; otherwise, it makes a terminal frame. | |||
| 66 | 67 | ||
| 67 | The argument is an alist specifying frame parameters. Any parameters | 68 | The argument is an alist specifying frame parameters. Any parameters |
| 68 | not mentioned in @var{alist} default according to the value of the | 69 | not mentioned in @var{alist} default according to the value of the |
| 69 | variable @code{default-frame-alist}; parameters not specified there | 70 | variable @code{default-frame-alist}; parameters not specified even there |
| 70 | either default from the standard X defaults file and X resources. | 71 | default from the standard X defaults file and X resources. |
| 71 | 72 | ||
| 72 | The set of possible parameters depends in principle on what kind of | 73 | The set of possible parameters depends in principle on what kind of |
| 73 | window system Emacs uses to display its frames. @xref{X Frame | 74 | window system Emacs uses to display its frames. @xref{X Frame |
| @@ -120,7 +121,8 @@ argument, it is like @code{make-frame} (@pxref{Creating Frames}). | |||
| 120 | 121 | ||
| 121 | @defun x-display-list | 122 | @defun x-display-list |
| 122 | This returns a list that indicates which X displays Emacs has a | 123 | This returns a list that indicates which X displays Emacs has a |
| 123 | connection to. The elements of the list are display names (strings). | 124 | connection to. The elements of the list are strings, and each one is |
| 125 | a display name. | ||
| 124 | @end defun | 126 | @end defun |
| 125 | 127 | ||
| 126 | @defun x-open-connection display &optional xrm-string | 128 | @defun x-open-connection display &optional xrm-string |
| @@ -128,9 +130,18 @@ This function opens a connection to the X display @var{display}. It | |||
| 128 | does not create a frame on that display, but it permits you to check | 130 | does not create a frame on that display, but it permits you to check |
| 129 | that communication can be established with that display. | 131 | that communication can be established with that display. |
| 130 | 132 | ||
| 131 | The optional second argument @var{xrm-string} should be a string of | 133 | The optional argument @var{resource-string}, if not @code{nil}, is a |
| 132 | resources in xrdb format, or @code{nil}. The resources, if specified, | 134 | string of resource names and values, in the same format used in the |
| 133 | apply to all Emacs frames created on this display. | 135 | @file{.Xresources} file. The values you specify override the resource |
| 136 | values recorded in the X server itself; they apply to all Emacs frames | ||
| 137 | created on this display. Here's an example of what this string might | ||
| 138 | look like: | ||
| 139 | |||
| 140 | @example | ||
| 141 | "*BorderWidth: 3\n*InternalBorder: 2\n" | ||
| 142 | @end example | ||
| 143 | |||
| 144 | @xref{Resources}. | ||
| 134 | @end defun | 145 | @end defun |
| 135 | 146 | ||
| 136 | @defun x-close-connection display | 147 | @defun x-close-connection display |
| @@ -147,9 +158,8 @@ Just what parameters a frame has depends on what display mechanism it | |||
| 147 | uses. | 158 | uses. |
| 148 | 159 | ||
| 149 | Frame parameters exist for the sake of window systems. A terminal frame | 160 | Frame parameters exist for the sake of window systems. A terminal frame |
| 150 | has a few parameters, for compatibility's sake only. You can't change | 161 | has a few parameters, mostly for compatibility's sake; only the height, |
| 151 | these parameters directly; the only ones that ever change are the height | 162 | width and @code{buffer-predicate} parameters really do something. |
| 152 | and width. | ||
| 153 | 163 | ||
| 154 | @menu | 164 | @menu |
| 155 | * Parameter Access:: How to change a frame's parameters. | 165 | * Parameter Access:: How to change a frame's parameters. |
| @@ -196,11 +206,11 @@ file. After reading that file, Emacs checks @code{initial-frame-alist}, | |||
| 196 | and applies the parameter settings in the altered value to the already | 206 | and applies the parameter settings in the altered value to the already |
| 197 | created initial frame. | 207 | created initial frame. |
| 198 | 208 | ||
| 199 | If these settings affect the frame geometry, you'll see the frame appear | 209 | If these settings affect the frame geometry and appearance, you'll see |
| 200 | with the wrong geometry and then change to the specified one. If you | 210 | the frame appear with the wrong ones and then change to the specified |
| 201 | like, you can specify the same geometry with X resources; those do take | 211 | ones. If that bothers you, you can specify the same geometry and |
| 202 | affect before the frame is created. @xref{Resources X,, X Resources, | 212 | appearance with X resources; those do take affect before the frame is |
| 203 | emacs, The GNU Emacs Manual}. | 213 | created. @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}. |
| 204 | 214 | ||
| 205 | X resource settings typically apply to all frames. If you want to | 215 | X resource settings typically apply to all frames. If you want to |
| 206 | specify some X resources solely for the sake of the initial frame, and | 216 | specify some X resources solely for the sake of the initial frame, and |
| @@ -211,8 +221,9 @@ the initial frame, specify the same parameters in | |||
| 211 | @code{initial-frame-alist} with values that match the X resources. | 221 | @code{initial-frame-alist} with values that match the X resources. |
| 212 | @end defvar | 222 | @end defvar |
| 213 | 223 | ||
| 214 | If these parameters specify a separate minibuffer-only frame, | 224 | If these parameters specify a separate minibuffer-only frame with |
| 215 | and you have not created one, Emacs creates one for you. | 225 | @code{(minibuffer . nil)}, and you have not created one, Emacs creates |
| 226 | one for you. | ||
| 216 | 227 | ||
| 217 | @defvar minibuffer-frame-alist | 228 | @defvar minibuffer-frame-alist |
| 218 | This variable's value is an alist of parameter values used when creating | 229 | This variable's value is an alist of parameter values used when creating |
| @@ -220,20 +231,18 @@ an initial minibuffer-only frame---if such a frame is needed, according | |||
| 220 | to the parameters for the main initial frame. | 231 | to the parameters for the main initial frame. |
| 221 | @end defvar | 232 | @end defvar |
| 222 | 233 | ||
| 223 | @defvar special-display-frame-alist | ||
| 224 | The variable @code{special-display-frame-alist} specifies the frame | ||
| 225 | parameters for special display frames. | ||
| 226 | @end defvar | ||
| 227 | |||
| 228 | @defvar default-frame-alist | 234 | @defvar default-frame-alist |
| 229 | This is an alist specifying default values of frame parameters for | 235 | This is an alist specifying default values of frame parameters for |
| 230 | subsequent Emacs frames (not the initial ones). | 236 | subsequent Emacs frames (not the initial ones). |
| 231 | @end defvar | 237 | @end defvar |
| 232 | 238 | ||
| 239 | See also @code{special-display-frame-alist}, in @ref{Choosing Window}. | ||
| 240 | |||
| 233 | If you use options that specify window appearance when you invoke Emacs, | 241 | If you use options that specify window appearance when you invoke Emacs, |
| 234 | they take effect by adding elements to @code{default-frame-alist}. One | 242 | they take effect by adding elements to @code{default-frame-alist}. One |
| 235 | exception is @samp{-geometry}, which adds to @code{initial-frame-alist} | 243 | exception is @samp{-geometry}, which adds the specified position to |
| 236 | instead. @xref{Command Arguments,,, emacs, The GNU Emacs Manual}. | 244 | @code{initial-frame-alist} instead. @xref{Command Arguments,,, emacs, |
| 245 | The GNU Emacs Manual}. | ||
| 237 | 246 | ||
| 238 | @node X Frame Parameters | 247 | @node X Frame Parameters |
| 239 | @subsection X Window Frame Parameters | 248 | @subsection X Window Frame Parameters |
| @@ -267,8 +276,9 @@ negative @var{pos} value. | |||
| 267 | 276 | ||
| 268 | A negative number @minus{}@var{pos}, or a list of the form @code{(- | 277 | A negative number @minus{}@var{pos}, or a list of the form @code{(- |
| 269 | @var{pos})}, actually specifies the position of the right edge of the | 278 | @var{pos})}, actually specifies the position of the right edge of the |
| 270 | window with respect to the right edge of the screen, counting toward the | 279 | window with respect to the right edge of the screen. A positive value |
| 271 | left. | 280 | of @var{pos} counts toward the left. If the parameter is a negative |
| 281 | integer @minus{}@var{pos} then @var{pos} is positive! | ||
| 272 | 282 | ||
| 273 | @item top | 283 | @item top |
| 274 | The screen position of the top edge, in pixels, with respect to the | 284 | The screen position of the top edge, in pixels, with respect to the |
| @@ -278,8 +288,9 @@ negative @var{pos} value. | |||
| 278 | 288 | ||
| 279 | A negative number @minus{}@var{pos}, or a list of the form @code{(- | 289 | A negative number @minus{}@var{pos}, or a list of the form @code{(- |
| 280 | @var{pos})}, actually specifies the position of the bottom edge of the | 290 | @var{pos})}, actually specifies the position of the bottom edge of the |
| 281 | window with respect to the bottom edge of the screen, counting toward the | 291 | window with respect to the bottom edge of the screen. A positive value |
| 282 | top. | 292 | of @var{pos} counts toward the top. If the parameter is a negative |
| 293 | integer @minus{}@var{pos} then @var{pos} is positive! | ||
| 283 | 294 | ||
| 284 | @item icon-left | 295 | @item icon-left |
| 285 | The screen position of the left edge @emph{of the frame's icon}, in | 296 | The screen position of the left edge @emph{of the frame's icon}, in |
| @@ -312,8 +323,8 @@ The number of the X window for the frame. | |||
| 312 | @item minibuffer | 323 | @item minibuffer |
| 313 | Whether this frame has its own minibuffer. The value @code{t} means | 324 | Whether this frame has its own minibuffer. The value @code{t} means |
| 314 | yes, @code{nil} means no, @code{only} means this frame is just a | 325 | yes, @code{nil} means no, @code{only} means this frame is just a |
| 315 | minibuffer, a minibuffer window (in some other frame) means the new | 326 | minibuffer. If the value is a minibuffer window (in some other frame), |
| 316 | frame uses that minibuffer. | 327 | the new frame uses that minibuffer. |
| 317 | 328 | ||
| 318 | @item buffer-predicate | 329 | @item buffer-predicate |
| 319 | The buffer-predicate function for this frame. The function | 330 | The buffer-predicate function for this frame. The function |
| @@ -351,6 +362,10 @@ value is a string, that specifies a file containing a bitmap to use. | |||
| 351 | Any other non-@code{nil} value specifies the default bitmap icon (a | 362 | Any other non-@code{nil} value specifies the default bitmap icon (a |
| 352 | picture of a gnu); @code{nil} specifies a text icon. | 363 | picture of a gnu); @code{nil} specifies a text icon. |
| 353 | 364 | ||
| 365 | @item icon-name | ||
| 366 | The name to use in the icon for this frame, when and if the icon | ||
| 367 | appears. If this is @code{nil}, the frame's title is used. | ||
| 368 | |||
| 354 | @item foreground-color | 369 | @item foreground-color |
| 355 | The color to use for the image of a character. This is a string; the X | 370 | The color to use for the image of a character. This is a string; the X |
| 356 | server defines the meaningful color names. | 371 | server defines the meaningful color names. |
| @@ -414,9 +429,10 @@ by the window manager in its usual fashion. | |||
| 414 | Here are some special features for working with sizes and positions: | 429 | Here are some special features for working with sizes and positions: |
| 415 | 430 | ||
| 416 | @defun set-frame-position frame left top | 431 | @defun set-frame-position frame left top |
| 417 | This function sets the position of the top left corner of | 432 | This function sets the position of the top left corner of @var{frame} to |
| 418 | @var{frame} to @var{left} and @var{top}. These arguments are measured | 433 | @var{left} and @var{top}. These arguments are measured in pixels, and |
| 419 | in pixels, counting from the top left corner of the screen. | 434 | count from the top left corner of the screen. Negative parameter values |
| 435 | count up or rightward from the top left corner of the screen. | ||
| 420 | @end defun | 436 | @end defun |
| 421 | 437 | ||
| 422 | @defun frame-height &optional frame | 438 | @defun frame-height &optional frame |
| @@ -479,13 +495,13 @@ the left or top edge of the screen. A negative integer relates the | |||
| 479 | right or bottom edge of the window to the right or bottom edge of the | 495 | right or bottom edge of the window to the right or bottom edge of the |
| 480 | screen. | 496 | screen. |
| 481 | 497 | ||
| 482 | @item (+ @var{position}) | 498 | @item @code{(+ @var{position})} |
| 483 | This specifies the position of the left or top edge of the window | 499 | This specifies the position of the left or top edge of the window |
| 484 | relative to the left or top edge of the screen. The integer | 500 | relative to the left or top edge of the screen. The integer |
| 485 | @var{position} may be positive or negative; a negative value specifies a | 501 | @var{position} may be positive or negative; a negative value specifies a |
| 486 | position outside the screen. | 502 | position outside the screen. |
| 487 | 503 | ||
| 488 | @item (- @var{position}) | 504 | @item @code{(- @var{position})} |
| 489 | This specifies the position of the right or bottom edge of the window | 505 | This specifies the position of the right or bottom edge of the window |
| 490 | relative to the right or bottom edge of the screen. The integer | 506 | relative to the right or bottom edge of the screen. The integer |
| 491 | @var{position} may be positive or negative; a negative value specifies a | 507 | @var{position} may be positive or negative; a negative value specifies a |
| @@ -494,10 +510,11 @@ position outside the screen. | |||
| 494 | 510 | ||
| 495 | Here is an example: | 511 | Here is an example: |
| 496 | 512 | ||
| 497 | @smallexample | 513 | @example |
| 498 | (x-parse-geometry "35x70+0-0") | 514 | (x-parse-geometry "35x70+0-0") |
| 499 | @result{} ((width . 35) (height . 70) (left . 0) (top - 0)) | 515 | @result{} ((width . 35) (height . 70) |
| 500 | @end smallexample | 516 | (left . 0) (top - 0)) |
| 517 | @end example | ||
| 501 | @end defun | 518 | @end defun |
| 502 | 519 | ||
| 503 | @ignore | 520 | @ignore |
| @@ -538,7 +555,7 @@ invisible frames). The default value of @code{frame-title-format} uses | |||
| 538 | @code{multiple-frames} so as to put the buffer name in the frame title | 555 | @code{multiple-frames} so as to put the buffer name in the frame title |
| 539 | only when there is more than one frame. | 556 | only when there is more than one frame. |
| 540 | 557 | ||
| 541 | The variable is always local to the current X terminal and cannot be | 558 | The variable is always local to the current terminal and cannot be |
| 542 | buffer-local. @xref{Multiple Displays}. | 559 | buffer-local. @xref{Multiple Displays}. |
| 543 | @end defvar | 560 | @end defvar |
| 544 | 561 | ||
| @@ -598,6 +615,8 @@ The second argument, @var{minibuf}, says which frames to consider: | |||
| 598 | Exclude minibuffer-only frames. | 615 | Exclude minibuffer-only frames. |
| 599 | @item @code{visible} | 616 | @item @code{visible} |
| 600 | Consider all visible frames. | 617 | Consider all visible frames. |
| 618 | @item 0 | ||
| 619 | Consider all visible or iconified frames. | ||
| 601 | @item a window | 620 | @item a window |
| 602 | Consider only the frames using that particular window as their | 621 | Consider only the frames using that particular window as their |
| 603 | minibuffer. | 622 | minibuffer. |
| @@ -611,6 +630,9 @@ Like @code{next-frame}, but cycles through all frames in the opposite | |||
| 611 | direction. | 630 | direction. |
| 612 | @end defun | 631 | @end defun |
| 613 | 632 | ||
| 633 | See also @code{next-window} and @code{previous-window}, in @ref{Cyclic | ||
| 634 | Window Ordering}. | ||
| 635 | |||
| 614 | @node Frames and Windows | 636 | @node Frames and Windows |
| 615 | @section Frames and Windows | 637 | @section Frames and Windows |
| 616 | 638 | ||
| @@ -644,6 +666,9 @@ This function returns the window on @var{frame} that is selected within | |||
| 644 | Conversely, selecting a window for Emacs with @code{select-window} also | 666 | Conversely, selecting a window for Emacs with @code{select-window} also |
| 645 | makes that window selected within its frame. @xref{Selecting Windows}. | 667 | makes that window selected within its frame. @xref{Selecting Windows}. |
| 646 | 668 | ||
| 669 | Another function that (usually) returns one of the windows in a frame is | ||
| 670 | @code{minibuffer-window}. @xref{Minibuffer Misc}. | ||
| 671 | |||
| 647 | @node Minibuffers and Frames | 672 | @node Minibuffers and Frames |
| 648 | @section Minibuffers and Frames | 673 | @section Minibuffers and Frames |
| 649 | 674 | ||
| @@ -653,11 +678,10 @@ you can get it with @code{minibuffer-window} (@pxref{Minibuffer Misc}). | |||
| 653 | 678 | ||
| 654 | However, you can also create a frame with no minibuffer. Such a frame | 679 | However, you can also create a frame with no minibuffer. Such a frame |
| 655 | must use the minibuffer window of some other frame. When you create the | 680 | must use the minibuffer window of some other frame. When you create the |
| 656 | frame, you can specify explicitly the frame on which to find the | 681 | frame, you can specify explicitly the minibuffer window to use (in some |
| 657 | minibuffer to use. If you don't, then the minibuffer is found in the | 682 | other frame). If you don't, then the minibuffer is found in the frame |
| 658 | frame which is the value of the variable | 683 | which is the value of the variable @code{default-minibuffer-frame}. Its |
| 659 | @code{default-minibuffer-frame}. Its value should be a frame that does | 684 | value should be a frame that does have a minibuffer. |
| 660 | have a minibuffer. | ||
| 661 | 685 | ||
| 662 | If you use a minibuffer-only frame, you might want that frame to raise | 686 | If you use a minibuffer-only frame, you might want that frame to raise |
| 663 | when you enter the minibuffer. If so, set the variable | 687 | when you enter the minibuffer. If so, set the variable |
| @@ -665,7 +689,7 @@ when you enter the minibuffer. If so, set the variable | |||
| 665 | 689 | ||
| 666 | @defvar default-minibuffer-frame | 690 | @defvar default-minibuffer-frame |
| 667 | This variable specifies the frame to use for the minibuffer window, by | 691 | This variable specifies the frame to use for the minibuffer window, by |
| 668 | default. It is always local to the current X terminal and cannot be | 692 | default. It is always local to the current terminal and cannot be |
| 669 | buffer-local. @xref{Multiple Displays}. | 693 | buffer-local. @xref{Multiple Displays}. |
| 670 | @end defvar | 694 | @end defvar |
| 671 | 695 | ||
| @@ -697,7 +721,7 @@ lasts until overridden by a subsequent call to @code{switch-frame}. | |||
| 697 | Only the selected terminal frame is actually displayed on the terminal. | 721 | Only the selected terminal frame is actually displayed on the terminal. |
| 698 | Each terminal screen except for the initial one has a number, and the | 722 | Each terminal screen except for the initial one has a number, and the |
| 699 | number of the selected frame appears in the mode line after the word | 723 | number of the selected frame appears in the mode line after the word |
| 700 | @samp{Emacs}. | 724 | @samp{Emacs} (@pxref{Mode Line Variables}). |
| 701 | 725 | ||
| 702 | @c ??? This is not yet implemented properly. | 726 | @c ??? This is not yet implemented properly. |
| 703 | @defun select-frame frame | 727 | @defun select-frame frame |
| @@ -758,7 +782,7 @@ change it. | |||
| 758 | @cindex iconified frame | 782 | @cindex iconified frame |
| 759 | @cindex frame visibility | 783 | @cindex frame visibility |
| 760 | 784 | ||
| 761 | An X windo frame may be @dfn{visible}, @dfn{invisible}, or | 785 | An X window frame may be @dfn{visible}, @dfn{invisible}, or |
| 762 | @dfn{iconified}. If it is visible, you can see its contents. If it is | 786 | @dfn{iconified}. If it is visible, you can see its contents. If it is |
| 763 | iconified, the frame's contents do not appear on the screen, but an icon | 787 | iconified, the frame's contents do not appear on the screen, but an icon |
| 764 | does. If the frame is invisible, it doesn't show on the screen, not | 788 | does. If the frame is invisible, it doesn't show on the screen, not |
| @@ -882,6 +906,11 @@ The usual purpose of tracking mouse motion is to indicate on the screen | |||
| 882 | the consequences of pushing or releasing a button at the current | 906 | the consequences of pushing or releasing a button at the current |
| 883 | position. | 907 | position. |
| 884 | 908 | ||
| 909 | In many cases, you can avoid the need to track the mouse by using | ||
| 910 | the @code{mouse-face} text property (@pxref{Special Properties}). | ||
| 911 | That works at a much lower level and runs more smoothly than | ||
| 912 | Lisp-level mouse tracking. | ||
| 913 | |||
| 885 | @ignore | 914 | @ignore |
| 886 | @c These are not implemented yet. | 915 | @c These are not implemented yet. |
| 887 | 916 | ||
| @@ -991,7 +1020,7 @@ can have the following form: | |||
| 991 | where each pane is a list of form | 1020 | where each pane is a list of form |
| 992 | 1021 | ||
| 993 | @example | 1022 | @example |
| 994 | (@var{title} (@var{line} @var{item})...) | 1023 | (@var{title} (@var{line} . @var{item})...) |
| 995 | @end example | 1024 | @end example |
| 996 | 1025 | ||
| 997 | Each @var{line} should be a string, and each @var{item} should be the | 1026 | Each @var{line} should be a string, and each @var{item} should be the |
| @@ -1005,8 +1034,8 @@ individual items in that menu and provide help for them. If instead you | |||
| 1005 | implement the menu by defining a command that calls @code{x-popup-menu}, | 1034 | implement the menu by defining a command that calls @code{x-popup-menu}, |
| 1006 | the help facilities cannot know what happens inside that command, so | 1035 | the help facilities cannot know what happens inside that command, so |
| 1007 | they cannot give any help for the menu's items. This is the reason why | 1036 | they cannot give any help for the menu's items. This is the reason why |
| 1008 | all the menu bar items except @samp{Buffers} are implemented with menu | 1037 | all the menu bar items are normally implemented with menu keymaps |
| 1009 | keymaps (@pxref{Menu Keymaps}). | 1038 | (@pxref{Menu Keymaps}). |
| 1010 | 1039 | ||
| 1011 | @node Dialog Boxes | 1040 | @node Dialog Boxes |
| 1012 | @section Dialog Boxes | 1041 | @section Dialog Boxes |
| @@ -1144,40 +1173,8 @@ This function stores @var{string} into the first cut buffer (cut buffer | |||
| 1144 | like the way successive kills in Emacs move down the kill ring. | 1173 | like the way successive kills in Emacs move down the kill ring. |
| 1145 | @end defun | 1174 | @end defun |
| 1146 | 1175 | ||
| 1147 | @node X Connections | 1176 | @node Color Names |
| 1148 | @section X Connections | 1177 | @section Color Names |
| 1149 | |||
| 1150 | You can close the connection with the X server with the function | ||
| 1151 | @code{x-close-current-connection}, and open a new one with | ||
| 1152 | @code{x-open-connection} (perhaps with a different server and display). | ||
| 1153 | |||
| 1154 | @defun x-close-current-connection | ||
| 1155 | This function closes the connection to the X server. It deletes all | ||
| 1156 | frames, making Emacs effectively inaccessible to the user; therefore, a | ||
| 1157 | Lisp program that closes the connection should open another one. | ||
| 1158 | @end defun | ||
| 1159 | |||
| 1160 | @defun x-open-connection display &optional resource-string | ||
| 1161 | This function opens a connection to an X server, for use of display | ||
| 1162 | @var{display}. | ||
| 1163 | |||
| 1164 | The optional argument @var{resource-string} is a string of resource | ||
| 1165 | names and values, in the same format used in the @file{.Xresources} | ||
| 1166 | file. The values you specify override the resource values recorded in | ||
| 1167 | the X server itself. Here's an example of what this string might look | ||
| 1168 | like: | ||
| 1169 | |||
| 1170 | @example | ||
| 1171 | "*BorderWidth: 3\n*InternalBorder: 2\n" | ||
| 1172 | @end example | ||
| 1173 | |||
| 1174 | @xref{Resources}. | ||
| 1175 | @end defun | ||
| 1176 | |||
| 1177 | @defun x-display-color-p | ||
| 1178 | This returns @code{t} if the connected X display has color, and | ||
| 1179 | @code{nil} otherwise. | ||
| 1180 | @end defun | ||
| 1181 | 1178 | ||
| 1182 | @defun x-color-defined-p color | 1179 | @defun x-color-defined-p color |
| 1183 | This function reports whether a color name is meaningful. It returns | 1180 | This function reports whether a color name is meaningful. It returns |
| @@ -1221,39 +1218,27 @@ defined, the value is @code{nil}. | |||
| 1221 | @end example | 1218 | @end example |
| 1222 | @end defun | 1219 | @end defun |
| 1223 | 1220 | ||
| 1224 | @defun x-synchronize flag | ||
| 1225 | The function @code{x-synchronize} enables or disables synchronous | ||
| 1226 | communication with the X server. It enables synchronous communication | ||
| 1227 | if @var{flag} is non-@code{nil}, and disables it if @var{flag} is | ||
| 1228 | @code{nil}. | ||
| 1229 | |||
| 1230 | In synchronous mode, Emacs waits for a response to each X protocol | ||
| 1231 | command before doing anything else. This is useful for debugging Emacs, | ||
| 1232 | because protocol errors are reported right away, which helps you find | ||
| 1233 | the erroneous command. Synchronous mode is not the default because it | ||
| 1234 | is much slower. | ||
| 1235 | @end defun | ||
| 1236 | |||
| 1237 | @node Resources | 1221 | @node Resources |
| 1238 | @section X Resources | 1222 | @section X Resources |
| 1239 | 1223 | ||
| 1240 | @defun x-get-resource attribute &optional component subclass | 1224 | @defun x-get-resource attribute class &optional component subclass |
| 1241 | The function @code{x-get-resource} retrieves a resource value from the X | 1225 | The function @code{x-get-resource} retrieves a resource value from the X |
| 1242 | Windows defaults database. | 1226 | Windows defaults database. |
| 1243 | 1227 | ||
| 1244 | Resources are indexed by a combination of a @dfn{key} and a @dfn{class}. | 1228 | Resources are indexed by a combination of a @dfn{key} and a @dfn{class}. |
| 1245 | This function searches using a key of the form | 1229 | This function searches using a key of the form |
| 1246 | @samp{@var{instance}.@var{attribute}} (where @var{instance} is the name | 1230 | @samp{@var{instance}.@var{attribute}} (where @var{instance} is the name |
| 1247 | under which Emacs was invoked), and using @samp{Emacs} as the class. | 1231 | under which Emacs was invoked), and using @samp{Emacs.@var{class}} as |
| 1232 | the class. | ||
| 1248 | 1233 | ||
| 1249 | The optional arguments @var{component} and @var{subclass} add to the key | 1234 | The optional arguments @var{component} and @var{subclass} add to the key |
| 1250 | and the class, respectively. You must specify both of them or neither. | 1235 | and the class, respectively. You must specify both of them or neither. |
| 1251 | If you specify them, the key is | 1236 | If you specify them, the key is |
| 1252 | @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is | 1237 | @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is |
| 1253 | @samp{Emacs.@var{subclass}}. | 1238 | @samp{Emacs.@var{class}.@var{subclass}}. |
| 1254 | @end defun | 1239 | @end defun |
| 1255 | 1240 | ||
| 1256 | @xref{Resources X, X Resources,, emacs, The GNU Emacs Manual}. | 1241 | @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}. |
| 1257 | 1242 | ||
| 1258 | @node Server Data | 1243 | @node Server Data |
| 1259 | @section Data about the X Server | 1244 | @section Data about the X Server |
| @@ -1263,8 +1248,8 @@ get information about the capabilities and origin of an X display that | |||
| 1263 | Emacs is using. Each of these functions lets you specify the display | 1248 | Emacs is using. Each of these functions lets you specify the display |
| 1264 | you are interested in: the @var{display} argument can be either a | 1249 | you are interested in: the @var{display} argument can be either a |
| 1265 | display name, or a frame (meaning use the display that frame is on). If | 1250 | display name, or a frame (meaning use the display that frame is on). If |
| 1266 | you omit the @var{display} argument, that means to use the selected | 1251 | you omit the @var{display} argument, or specify @code{nil}, that means |
| 1267 | frame's display. | 1252 | to use the selected frame's display. |
| 1268 | 1253 | ||
| 1269 | @defun x-display-screens &optional display | 1254 | @defun x-display-screens &optional display |
| 1270 | This function returns the number of screens associated with the display. | 1255 | This function returns the number of screens associated with the display. |
diff --git a/lispref/functions.texi b/lispref/functions.texi index 0f596cb6216..27a521df702 100644 --- a/lispref/functions.texi +++ b/lispref/functions.texi | |||
| @@ -79,7 +79,9 @@ Structures}. | |||
| 79 | A @dfn{macro} is a construct defined in Lisp by the programmer. It | 79 | A @dfn{macro} is a construct defined in Lisp by the programmer. It |
| 80 | differs from a function in that it translates a Lisp expression that you | 80 | differs from a function in that it translates a Lisp expression that you |
| 81 | write into an equivalent expression to be evaluated instead of the | 81 | write into an equivalent expression to be evaluated instead of the |
| 82 | original expression. @xref{Macros}, for how to define and use macros. | 82 | original expression. Macros enable Lisp programmers to do the sorts of |
| 83 | things that special forms can do. @xref{Macros}, for how to define and | ||
| 84 | use macros. | ||
| 83 | 85 | ||
| 84 | @item command | 86 | @item command |
| 85 | @cindex command | 87 | @cindex command |
| @@ -150,9 +152,11 @@ function. For example: | |||
| 150 | @end example | 152 | @end example |
| 151 | 153 | ||
| 152 | @noindent | 154 | @noindent |
| 153 | (Such a list is called a @dfn{lambda expression} for historical reasons, | 155 | Such a list is called a @dfn{lambda expression}. In Emacs Lisp, it |
| 154 | even though it is not really an expression at all---it is not a form | 156 | actually is valid as an expression---it evaluates to itself. In some |
| 155 | that can be evaluated meaningfully.) | 157 | other Lisp dialects, a lambda expression is not a valid expression at |
| 158 | all. In either case, its main use is not to be evaluated as an | ||
| 159 | expression, but to be called as a function. | ||
| 156 | 160 | ||
| 157 | @menu | 161 | @menu |
| 158 | * Lambda Components:: The parts of a lambda expression. | 162 | * Lambda Components:: The parts of a lambda expression. |
| @@ -374,17 +378,17 @@ actually appears inside the Lisp world and can be used by the Emacs help | |||
| 374 | facilities. @xref{Documentation}, for how the @var{documentation-string} is | 378 | facilities. @xref{Documentation}, for how the @var{documentation-string} is |
| 375 | accessed. | 379 | accessed. |
| 376 | 380 | ||
| 377 | It is a good idea to provide documentation strings for all commands, | 381 | It is a good idea to provide documentation strings for all the |
| 378 | and for all other functions in your program that users of your program | 382 | functions in your program, even those that are only called from within |
| 379 | should know about; internal functions might as well have only comments, | 383 | your program. Documentation strings are like comments, except that they |
| 380 | since comments don't take up any room when your program is loaded. | 384 | are easier to access. |
| 381 | 385 | ||
| 382 | The first line of the documentation string should stand on its own, | 386 | The first line of the documentation string should stand on its own, |
| 383 | because @code{apropos} displays just this first line. It should consist | 387 | because @code{apropos} displays just this first line. It should consist |
| 384 | of one or two complete sentences that summarize the function's purpose. | 388 | of one or two complete sentences that summarize the function's purpose. |
| 385 | 389 | ||
| 386 | The start of the documentation string is usually indented, but since | 390 | The start of the documentation string is usually indented in the source file, |
| 387 | these spaces come before the starting double-quote, they are not part of | 391 | but since these spaces come before the starting double-quote, they are not part of |
| 388 | the string. Some people make a practice of indenting any additional | 392 | the string. Some people make a practice of indenting any additional |
| 389 | lines of the string so that the text lines up in the program source. | 393 | lines of the string so that the text lines up in the program source. |
| 390 | @emph{This is a mistake.} The indentation of the following lines is | 394 | @emph{This is a mistake.} The indentation of the following lines is |
| @@ -532,11 +536,21 @@ deliberate redefinition from unintentional redefinition. | |||
| 532 | @defun defalias name definition | 536 | @defun defalias name definition |
| 533 | This special form defines the symbol @var{name} as a function, with | 537 | This special form defines the symbol @var{name} as a function, with |
| 534 | definition @var{definition} (which can be any valid Lisp function). | 538 | definition @var{definition} (which can be any valid Lisp function). |
| 535 | It's best to use this rather than @code{fset} when defining a function | 539 | |
| 536 | in a file, because @code{defalias} records which file defined the | 540 | The proper place to use @code{defalias} is where a specific function |
| 537 | function (@pxref{Unloading}), while @code{fset} does not. | 541 | name is being defined---especially where that name appears explicitly in |
| 542 | the source file being loaded. This is because @code{defalias} records | ||
| 543 | which file defined the function, just like @code{defun} | ||
| 544 | (@pxref{Unloading}). | ||
| 545 | |||
| 546 | By contrast, in programs that manipulate function definitions for other | ||
| 547 | purposes, it is better to use @code{fset}, which does not keep such | ||
| 548 | records. | ||
| 538 | @end defun | 549 | @end defun |
| 539 | 550 | ||
| 551 | See also @code{defsubst}, which defines a function like @code{defun} | ||
| 552 | and tells the Lisp compiler to open-code it. @xref{Inline Functions}. | ||
| 553 | |||
| 540 | @node Calling Functions | 554 | @node Calling Functions |
| 541 | @section Calling Functions | 555 | @section Calling Functions |
| 542 | @cindex function invocation | 556 | @cindex function invocation |
| @@ -645,8 +659,8 @@ find them in data structures (especially in hook variables and property | |||
| 645 | lists) and call them using @code{funcall} or @code{apply}. Functions | 659 | lists) and call them using @code{funcall} or @code{apply}. Functions |
| 646 | that accept function arguments are often called @dfn{functionals}. | 660 | that accept function arguments are often called @dfn{functionals}. |
| 647 | 661 | ||
| 648 | Sometimes, when you call such a function, it is useful to supply a | 662 | Sometimes, when you call a functional, it is useful to supply a no-op |
| 649 | no-op function as the argument. Here are two different kinds of no-op | 663 | function as the argument. Here are two different kinds of no-op |
| 650 | function: | 664 | function: |
| 651 | 665 | ||
| 652 | @defun identity arg | 666 | @defun identity arg |
| @@ -1007,7 +1021,7 @@ Functions}. | |||
| 1007 | @end defun | 1021 | @end defun |
| 1008 | 1022 | ||
| 1009 | When writing a function that extends a previously defined function, | 1023 | When writing a function that extends a previously defined function, |
| 1010 | the following idiom is often used: | 1024 | the following idiom is sometimes used: |
| 1011 | 1025 | ||
| 1012 | @example | 1026 | @example |
| 1013 | (fset 'old-foo (symbol-function 'foo)) | 1027 | (fset 'old-foo (symbol-function 'foo)) |
| @@ -1027,6 +1041,9 @@ defines @code{foo} rather than @code{old-foo}, it does not produce the | |||
| 1027 | proper results. The only way to avoid this problem is to make sure the | 1041 | proper results. The only way to avoid this problem is to make sure the |
| 1028 | file is loaded before moving aside the old definition of @code{foo}. | 1042 | file is loaded before moving aside the old definition of @code{foo}. |
| 1029 | 1043 | ||
| 1044 | But it is unmodular and unclean, in any case, for a Lisp file to | ||
| 1045 | redefine a function defined elsewhere. | ||
| 1046 | |||
| 1030 | @node Inline Functions | 1047 | @node Inline Functions |
| 1031 | @section Inline Functions | 1048 | @section Inline Functions |
| 1032 | @cindex inline functions | 1049 | @cindex inline functions |
| @@ -1063,7 +1080,7 @@ Evaluation}.) | |||
| 1063 | Inline functions can be used and open-coded later on in the same file, | 1080 | Inline functions can be used and open-coded later on in the same file, |
| 1064 | following the definition, just like macros. | 1081 | following the definition, just like macros. |
| 1065 | 1082 | ||
| 1066 | Emacs versions prior to 19 did not have inline functions. | 1083 | @c Emacs versions prior to 19 did not have inline functions. |
| 1067 | 1084 | ||
| 1068 | @node Related Topics | 1085 | @node Related Topics |
| 1069 | @section Other Topics Related to Functions | 1086 | @section Other Topics Related to Functions |
diff --git a/lispref/help.texi b/lispref/help.texi index 396d11b01ed..b0466962a6c 100644 --- a/lispref/help.texi +++ b/lispref/help.texi | |||
| @@ -60,7 +60,7 @@ documentation is displayed. This allows documentation strings to refer | |||
| 60 | to the keys for related commands and be accurate even when a user | 60 | to the keys for related commands and be accurate even when a user |
| 61 | rearranges the key bindings. (@xref{Accessing Documentation}.) | 61 | rearranges the key bindings. (@xref{Accessing Documentation}.) |
| 62 | 62 | ||
| 63 | Within the Lisp world, a documentation string is kept with the | 63 | Within the Lisp world, a documentation string accessible through the |
| 64 | function or variable that it describes: | 64 | function or variable that it describes: |
| 65 | 65 | ||
| 66 | @itemize @bullet | 66 | @itemize @bullet |
| @@ -81,14 +81,17 @@ function @code{documentation-property} knows how to extract it. | |||
| 81 | @cindex @file{etc/DOC-@var{version}} | 81 | @cindex @file{etc/DOC-@var{version}} |
| 82 | To save space, the documentation for preloaded functions and variables | 82 | To save space, the documentation for preloaded functions and variables |
| 83 | (including primitive functions and autoloaded functions) is stored in | 83 | (including primitive functions and autoloaded functions) is stored in |
| 84 | the file @file{emacs/etc/DOC-@var{version}}. The data structure inside | 84 | the file @file{emacs/etc/DOC-@var{version}}. The documentation for |
| 85 | Emacs has an integer offset into the file, where the documentation | 85 | functions and variables loaded during the Emacs session from |
| 86 | string ought to be. The functions @code{documentation} and | 86 | byte-compiled files is stored in those files (@pxref{Docs and |
| 87 | @code{documentation-property} read the documentation from the file | 87 | Compilation}). |
| 88 | @file{emacs/etc/DOC-@var{version}} when they notice the integer there; | 88 | |
| 89 | this is transparent to the user. Keeping the documentation strings out | 89 | The data structure inside Emacs has an integer offset into the file, or |
| 90 | of the Emacs core image saves a significant amount of space. | 90 | a list containing a string and an integer, in place of the documentation |
| 91 | @xref{Building Emacs}. | 91 | string. The functions @code{documentation} and |
| 92 | @code{documentation-property} use that information to read the | ||
| 93 | documentation from the appropriate file; this is transparent to the | ||
| 94 | user. | ||
| 92 | 95 | ||
| 93 | For information on the uses of documentation strings, see @ref{Help, , | 96 | For information on the uses of documentation strings, see @ref{Help, , |
| 94 | Help, emacs, The GNU Emacs Manual}. | 97 | Help, emacs, The GNU Emacs Manual}. |
| @@ -105,10 +108,10 @@ use to print nice-looking hardcopy for the file | |||
| 105 | @defun documentation-property symbol property &optional verbatim | 108 | @defun documentation-property symbol property &optional verbatim |
| 106 | This function returns the documentation string that is recorded | 109 | This function returns the documentation string that is recorded |
| 107 | @var{symbol}'s property list under property @var{property}. It | 110 | @var{symbol}'s property list under property @var{property}. It |
| 108 | retrieves the text from the file @file{emacs/etc/DOC-@var{version}} if | 111 | retrieves the text from a file if necessary, and runs |
| 109 | necessary, and runs @code{substitute-command-keys} to substitute actual | 112 | @code{substitute-command-keys} to substitute actual key bindings. (This |
| 110 | key bindings. (This substitution is not done if @var{verbatim} is | 113 | substitution is not done if @var{verbatim} is non-@code{nil}; the |
| 111 | non-@code{nil}; the @var{verbatim} argument exists only as of Emacs 19.) | 114 | @var{verbatim} argument exists only as of Emacs 19.) |
| 112 | 115 | ||
| 113 | @smallexample | 116 | @smallexample |
| 114 | @group | 117 | @group |
| @@ -124,14 +127,10 @@ non-@code{nil}; the @var{verbatim} argument exists only as of Emacs 19.) | |||
| 124 | @end defun | 127 | @end defun |
| 125 | 128 | ||
| 126 | @defun documentation function &optional verbatim | 129 | @defun documentation function &optional verbatim |
| 127 | This function returns the documentation string of @var{function}. | 130 | This function returns the documentation string of @var{function}. It |
| 128 | This function will access the documentation string if it is stored in | 131 | reads the text from a file if necessary. Then (unless @var{verbatim} is |
| 129 | the @file{emacs/etc/DOC-@var{version}} file. | 132 | non-@code{nil}) it calls @code{substitute-command-keys}, to return a |
| 130 | 133 | value containing the actual (current) key bindings. | |
| 131 | In addition, @code{documentation} runs @code{substitute-command-keys} | ||
| 132 | on the resulting string, so the value contains the actual (current) key | ||
| 133 | bindings. (This is not done if @var{verbatim} is non-@code{nil}; the | ||
| 134 | @var{verbatim} argument exists only as of Emacs 19.) | ||
| 135 | 134 | ||
| 136 | The function @code{documentation} signals a @code{void-function} error | 135 | The function @code{documentation} signals a @code{void-function} error |
| 137 | if @var{function} has no function definition. However, it is ok if | 136 | if @var{function} has no function definition. However, it is ok if |
diff --git a/lispref/hooks.texi b/lispref/hooks.texi index 472b57fd1a6..18f8bcfcad5 100644 --- a/lispref/hooks.texi +++ b/lispref/hooks.texi | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. |
| 4 | @c See the file elisp.texi for copying conditions. | 4 | @c See the file elisp.texi for copying conditions. |
| 5 | @setfilename ../info/hooks | 5 | @setfilename ../info/hooks |
| 6 | @node Standard Hooks, Antinews, Standard Keymaps, Top | 6 | @node Standard Hooks, Index, Standard Keymaps, Top |
| 7 | @appendix Standard Hooks | 7 | @appendix Standard Hooks |
| 8 | 8 | ||
| 9 | The following is a list of hook variables that let you provide | 9 | The following is a list of hook variables that let you provide |
| @@ -122,5 +122,5 @@ special way (they are passed arguments, or else their values are used). | |||
| 122 | @item window-setup-hook | 122 | @item window-setup-hook |
| 123 | @item write-contents-hooks | 123 | @item write-contents-hooks |
| 124 | @item write-file-hooks | 124 | @item write-file-hooks |
| 125 | @item write-region-annotation-functions | 125 | @item write-region-annotate-functions |
| 126 | @end table | 126 | @end table |
diff --git a/lispref/internals.texi b/lispref/internals.texi index 352dd226d28..c1b17f62b4a 100644 --- a/lispref/internals.texi +++ b/lispref/internals.texi | |||
| @@ -103,8 +103,8 @@ running. It is useful to include this string in bug reports. | |||
| 103 | @example | 103 | @example |
| 104 | @group | 104 | @group |
| 105 | (emacs-version) | 105 | (emacs-version) |
| 106 | @result{} "GNU Emacs 19.22.1 of Fri Feb 27 1994 \ | 106 | @result{} "GNU Emacs 19.29.1 (i386-debian-linux) \ |
| 107 | on slug (berkeley-unix)" | 107 | of Tue Jun 6 1995 on balloon" |
| 108 | @end group | 108 | @end group |
| 109 | @end example | 109 | @end example |
| 110 | 110 | ||
| @@ -113,20 +113,20 @@ echo area. | |||
| 113 | @end deffn | 113 | @end deffn |
| 114 | 114 | ||
| 115 | @defvar emacs-build-time | 115 | @defvar emacs-build-time |
| 116 | The value of this variable is the time at which Emacs was built at the | 116 | The value of this variable is the time at which Emacs was built at the |
| 117 | local site. | 117 | local site. |
| 118 | 118 | ||
| 119 | @example | 119 | @example |
| 120 | @group | 120 | @group |
| 121 | emacs-build-time | 121 | emacs-build-time |
| 122 | @result{} "Fri Feb 27 14:55:57 1994" | 122 | @result{} "Tue Jun 6 14:55:57 1995" |
| 123 | @end group | 123 | @end group |
| 124 | @end example | 124 | @end example |
| 125 | @end defvar | 125 | @end defvar |
| 126 | 126 | ||
| 127 | @defvar emacs-version | 127 | @defvar emacs-version |
| 128 | The value of this variable is the version of Emacs being run. It is a | 128 | The value of this variable is the version of Emacs being run. It is a |
| 129 | string such as @code{"19.22.1"}. | 129 | string such as @code{"19.29.1"}. |
| 130 | @end defvar | 130 | @end defvar |
| 131 | 131 | ||
| 132 | The following two variables did not exist before Emacs version 19.23, | 132 | The following two variables did not exist before Emacs version 19.23, |
| @@ -135,12 +135,12 @@ convenient in the future. | |||
| 135 | 135 | ||
| 136 | @defvar emacs-major-version | 136 | @defvar emacs-major-version |
| 137 | The major version number of Emacs, as an integer. For Emacs version | 137 | The major version number of Emacs, as an integer. For Emacs version |
| 138 | 19.23, the value is 19. | 138 | 19.29, the value is 19. |
| 139 | @end defvar | 139 | @end defvar |
| 140 | 140 | ||
| 141 | @defvar emacs-minor-version | 141 | @defvar emacs-minor-version |
| 142 | The minor version number of Emacs, as an integer. For Emacs version | 142 | The minor version number of Emacs, as an integer. For Emacs version |
| 143 | 19.23, the value is 23. | 143 | 19.29, the value is 29. |
| 144 | @end defvar | 144 | @end defvar |
| 145 | 145 | ||
| 146 | @node Pure Storage, Garbage Collection, Building Emacs, GNU Emacs Internals | 146 | @node Pure Storage, Garbage Collection, Building Emacs, GNU Emacs Internals |
| @@ -332,7 +332,7 @@ that the subsequent garbage collection does not happen immediately when | |||
| 332 | the threshold is exhausted, but only the next time the Lisp evaluator is | 332 | the threshold is exhausted, but only the next time the Lisp evaluator is |
| 333 | called. | 333 | called. |
| 334 | 334 | ||
| 335 | The initial threshold value is 100,000. If you specify a larger | 335 | The initial threshold value is 300,000. If you specify a larger |
| 336 | value, garbage collection will happen less often. This reduces the | 336 | value, garbage collection will happen less often. This reduces the |
| 337 | amount of time spent garbage collecting, but increases total memory use. | 337 | amount of time spent garbage collecting, but increases total memory use. |
| 338 | You may want to do this when running a program that creates lots of | 338 | You may want to do this when running a program that creates lots of |
| @@ -727,6 +727,10 @@ in this buffer, and their values, with the exception of local variables | |||
| 727 | that have special slots in the buffer object. (Those slots are omitted | 727 | that have special slots in the buffer object. (Those slots are omitted |
| 728 | from this table.) @xref{Buffer-Local Variables}. | 728 | from this table.) @xref{Buffer-Local Variables}. |
| 729 | 729 | ||
| 730 | @item base_buffer | ||
| 731 | This field holds the buffer's base buffer (if it is an indirect buffer), | ||
| 732 | or @code{nil}. | ||
| 733 | |||
| 730 | @item keymap | 734 | @item keymap |
| 731 | This field holds the buffer's local keymap. @xref{Keymaps}. | 735 | This field holds the buffer's local keymap. @xref{Keymaps}. |
| 732 | 736 | ||
| @@ -920,4 +924,8 @@ The file descriptor for output to the process. | |||
| 920 | The file descriptor for the terminal that the subprocess is using. (On | 924 | The file descriptor for the terminal that the subprocess is using. (On |
| 921 | some systems, there is no need to record this, so the value is | 925 | some systems, there is no need to record this, so the value is |
| 922 | @code{nil}.) | 926 | @code{nil}.) |
| 927 | |||
| 928 | @item tty_name | ||
| 929 | The name of the terminal that the subprocess is using, | ||
| 930 | or @code{nil} if it is using pipes. | ||
| 923 | @end table | 931 | @end table |
diff --git a/lispref/intro.texi b/lispref/intro.texi index f6fe12dfa88..3b310cdf3ed 100644 --- a/lispref/intro.texi +++ b/lispref/intro.texi | |||
| @@ -536,7 +536,7 @@ manual. You may want to skip this section and refer back to it later. | |||
| 536 | 536 | ||
| 537 | Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp | 537 | Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp |
| 538 | printer'' are used to refer to those routines in Lisp that convert | 538 | printer'' are used to refer to those routines in Lisp that convert |
| 539 | textual representations of Lisp objects into actual objects, and vice | 539 | textual representations of Lisp objects into actual Lisp objects, and vice |
| 540 | versa. @xref{Printed Representation}, for more details. You, the | 540 | versa. @xref{Printed Representation}, for more details. You, the |
| 541 | person reading this manual, are thought of as ``the programmer'' and are | 541 | person reading this manual, are thought of as ``the programmer'' and are |
| 542 | addressed as ``you''. ``The user'' is the person who uses Lisp programs, | 542 | addressed as ``you''. ``The user'' is the person who uses Lisp programs, |
| @@ -554,7 +554,7 @@ in this font or form: @var{first-number}. | |||
| 554 | @cindex boolean | 554 | @cindex boolean |
| 555 | @cindex false | 555 | @cindex false |
| 556 | 556 | ||
| 557 | In Lisp, the symbol @code{nil} is overloaded with three meanings: it | 557 | In Lisp, the symbol @code{nil} has three separate meanings: it |
| 558 | is a symbol with the name @samp{nil}; it is the logical truth value | 558 | is a symbol with the name @samp{nil}; it is the logical truth value |
| 559 | @var{false}; and it is the empty list---the list of zero elements. | 559 | @var{false}; and it is the empty list---the list of zero elements. |
| 560 | When used as a variable, @code{nil} always has the value @code{nil}. | 560 | When used as a variable, @code{nil} always has the value @code{nil}. |
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 8e09e3e4dfc..274e36f451f 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi | |||
| @@ -74,7 +74,7 @@ intermediate bindings (found for the events before the last) are all | |||
| 74 | keymaps; if this is not so, the sequence of events does not form a | 74 | keymaps; if this is not so, the sequence of events does not form a |
| 75 | unit---it is not really a key sequence. In other words, removing one or | 75 | unit---it is not really a key sequence. In other words, removing one or |
| 76 | more events from the end of any valid key must always yield a prefix | 76 | more events from the end of any valid key must always yield a prefix |
| 77 | key. For example, @kbd{C-f C-f} is not a key; @kbd{C-f} is not a prefix | 77 | key. For example, @kbd{C-f C-n} is not a key; @kbd{C-f} is not a prefix |
| 78 | key, so a longer sequence starting with @kbd{C-f} cannot be a key. | 78 | key, so a longer sequence starting with @kbd{C-f} cannot be a key. |
| 79 | 79 | ||
| 80 | Note that the set of possible multi-event key sequences depends on the | 80 | Note that the set of possible multi-event key sequences depends on the |
| @@ -207,6 +207,7 @@ otherwise. More precisely, this function tests for a list whose | |||
| 207 | 207 | ||
| 208 | Here we describe the functions for creating keymaps. | 208 | Here we describe the functions for creating keymaps. |
| 209 | 209 | ||
| 210 | @c ??? This should come after makr-sparse-keymap | ||
| 210 | @defun make-keymap &optional prompt | 211 | @defun make-keymap &optional prompt |
| 211 | This function creates and returns a new full keymap (i.e., one | 212 | This function creates and returns a new full keymap (i.e., one |
| 212 | containing a vector of length 128 for defining all the @sc{ASCII} | 213 | containing a vector of length 128 for defining all the @sc{ASCII} |
| @@ -570,9 +571,8 @@ is the order of @code{minor-mode-map-alist}. But you should design | |||
| 570 | minor modes so that they don't interfere with each other. If you do | 571 | minor modes so that they don't interfere with each other. If you do |
| 571 | this properly, the order will not matter. | 572 | this properly, the order will not matter. |
| 572 | 573 | ||
| 573 | See also @code{minor-mode-key-binding} in @ref{Functions for Key | 574 | See also @code{minor-mode-key-binding}, above. See @ref{Keymaps and |
| 574 | Lookup}. See @ref{Keymaps and Minor Modes}, for more information about | 575 | Minor Modes}, for more information about minor modes. |
| 575 | minor modes. | ||
| 576 | @end defvar | 576 | @end defvar |
| 577 | 577 | ||
| 578 | @defvar overriding-local-map | 578 | @defvar overriding-local-map |
| @@ -594,7 +594,7 @@ menu bar display. So if a menu bar key sequence comes in, you should | |||
| 594 | clear @code{overriding-local-map} before looking up and executing that | 594 | clear @code{overriding-local-map} before looking up and executing that |
| 595 | key sequence. Modes that use @code{overriding-local-map} would | 595 | key sequence. Modes that use @code{overriding-local-map} would |
| 596 | typically do this anyway; normally they respond to events that they do | 596 | typically do this anyway; normally they respond to events that they do |
| 597 | not handle by ``unreading'' them and and exiting. | 597 | not handle by ``unreading'' them and exiting. |
| 598 | @end defvar | 598 | @end defvar |
| 599 | 599 | ||
| 600 | @node Key Lookup | 600 | @node Key Lookup |
| @@ -650,12 +650,11 @@ event of the key sequence is looked up in @var{keymap}. | |||
| 650 | The events used so far in the lookup form a complete key, | 650 | The events used so far in the lookup form a complete key, |
| 651 | and @var{command} is its binding. @xref{What Is a Function}. | 651 | and @var{command} is its binding. @xref{What Is a Function}. |
| 652 | 652 | ||
| 653 | @item @var{string} | 653 | @item @var{array} |
| 654 | @itemx @var{vector} | ||
| 655 | @cindex string in keymap | 654 | @cindex string in keymap |
| 656 | The events used so far in the lookup form a complete key, whose | 655 | The array (either a string or a vector) is a keyboard macro. The events |
| 657 | binding is a keyboard macro. See @ref{Keyboard Macros}, for more | 656 | used so far in the lookup form a complete key, and the array is its |
| 658 | information. | 657 | binding. See @ref{Keyboard Macros}, for more information. |
| 659 | 658 | ||
| 660 | @item @var{list} | 659 | @item @var{list} |
| 661 | @cindex list in keymap | 660 | @cindex list in keymap |
| @@ -685,7 +684,7 @@ binding of @var{othertype} in @var{othermap} and uses that. | |||
| 685 | 684 | ||
| 686 | This feature permits you to define one key as an alias for another key. | 685 | This feature permits you to define one key as an alias for another key. |
| 687 | For example, an entry whose @sc{car} is the keymap called @code{esc-map} | 686 | For example, an entry whose @sc{car} is the keymap called @code{esc-map} |
| 688 | and whose @sc{cdr} is 32 (the code for space) means, ``Use the global | 687 | and whose @sc{cdr} is 32 (the code for @key{SPC}) means, ``Use the global |
| 689 | binding of @kbd{Meta-@key{SPC}}, whatever that may be.'' | 688 | binding of @kbd{Meta-@key{SPC}}, whatever that may be.'' |
| 690 | @end itemize | 689 | @end itemize |
| 691 | 690 | ||
| @@ -935,6 +934,10 @@ key name). For example, @code{(control ?a)} is equivalent to | |||
| 935 | @code{?\C-a} and @code{(hyper control left)} is equivalent to | 934 | @code{?\C-a} and @code{(hyper control left)} is equivalent to |
| 936 | @code{C-H-left}. | 935 | @code{C-H-left}. |
| 937 | 936 | ||
| 937 | One advantage of using a list to represent the event type is that the | ||
| 938 | precise numeric codes for the modifier bits don't appear in compiled | ||
| 939 | files. | ||
| 940 | |||
| 938 | For the functions below, an error is signaled if @var{keymap} is not a | 941 | For the functions below, an error is signaled if @var{keymap} is not a |
| 939 | keymap or if @var{key} is not a string or vector representing a key | 942 | keymap or if @var{key} is not a string or vector representing a key |
| 940 | sequence. You can use event types (symbols) as shorthand for events | 943 | sequence. You can use event types (symbols) as shorthand for events |
| @@ -1146,6 +1149,13 @@ or | |||
| 1146 | @end smallexample | 1149 | @end smallexample |
| 1147 | 1150 | ||
| 1148 | @noindent | 1151 | @noindent |
| 1152 | or | ||
| 1153 | |||
| 1154 | @smallexample | ||
| 1155 | (global-set-key [(control ?x) (control ?\\)] 'next-line) | ||
| 1156 | @end smallexample | ||
| 1157 | |||
| 1158 | @noindent | ||
| 1149 | redefines @kbd{C-x C-\} to move down a line. | 1159 | redefines @kbd{C-x C-\} to move down a line. |
| 1150 | 1160 | ||
| 1151 | @smallexample | 1161 | @smallexample |
| @@ -1431,8 +1441,8 @@ You can also supply a second string, called the help string, as follows: | |||
| 1431 | 1441 | ||
| 1432 | Currently Emacs does not actually use @var{help-string}; it knows only | 1442 | Currently Emacs does not actually use @var{help-string}; it knows only |
| 1433 | how to ignore @var{help-string} in order to extract @var{real-binding}. | 1443 | how to ignore @var{help-string} in order to extract @var{real-binding}. |
| 1434 | In the future we hope to make @var{help-string} serve as extended | 1444 | In the future we may use @var{help-string} as extended documentation for |
| 1435 | documentation for the menu item, available on request. | 1445 | the menu item, available on request. |
| 1436 | 1446 | ||
| 1437 | If @var{real-binding} is @code{nil}, then @var{string} appears in the | 1447 | If @var{real-binding} is @code{nil}, then @var{string} appears in the |
| 1438 | menu but cannot be selected. | 1448 | menu but cannot be selected. |
| @@ -1445,6 +1455,11 @@ the menu item only if the expression's value is non-@code{nil}. When a | |||
| 1445 | menu item is disabled, it is displayed in a ``fuzzy'' fashion, and | 1455 | menu item is disabled, it is displayed in a ``fuzzy'' fashion, and |
| 1446 | cannot be selected with the mouse. | 1456 | cannot be selected with the mouse. |
| 1447 | 1457 | ||
| 1458 | The menu bar does not recalculate which items are enabled every time you | ||
| 1459 | look at a menu. This is because the X toolkit requires the whole tree | ||
| 1460 | of menus in advance. To force recalculation of the menu bar, call | ||
| 1461 | @code{force-mode-line-update} (@pxref{Mode Line Format}). | ||
| 1462 | |||
| 1448 | Sometimes it is useful to make menu items that use the ``same'' command | 1463 | Sometimes it is useful to make menu items that use the ``same'' command |
| 1449 | but with different enable conditions. You can do this by defining alias | 1464 | but with different enable conditions. You can do this by defining alias |
| 1450 | commands. Here's an example that makes two aliases for | 1465 | commands. Here's an example that makes two aliases for |
| @@ -1539,10 +1554,14 @@ When the user has found the desired alternative from the menu, he or she | |||
| 1539 | should type the corresponding character---the one whose binding is that | 1554 | should type the corresponding character---the one whose binding is that |
| 1540 | alternative. | 1555 | alternative. |
| 1541 | 1556 | ||
| 1557 | @ignore | ||
| 1542 | In a menu intended for keyboard use, each menu item must clearly | 1558 | In a menu intended for keyboard use, each menu item must clearly |
| 1543 | indicate what character to type. The best convention to use is to make | 1559 | indicate what character to type. The best convention to use is to make |
| 1544 | the character the first letter of the item string. That is something | 1560 | the character the first letter of the item string---that is something |
| 1545 | users will understand without being told. | 1561 | users will understand without being told. We plan to change this; by |
| 1562 | the time you read this manual, keyboard menus may explicitly name the | ||
| 1563 | key for each alternative. | ||
| 1564 | @end ignore | ||
| 1546 | 1565 | ||
| 1547 | This way of using menus in an Emacs-like editor was inspired by the | 1566 | This way of using menus in an Emacs-like editor was inspired by the |
| 1548 | Hierarkey system. | 1567 | Hierarkey system. |
| @@ -1616,8 +1635,8 @@ were @code{nil}. @xref{Active Keymaps}. | |||
| 1616 | parameter must be greater than zero. Emacs uses just one line for the | 1635 | parameter must be greater than zero. Emacs uses just one line for the |
| 1617 | menu bar itself; if you specify more than one line, the other lines | 1636 | menu bar itself; if you specify more than one line, the other lines |
| 1618 | serve to separate the menu bar from the windows in the frame. We | 1637 | serve to separate the menu bar from the windows in the frame. We |
| 1619 | recommend you try 1 or 2 as the value of @code{menu-bar-lines}. @xref{X | 1638 | recommend 1 or 2 as the value of @code{menu-bar-lines}. @xref{X Frame |
| 1620 | Frame Parameters}. | 1639 | Parameters}. |
| 1621 | 1640 | ||
| 1622 | Here's an example of setting up a menu bar item: | 1641 | Here's an example of setting up a menu bar item: |
| 1623 | 1642 | ||
diff --git a/lispref/lists.texi b/lispref/lists.texi index 55ce93c9547..6bb33b80126 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi | |||
| @@ -543,9 +543,9 @@ Here are some examples where the final argument is not a list: | |||
| 543 | 543 | ||
| 544 | @example | 544 | @example |
| 545 | (append '(x y) 'z) | 545 | (append '(x y) 'z) |
| 546 | @result{} (x y z) | 546 | @result{} (x y . z) |
| 547 | (append '(x y) [z]) | 547 | (append '(x y) [z]) |
| 548 | @result{} (x y [z]) | 548 | @result{} (x y . [z]) |
| 549 | @end example | 549 | @end example |
| 550 | 550 | ||
| 551 | @noindent | 551 | @noindent |
| @@ -980,11 +980,6 @@ sorted order. If you wish to make a sorted copy without destroying the | |||
| 980 | original, copy it first with @code{copy-sequence} and then sort. | 980 | original, copy it first with @code{copy-sequence} and then sort. |
| 981 | 981 | ||
| 982 | Sorting does not change the @sc{car}s of the cons cells in @var{list}; | 982 | Sorting does not change the @sc{car}s of the cons cells in @var{list}; |
| 983 | each cons cell in the result contains the same element that it contained | ||
| 984 | before. The result differs from the argument @var{list} because the | ||
| 985 | cells themselves have been reordered. | ||
| 986 | |||
| 987 | Sorting does not change the @sc{car}s of the cons cells in @var{list}; | ||
| 988 | the cons cell that originally contained the element @code{a} in | 983 | the cons cell that originally contained the element @code{a} in |
| 989 | @var{list} still has @code{a} in its @sc{car} after sorting, but it now | 984 | @var{list} still has @code{a} in its @sc{car} after sorting, but it now |
| 990 | appears in a different position in the list due to the change of | 985 | appears in a different position in the list due to the change of |
| @@ -1106,8 +1101,8 @@ sample-list | |||
| 1106 | @end group | 1101 | @end group |
| 1107 | @end example | 1102 | @end example |
| 1108 | 1103 | ||
| 1109 | Note that @code{(delq 'b sample-list)} modifies @code{sample-list} to | 1104 | Note that @code{(delq 'c sample-list)} modifies @code{sample-list} to |
| 1110 | splice out the second element, but @code{(delq 'a sample-list)} does not | 1105 | splice out the third element, but @code{(delq 'a sample-list)} does not |
| 1111 | splice anything---it just returns a shorter list. Don't assume that a | 1106 | splice anything---it just returns a shorter list. Don't assume that a |
| 1112 | variable which formerly held the argument @var{list} now has fewer | 1107 | variable which formerly held the argument @var{list} now has fewer |
| 1113 | elements, or that it still holds the original list! Instead, save the | 1108 | elements, or that it still holds the original list! Instead, save the |
| @@ -1178,6 +1173,9 @@ GNU Emacs Lisp are derived from Maclisp, not Common Lisp. The Common | |||
| 1178 | Lisp versions do not use @code{equal} to compare elements. | 1173 | Lisp versions do not use @code{equal} to compare elements. |
| 1179 | @end quotation | 1174 | @end quotation |
| 1180 | 1175 | ||
| 1176 | See also the function @code{add-to-list}, in @ref{Setting Variables}, | ||
| 1177 | for another way to add an element to a list stored in a variable. | ||
| 1178 | |||
| 1181 | @node Association Lists | 1179 | @node Association Lists |
| 1182 | @section Association Lists | 1180 | @section Association Lists |
| 1183 | @cindex association list | 1181 | @cindex association list |
diff --git a/lispref/loading.texi b/lispref/loading.texi index 645ada83976..3f88132b20b 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -37,7 +37,7 @@ containing Lisp code. | |||
| 37 | * How Programs Do Loading:: The @code{load} function and others. | 37 | * How Programs Do Loading:: The @code{load} function and others. |
| 38 | * Autoload:: Setting up a function to autoload. | 38 | * Autoload:: Setting up a function to autoload. |
| 39 | * Repeated Loading:: Precautions about loading a file twice. | 39 | * Repeated Loading:: Precautions about loading a file twice. |
| 40 | * Features:: Loading a library if it isn't already loaded. | 40 | * Named Features:: Loading a library if it isn't already loaded. |
| 41 | * Unloading:: How to ``unload'' a library that was loaded. | 41 | * Unloading:: How to ``unload'' a library that was loaded. |
| 42 | * Hooks for Loading:: Providing code to be run when | 42 | * Hooks for Loading:: Providing code to be run when |
| 43 | particular libraries are loaded. | 43 | particular libraries are loaded. |
| @@ -50,7 +50,7 @@ containing Lisp code. | |||
| 50 | @code{autoload} creates a placeholder object for a function in a file; | 50 | @code{autoload} creates a placeholder object for a function in a file; |
| 51 | trying to call the autoloading function loads the file to get the | 51 | trying to call the autoloading function loads the file to get the |
| 52 | function's real definition (@pxref{Autoload}). @code{require} loads a | 52 | function's real definition (@pxref{Autoload}). @code{require} loads a |
| 53 | file if it isn't already loaded (@pxref{Features}). Ultimately, all | 53 | file if it isn't already loaded (@pxref{Named Features}). Ultimately, all |
| 54 | these facilities call the @code{load} function to do the work. | 54 | these facilities call the @code{load} function to do the work. |
| 55 | 55 | ||
| 56 | @defun load filename &optional missing-ok nomessage nosuffix | 56 | @defun load filename &optional missing-ok nomessage nosuffix |
| @@ -136,9 +136,10 @@ default value is specified in @file{emacs/src/paths.h} when Emacs is | |||
| 136 | built. | 136 | built. |
| 137 | 137 | ||
| 138 | The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH}; | 138 | The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH}; |
| 139 | @samp{:} separates directory names, and @samp{.} is used for the current | 139 | @samp{:} (or @samp{;}, according to the operating system) separates |
| 140 | default directory. Here is an example of how to set your | 140 | directory names, and @samp{.} is used for the current default directory. |
| 141 | @code{EMACSLOADPATH} variable from a @code{csh} @file{.login} file: | 141 | Here is an example of how to set your @code{EMACSLOADPATH} variable from |
| 142 | a @code{csh} @file{.login} file: | ||
| 142 | 143 | ||
| 143 | @c This overfull hbox is OK. --rjc 16mar92 | 144 | @c This overfull hbox is OK. --rjc 16mar92 |
| 144 | @smallexample | 145 | @smallexample |
| @@ -192,9 +193,7 @@ calls to @code{load}. | |||
| 192 | 193 | ||
| 193 | @defvar load-in-progress | 194 | @defvar load-in-progress |
| 194 | This variable is non-@code{nil} if Emacs is in the process of loading a | 195 | This variable is non-@code{nil} if Emacs is in the process of loading a |
| 195 | file, and it is @code{nil} otherwise. This is how @code{defun} and | 196 | file, and it is @code{nil} otherwise. |
| 196 | @code{provide} determine whether a load is in progress, so that their | ||
| 197 | effect can be undone if the load fails. | ||
| 198 | @end defvar | 197 | @end defvar |
| 199 | 198 | ||
| 200 | @defvar load-read-function | 199 | @defvar load-read-function |
| @@ -213,9 +212,9 @@ functions should use @code{read}. | |||
| 213 | @cindex autoload | 212 | @cindex autoload |
| 214 | 213 | ||
| 215 | The @dfn{autoload} facility allows you to make a function or macro | 214 | The @dfn{autoload} facility allows you to make a function or macro |
| 216 | available but put off loading its actual definition. The first call to | 215 | known in Lisp, but put off loading the file that defines it. The first |
| 217 | the function automatically reads the proper file to install the real | 216 | call to the function automatically reads the proper file to install the |
| 218 | definition and other associated code, then runs the real definition | 217 | real definition and other associated code, then runs the real definition |
| 219 | as if it had been loaded all along. | 218 | as if it had been loaded all along. |
| 220 | 219 | ||
| 221 | There are two ways to set up an autoloaded function: by calling | 220 | There are two ways to set up an autoloaded function: by calling |
| @@ -378,11 +377,16 @@ To avoid the problem, write this: | |||
| 378 | (cons '(leif-mode " Leif") minor-mode-alist))) | 377 | (cons '(leif-mode " Leif") minor-mode-alist))) |
| 379 | @end example | 378 | @end example |
| 380 | 379 | ||
| 380 | To add an element to a list just once, use @code{add-to-list} | ||
| 381 | (@pxref{Setting Variables}). | ||
| 382 | |||
| 381 | Occasionally you will want to test explicitly whether a library has | 383 | Occasionally you will want to test explicitly whether a library has |
| 382 | already been loaded. Here's one way to test, in a library, whether it | 384 | already been loaded. Here's one way to test, in a library, whether it |
| 383 | has been loaded before: | 385 | has been loaded before: |
| 384 | 386 | ||
| 385 | @example | 387 | @example |
| 388 | (defvar foo-was-loaded) | ||
| 389 | |||
| 386 | (if (not (boundp 'foo-was-loaded)) | 390 | (if (not (boundp 'foo-was-loaded)) |
| 387 | @var{execute-first-time-only}) | 391 | @var{execute-first-time-only}) |
| 388 | 392 | ||
| @@ -393,10 +397,10 @@ has been loaded before: | |||
| 393 | If the library uses @code{provide} to provide a named feature, you can | 397 | If the library uses @code{provide} to provide a named feature, you can |
| 394 | use @code{featurep} to test whether the library has been loaded. | 398 | use @code{featurep} to test whether the library has been loaded. |
| 395 | @ifinfo | 399 | @ifinfo |
| 396 | @xref{Features}. | 400 | @xref{Named Features}. |
| 397 | @end ifinfo | 401 | @end ifinfo |
| 398 | 402 | ||
| 399 | @node Features | 403 | @node Named Features |
| 400 | @section Features | 404 | @section Features |
| 401 | @cindex features | 405 | @cindex features |
| 402 | @cindex requiring features | 406 | @cindex requiring features |
| @@ -500,9 +504,10 @@ features | |||
| 500 | @result{} (foo bar bish) | 504 | @result{} (foo bar bish) |
| 501 | @end smallexample | 505 | @end smallexample |
| 502 | 506 | ||
| 503 | If the file isn't completely loaded, due to an error in the evaluating | 507 | When a file is loaded to satisfy an autoload, and it stops due to an |
| 504 | its contents, any function definitions or @code{provide} calls that | 508 | error in the evaluating its contents, any function definitions or |
| 505 | occurred during the load are undone. @xref{Autoload}. | 509 | @code{provide} calls that occurred during the load are undone. |
| 510 | @xref{Autoload}. | ||
| 506 | @end defun | 511 | @end defun |
| 507 | 512 | ||
| 508 | @defun require feature &optional filename | 513 | @defun require feature &optional filename |
| @@ -544,7 +549,8 @@ This command unloads the library that provided feature @var{feature}. | |||
| 544 | It undefines all functions, macros, and variables defined in that | 549 | It undefines all functions, macros, and variables defined in that |
| 545 | library with @code{defconst}, @code{defvar}, @code{defun}, | 550 | library with @code{defconst}, @code{defvar}, @code{defun}, |
| 546 | @code{defmacro}, @code{defsubst} and @code{defalias}. It then restores | 551 | @code{defmacro}, @code{defsubst} and @code{defalias}. It then restores |
| 547 | any autoloads formerly associated with those symbols. | 552 | any autoloads formerly associated with those symbols. (Loading |
| 553 | saves these in the @code{autoload} property of the symbol.) | ||
| 548 | 554 | ||
| 549 | Ordinarily, @code{unload-feature} refuses to unload a library on which | 555 | Ordinarily, @code{unload-feature} refuses to unload a library on which |
| 550 | other loaded libraries depend. (A library @var{a} depends on library | 556 | other loaded libraries depend. (A library @var{a} depends on library |
| @@ -615,7 +621,7 @@ do (1), you can do it immediately---there is no need to wait for when | |||
| 615 | the library is loaded. To do (2), you must load the library (preferably | 621 | the library is loaded. To do (2), you must load the library (preferably |
| 616 | with @code{require}). | 622 | with @code{require}). |
| 617 | 623 | ||
| 618 | But it is to use @code{eval-after-load} in your personal customizations | 624 | But it is ok to use @code{eval-after-load} in your personal customizations |
| 619 | if you don't feel they must meet the design standards of programs to be | 625 | if you don't feel they must meet the design standards of programs to be |
| 620 | released. | 626 | released. |
| 621 | 627 | ||
diff --git a/lispref/locals.texi b/lispref/locals.texi index 24db38d7f60..86e6750248c 100644 --- a/lispref/locals.texi +++ b/lispref/locals.texi | |||
| @@ -28,6 +28,9 @@ define such variables for their internal use; we don't list them here. | |||
| 28 | @item buffer-display-table | 28 | @item buffer-display-table |
| 29 | @pxref{Display Tables} | 29 | @pxref{Display Tables} |
| 30 | 30 | ||
| 31 | @item buffer-file-format | ||
| 32 | @pxref{Format Conversion} | ||
| 33 | |||
| 31 | @item buffer-file-name | 34 | @item buffer-file-name |
| 32 | @pxref{Buffer File Name} | 35 | @pxref{Buffer File Name} |
| 33 | 36 | ||
| @@ -40,6 +43,9 @@ define such variables for their internal use; we don't list them here. | |||
| 40 | @item buffer-file-type | 43 | @item buffer-file-type |
| 41 | @pxref{Files and MS-DOS} | 44 | @pxref{Files and MS-DOS} |
| 42 | 45 | ||
| 46 | @item buffer-invisibility-spec | ||
| 47 | @pxref{Invisible Text} | ||
| 48 | |||
| 43 | @item buffer-offer-save | 49 | @item buffer-offer-save |
| 44 | @pxref{Saving Buffers} | 50 | @pxref{Saving Buffers} |
| 45 | 51 | ||
| @@ -121,6 +127,9 @@ define such variables for their internal use; we don't list them here. | |||
| 121 | @item paragraph-start | 127 | @item paragraph-start |
| 122 | @pxref{Standard Regexps} | 128 | @pxref{Standard Regexps} |
| 123 | 129 | ||
| 130 | @item point-before-scroll | ||
| 131 | Used for communication between mouse commands and scroll-bar commands. | ||
| 132 | |||
| 124 | @item require-final-newline | 133 | @item require-final-newline |
| 125 | @pxref{Insertion} | 134 | @pxref{Insertion} |
| 126 | 135 | ||
diff --git a/lispref/macros.texi b/lispref/macros.texi index c5cf625c8c7..22a07f14dbe 100644 --- a/lispref/macros.texi +++ b/lispref/macros.texi | |||
| @@ -163,8 +163,11 @@ macro in the same file where it is used and before its first use. | |||
| 163 | Byte-compiling a file executes any @code{require} calls at top-level | 163 | Byte-compiling a file executes any @code{require} calls at top-level |
| 164 | in the file. This is in case the file needs the required packages for | 164 | in the file. This is in case the file needs the required packages for |
| 165 | proper compilation. One way to ensure that necessary macro definitions | 165 | proper compilation. One way to ensure that necessary macro definitions |
| 166 | are available during compilation is to require the file that defines | 166 | are available during compilation is to require the files that define |
| 167 | them. @xref{Features}. | 167 | them (@pxref{Named Features}). To avoid loading the macro definition files |
| 168 | when someone @emph{runs} the compiled program, write | ||
| 169 | @code{eval-when-compile} around the @code{require} calls (@pxref{Eval | ||
| 170 | During Compile}). | ||
| 168 | 171 | ||
| 169 | @node Defining Macros | 172 | @node Defining Macros |
| 170 | @section Defining Macros | 173 | @section Defining Macros |
| @@ -176,9 +179,9 @@ from the macro call. | |||
| 176 | 179 | ||
| 177 | It is possible to use an anonymous Lisp macro just like an anonymous | 180 | It is possible to use an anonymous Lisp macro just like an anonymous |
| 178 | function, but this is never done, because it does not make sense to pass | 181 | function, but this is never done, because it does not make sense to pass |
| 179 | an anonymous macro to mapping functions such as @code{mapcar}. In | 182 | an anonymous macro to functionals such as @code{mapcar}. In practice, |
| 180 | practice, all Lisp macros have names, and they are usually defined with | 183 | all Lisp macros have names, and they are usually defined with the |
| 181 | the special form @code{defmacro}. | 184 | special form @code{defmacro}. |
| 182 | 185 | ||
| 183 | @defspec defmacro name argument-list body-forms@dots{} | 186 | @defspec defmacro name argument-list body-forms@dots{} |
| 184 | @code{defmacro} defines the symbol @var{name} as a macro that looks | 187 | @code{defmacro} defines the symbol @var{name} as a macro that looks |
| @@ -207,7 +210,7 @@ called interactively. | |||
| 207 | 210 | ||
| 208 | Macros often need to construct large list structures from a mixture of | 211 | Macros often need to construct large list structures from a mixture of |
| 209 | constants and nonconstant parts. To make this easier, use the macro | 212 | constants and nonconstant parts. To make this easier, use the macro |
| 210 | @code{`} (often called @dfn{backquote}). | 213 | @samp{`} (often called @dfn{backquote}). |
| 211 | 214 | ||
| 212 | Backquote allows you to quote a list, but selectively evaluate | 215 | Backquote allows you to quote a list, but selectively evaluate |
| 213 | elements of that list. In the simplest case, it is identical to the | 216 | elements of that list. In the simplest case, it is identical to the |
| @@ -226,9 +229,9 @@ two forms yield identical results: | |||
| 226 | @end example | 229 | @end example |
| 227 | 230 | ||
| 228 | @findex , @r{(with Backquote)} | 231 | @findex , @r{(with Backquote)} |
| 229 | The special marker @code{,} inside of the argument to backquote | 232 | The special marker @samp{,} inside of the argument to backquote |
| 230 | indicates a value that isn't constant. Backquote evaluates the | 233 | indicates a value that isn't constant. Backquote evaluates the |
| 231 | argument of @code{,} and puts the value in the list structure: | 234 | argument of @samp{,} and puts the value in the list structure: |
| 232 | 235 | ||
| 233 | @example | 236 | @example |
| 234 | @group | 237 | @group |
| @@ -244,9 +247,9 @@ argument of @code{,} and puts the value in the list structure: | |||
| 244 | @findex ,@@ @r{(with Backquote)} | 247 | @findex ,@@ @r{(with Backquote)} |
| 245 | @cindex splicing (with backquote) | 248 | @cindex splicing (with backquote) |
| 246 | You can also @dfn{splice} an evaluated value into the resulting list, | 249 | You can also @dfn{splice} an evaluated value into the resulting list, |
| 247 | using the special marker @code{,@@}. The elements of the spliced list | 250 | using the special marker @samp{,@@}. The elements of the spliced list |
| 248 | become elements at the same level as the other elements of the resulting | 251 | become elements at the same level as the other elements of the resulting |
| 249 | list. The equivalent code without using @code{`} is often unreadable. | 252 | list. The equivalent code without using @samp{`} is often unreadable. |
| 250 | Here are some examples: | 253 | Here are some examples: |
| 251 | 254 | ||
| 252 | @example | 255 | @example |
| @@ -280,12 +283,12 @@ Here are some examples: | |||
| 280 | @end example | 283 | @end example |
| 281 | 284 | ||
| 282 | @quotation | 285 | @quotation |
| 283 | Before Emacs version 19.29, @code{`} used a different syntax which | 286 | Before Emacs version 19.29, @samp{`} used a different syntax which |
| 284 | required an extra level of parentheses around the entire backquote | 287 | required an extra level of parentheses around the entire backquote |
| 285 | construct. Likewise, each @code{,} or @code{,@@} substition required an | 288 | construct. Likewise, each @samp{,} or @samp{,@@} substition required an |
| 286 | extra level of parentheses surrounding both the @code{,} or @code{,@@} | 289 | extra level of parentheses surrounding both the @samp{,} or @samp{,@@} |
| 287 | and the following expression. The old syntax required whitespace | 290 | and the following expression. The old syntax required whitespace |
| 288 | between the @code{`}, @code{,} or @code{,@@} and the following | 291 | between the @samp{`}, @samp{,} or @samp{,@@} and the following |
| 289 | expression. | 292 | expression. |
| 290 | 293 | ||
| 291 | This syntax is still accepted, but no longer recommended except for | 294 | This syntax is still accepted, but no longer recommended except for |
| @@ -363,10 +366,10 @@ Here's an equivalent definition simplified through use of backquote: | |||
| 363 | (defmacro for (var from init to final do &rest body) | 366 | (defmacro for (var from init to final do &rest body) |
| 364 | "Execute a simple \"for\" loop. | 367 | "Execute a simple \"for\" loop. |
| 365 | For example, (for i from 1 to 10 do (print i))." | 368 | For example, (for i from 1 to 10 do (print i))." |
| 366 | (` (let (((, var) (, init))) | 369 | `(let ((,var ,init)) |
| 367 | (while (<= (, var) (, final)) | 370 | (while (<= ,var ,final) |
| 368 | (,@@ body) | 371 | ,@@body |
| 369 | (inc (, var)))))) | 372 | (inc ,var)))) |
| 370 | @end group | 373 | @end group |
| 371 | @end smallexample | 374 | @end smallexample |
| 372 | 375 | ||
| @@ -400,11 +403,11 @@ Here is a macro definition that creates this expansion: | |||
| 400 | @group | 403 | @group |
| 401 | (defmacro for (var from init to final do &rest body) | 404 | (defmacro for (var from init to final do &rest body) |
| 402 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." | 405 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." |
| 403 | (` (let (((, var) (, init)) | 406 | `(let ((,var ,init) |
| 404 | (max (, final))) | 407 | (max ,final)) |
| 405 | (while (<= (, var) max) | 408 | (while (<= ,var max) |
| 406 | (,@@ body) | 409 | ,@@body |
| 407 | (inc (, var)))))) | 410 | (inc ,var)))) |
| 408 | @end group | 411 | @end group |
| 409 | @end smallexample | 412 | @end smallexample |
| 410 | 413 | ||
| @@ -427,11 +430,11 @@ number of times: | |||
| 427 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." | 430 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." |
| 428 | @end group | 431 | @end group |
| 429 | @group | 432 | @group |
| 430 | (` (let (((, var) (, init)) | 433 | `(let ((,var ,init) |
| 431 | (max (, final))) | 434 | (max ,final)) |
| 432 | (while (<= (, var) max) | 435 | (while (<= ,var max) |
| 433 | (,@@ body) | 436 | ,@@body |
| 434 | (inc (, var)))))) | 437 | (inc ,var)))) |
| 435 | @end group | 438 | @end group |
| 436 | @end smallexample | 439 | @end smallexample |
| 437 | @end ifinfo | 440 | @end ifinfo |
| @@ -469,11 +472,11 @@ this way: | |||
| 469 | (defmacro for (var from init to final do &rest body) | 472 | (defmacro for (var from init to final do &rest body) |
| 470 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." | 473 | "Execute a simple for loop: (for i from 1 to 10 do (print i))." |
| 471 | (let ((tempvar (make-symbol "max"))) | 474 | (let ((tempvar (make-symbol "max"))) |
| 472 | (` (let (((, var) (, init)) | 475 | `(let ((,var ,init) |
| 473 | ((, tempvar) (, final))) | 476 | (,tempvar ,final)) |
| 474 | (while (<= (, var) (, tempvar)) | 477 | (while (<= ,var ,tempvar) |
| 475 | (,@@ body) | 478 | ,@@body |
| 476 | (inc (, var))))))) | 479 | (inc ,var))))) |
| 477 | @end group | 480 | @end group |
| 478 | @end smallexample | 481 | @end smallexample |
| 479 | 482 | ||
diff --git a/lispref/maps.texi b/lispref/maps.texi index d27be34d76e..77dc80001b9 100644 --- a/lispref/maps.texi +++ b/lispref/maps.texi | |||
| @@ -29,9 +29,15 @@ A sparse keymap used by C mode. | |||
| 29 | A full keymap used by Command History mode. | 29 | A full keymap used by Command History mode. |
| 30 | 30 | ||
| 31 | @item ctl-x-4-map | 31 | @item ctl-x-4-map |
| 32 | @vindex ctl-x-4-map | ||
| 32 | A sparse keymap for subcommands of the prefix @kbd{C-x 4}. | 33 | A sparse keymap for subcommands of the prefix @kbd{C-x 4}. |
| 33 | 34 | ||
| 35 | @item ctl-x-5-map | ||
| 36 | @vindex ctl-x-5-map | ||
| 37 | A sparse keymap for subcommands of the prefix @kbd{C-x 5}. | ||
| 38 | |||
| 34 | @item ctl-x-map | 39 | @item ctl-x-map |
| 40 | @vindex ctl-x-map | ||
| 35 | A full keymap for @kbd{C-x} commands. | 41 | A full keymap for @kbd{C-x} commands. |
| 36 | 42 | ||
| 37 | @item debugger-mode-map | 43 | @item debugger-mode-map |
| @@ -42,10 +48,6 @@ A full keymap used by Debugger mode. | |||
| 42 | @vindex dired-mode-map | 48 | @vindex dired-mode-map |
| 43 | A full keymap for @code{dired-mode} buffers. | 49 | A full keymap for @code{dired-mode} buffers. |
| 44 | 50 | ||
| 45 | @item doctor-mode-map | ||
| 46 | @vindex doctor-mode-map | ||
| 47 | A sparse keymap used by Doctor mode. | ||
| 48 | |||
| 49 | @item edit-abbrevs-map | 51 | @item edit-abbrevs-map |
| 50 | @vindex edit-abbrevs-map | 52 | @vindex edit-abbrevs-map |
| 51 | A sparse keymap used in @code{edit-abbrevs}. | 53 | A sparse keymap used in @code{edit-abbrevs}. |
| @@ -66,6 +68,38 @@ A full keymap used by Electric Command History mode. | |||
| 66 | @vindex emacs-lisp-mode-map | 68 | @vindex emacs-lisp-mode-map |
| 67 | A sparse keymap used by Emacs Lisp mode. | 69 | A sparse keymap used by Emacs Lisp mode. |
| 68 | 70 | ||
| 71 | @item facemenu-menu | ||
| 72 | @vindex facemenu-menu | ||
| 73 | The keymap that displays the Text Properties menu. | ||
| 74 | |||
| 75 | @item facemenu-background-menu | ||
| 76 | @vindex facemenu-background-menu | ||
| 77 | The keymap that displays the Background Color submenu of the Text | ||
| 78 | Properties menu. | ||
| 79 | |||
| 80 | @item facemenu-face-menu | ||
| 81 | @vindex facemenu-face-menu | ||
| 82 | The keymap that displays the Face submenu of the Text Properties menu. | ||
| 83 | |||
| 84 | @item facemenu-foreground-menu | ||
| 85 | @vindex facemenu-foreground-menu | ||
| 86 | The keymap that displays the Foreground Color submenu of the Text | ||
| 87 | Properties menu. | ||
| 88 | |||
| 89 | @item facemenu-indentation-menu | ||
| 90 | @vindex facemenu-indentation-menu | ||
| 91 | The keymap that displays the Indentation submenu of the Text Properties menu. | ||
| 92 | |||
| 93 | @item facemenu-justification-menu | ||
| 94 | @vindex facemenu-justification-menu | ||
| 95 | The keymap that displays the Justification submenu of the Text | ||
| 96 | Properties menu. | ||
| 97 | |||
| 98 | @item facemenu-special-menu | ||
| 99 | @vindex facemenu-special-menu | ||
| 100 | The keymap that displays the Special Props submenu of the Text | ||
| 101 | Properties menu. | ||
| 102 | |||
| 69 | @item function-key-map | 103 | @item function-key-map |
| 70 | @vindex function-key-map | 104 | @vindex function-key-map |
| 71 | The keymap for translating keypad and function keys.@* | 105 | The keymap for translating keypad and function keys.@* |
| @@ -91,6 +125,7 @@ A sparse keymap used by the @kbd{e} command of Info. | |||
| 91 | A sparse keymap containing Info commands. | 125 | A sparse keymap containing Info commands. |
| 92 | 126 | ||
| 93 | @item isearch-mode-map | 127 | @item isearch-mode-map |
| 128 | @vindex isearch-mode-map | ||
| 94 | A keymap that defines the characters you can type within incremental | 129 | A keymap that defines the characters you can type within incremental |
| 95 | search. | 130 | search. |
| 96 | 131 | ||
| @@ -107,7 +142,28 @@ A sparse keymap used by Lisp mode. | |||
| 107 | @vindex lisp-mode-map | 142 | @vindex lisp-mode-map |
| 108 | A sparse keymap used by Lisp mode. | 143 | A sparse keymap used by Lisp mode. |
| 109 | 144 | ||
| 145 | @item menu-bar-edit-menu | ||
| 146 | @vindex menu-bar-edit-menu | ||
| 147 | The keymap which displays the Edit menu in the menu bar. | ||
| 148 | |||
| 149 | @item menu-bar-files-menu | ||
| 150 | @vindex menu-bar-files-menu | ||
| 151 | The keymap which displays the Files menu in the menu bar. | ||
| 152 | |||
| 153 | @item menu-bar-help-menu | ||
| 154 | @vindex menu-bar-help-menu | ||
| 155 | The keymap which displays the Help menu in the menu bar. | ||
| 156 | |||
| 157 | @item menu-bar-search-menu | ||
| 158 | @vindex menu-bar-search-menu | ||
| 159 | The keymap which displays the Search menu in the menu bar. | ||
| 160 | |||
| 161 | @item menu-bar-tools-menu | ||
| 162 | @vindex menu-bar-tools-menu | ||
| 163 | The keymap which displays the Tools menu in the menu bar. | ||
| 164 | |||
| 110 | @item mode-specific-map | 165 | @item mode-specific-map |
| 166 | @vindex mode-specific-map | ||
| 111 | The keymap for characters following @kbd{C-c}. Note, this is in the | 167 | The keymap for characters following @kbd{C-c}. Note, this is in the |
| 112 | global map. This map is not actually mode specific: its name was chosen | 168 | global map. This map is not actually mode specific: its name was chosen |
| 113 | to be informative for the user in @kbd{C-h b} (@code{display-bindings}), | 169 | to be informative for the user in @kbd{C-h b} (@code{display-bindings}), |
| @@ -118,6 +174,7 @@ where it describes the main use of the @kbd{C-c} prefix key. | |||
| 118 | A local keymap used by Occur mode. | 174 | A local keymap used by Occur mode. |
| 119 | 175 | ||
| 120 | @item query-replace-map | 176 | @item query-replace-map |
| 177 | @vindex query-replace-map | ||
| 121 | A local keymap used for responses in @code{query-replace} and related | 178 | A local keymap used for responses in @code{query-replace} and related |
| 122 | commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions | 179 | commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions |
| 123 | that use this map do not support prefix keys; they look up one event at a | 180 | that use this map do not support prefix keys; they look up one event at a |
diff --git a/lispref/markers.texi b/lispref/markers.texi index ef991890a18..8c41fa17f17 100644 --- a/lispref/markers.texi +++ b/lispref/markers.texi | |||
| @@ -496,10 +496,10 @@ The return value is not meaningful. | |||
| 496 | 496 | ||
| 497 | @defopt transient-mark-mode | 497 | @defopt transient-mark-mode |
| 498 | @cindex Transient Mark mode | 498 | @cindex Transient Mark mode |
| 499 | This variable enables Transient Mark mode, in which every | 499 | This variable if non-@code{nil} enables Transient Mark mode, in which |
| 500 | buffer-modifying primitive sets @code{deactivate-mark}. The consequence | 500 | every buffer-modifying primitive sets @code{deactivate-mark}. The |
| 501 | of this is that commands that modify the buffer normally make the mark | 501 | consequence of this is that commands that modify the buffer normally |
| 502 | inactive. | 502 | make the mark inactive. |
| 503 | @end defopt | 503 | @end defopt |
| 504 | 504 | ||
| 505 | @defvar deactivate-mark | 505 | @defvar deactivate-mark |
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index 10dc146535e..17efa0e8dc8 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi | |||
| @@ -61,7 +61,7 @@ name on command symbols (@pxref{Minibuffer Misc}). | |||
| 61 | 61 | ||
| 62 | Like other buffers, a minibuffer may use any of several local keymaps | 62 | Like other buffers, a minibuffer may use any of several local keymaps |
| 63 | (@pxref{Keymaps}); these contain various exit commands and in some cases | 63 | (@pxref{Keymaps}); these contain various exit commands and in some cases |
| 64 | completion commands. @xref{Completion}. | 64 | completion commands (@pxref{Completion}). |
| 65 | 65 | ||
| 66 | @itemize @bullet | 66 | @itemize @bullet |
| 67 | @item | 67 | @item |
| @@ -87,6 +87,11 @@ also be used to read a Lisp object in textual form. The most basic | |||
| 87 | primitive for minibuffer input is @code{read-from-minibuffer}; it can do | 87 | primitive for minibuffer input is @code{read-from-minibuffer}; it can do |
| 88 | either one. | 88 | either one. |
| 89 | 89 | ||
| 90 | In most cases, you should not call minibuffer input functions in the | ||
| 91 | middle of a Lisp function. Instead, do all minibuffer input as part of | ||
| 92 | reading the arguments for a command, in the @code{interactive} spec. | ||
| 93 | @xref{Defining Commands}. | ||
| 94 | |||
| 90 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist | 95 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist |
| 91 | This function is the most general way to get input through the | 96 | This function is the most general way to get input through the |
| 92 | minibuffer. By default, it accepts arbitrary text and returns it as a | 97 | minibuffer. By default, it accepts arbitrary text and returns it as a |
| @@ -199,12 +204,9 @@ possible to put a space into the string, by quoting it. | |||
| 199 | @defvar minibuffer-local-ns-map | 204 | @defvar minibuffer-local-ns-map |
| 200 | This built-in variable is the keymap used as the minibuffer local keymap | 205 | This built-in variable is the keymap used as the minibuffer local keymap |
| 201 | in the function @code{read-no-blanks-input}. By default, it makes the | 206 | in the function @code{read-no-blanks-input}. By default, it makes the |
| 202 | following bindings: | 207 | following bindings, in addition to those of @code{minibuffer-local-map}: |
| 203 | 208 | ||
| 204 | @table @asis | 209 | @table @asis |
| 205 | @item @key{LFD} | ||
| 206 | @code{exit-minibuffer} | ||
| 207 | |||
| 208 | @item @key{SPC} | 210 | @item @key{SPC} |
| 209 | @cindex @key{SPC} in minibuffer | 211 | @cindex @key{SPC} in minibuffer |
| 210 | @code{exit-minibuffer} | 212 | @code{exit-minibuffer} |
| @@ -213,27 +215,9 @@ following bindings: | |||
| 213 | @cindex @key{TAB} in minibuffer | 215 | @cindex @key{TAB} in minibuffer |
| 214 | @code{exit-minibuffer} | 216 | @code{exit-minibuffer} |
| 215 | 217 | ||
| 216 | @item @key{RET} | ||
| 217 | @code{exit-minibuffer} | ||
| 218 | |||
| 219 | @item @kbd{C-g} | ||
| 220 | @code{abort-recursive-edit} | ||
| 221 | |||
| 222 | @item @kbd{?} | 218 | @item @kbd{?} |
| 223 | @cindex @kbd{?} in minibuffer | 219 | @cindex @kbd{?} in minibuffer |
| 224 | @code{self-insert-and-exit} | 220 | @code{self-insert-and-exit} |
| 225 | |||
| 226 | @item @kbd{M-n} | ||
| 227 | @code{next-history-element} | ||
| 228 | |||
| 229 | @item @kbd{M-p} | ||
| 230 | @code{previous-history-element} | ||
| 231 | |||
| 232 | @item @kbd{M-r} | ||
| 233 | @code{next-matching-history-element} | ||
| 234 | |||
| 235 | @item @kbd{M-s} | ||
| 236 | @code{previous-matching-history-element} | ||
| 237 | @end table | 221 | @end table |
| 238 | @end defvar | 222 | @end defvar |
| 239 | 223 | ||
| @@ -805,6 +789,11 @@ can be completed because the next character is not uniquely determined. | |||
| 805 | This section describes the higher-level convenient functions for | 789 | This section describes the higher-level convenient functions for |
| 806 | reading certain sorts of names with completion. | 790 | reading certain sorts of names with completion. |
| 807 | 791 | ||
| 792 | In most cases, you should not call these functions in the middle of a | ||
| 793 | Lisp function. When possible, do all minibuffer input as part of | ||
| 794 | reading the arguments for a command, in the @code{interactive} spec. | ||
| 795 | @xref{Defining Commands}. | ||
| 796 | |||
| 808 | @defun read-buffer prompt &optional default existing | 797 | @defun read-buffer prompt &optional default existing |
| 809 | This function reads the name of a buffer and returns it as a string. | 798 | This function reads the name of a buffer and returns it as a string. |
| 810 | The argument @var{default} is the default name to use, the value to | 799 | The argument @var{default} is the default name to use, the value to |
| @@ -1000,7 +989,8 @@ This variable is used by @code{read-file-name}. Its value controls | |||
| 1000 | whether @code{read-file-name} starts by placing the name of the default | 989 | whether @code{read-file-name} starts by placing the name of the default |
| 1001 | directory in the minibuffer, plus the initial file name if any. If the | 990 | directory in the minibuffer, plus the initial file name if any. If the |
| 1002 | value of this variable is @code{nil}, then @code{read-file-name} does | 991 | value of this variable is @code{nil}, then @code{read-file-name} does |
| 1003 | not place any initial input in the minibuffer. In that case, the | 992 | not place any initial input in the minibuffer (unless you specify |
| 993 | initial input with the @var{initial} argument). In that case, the | ||
| 1004 | default directory is still used for completion of relative file names, | 994 | default directory is still used for completion of relative file names, |
| 1005 | but is not displayed. | 995 | but is not displayed. |
| 1006 | 996 | ||
| @@ -1085,7 +1075,7 @@ match for some possibility; @code{nil} otherwise. | |||
| 1085 | @end itemize | 1075 | @end itemize |
| 1086 | 1076 | ||
| 1087 | It would be consistent and clean for completion functions to allow | 1077 | It would be consistent and clean for completion functions to allow |
| 1088 | lambda expressions (lists tha are functions) as well as function | 1078 | lambda expressions (lists that are functions) as well as function |
| 1089 | symbols as @var{collection}, but this is impossible. Lists as | 1079 | symbols as @var{collection}, but this is impossible. Lists as |
| 1090 | completion tables are already assigned another meaning---as alists. It | 1080 | completion tables are already assigned another meaning---as alists. It |
| 1091 | would be unreliable to fail to handle an alist normally because it is | 1081 | would be unreliable to fail to handle an alist normally because it is |
| @@ -1357,6 +1347,16 @@ This command replaces the minibuffer contents with the value of the next | |||
| 1357 | expression). | 1347 | expression). |
| 1358 | @end deffn | 1348 | @end deffn |
| 1359 | 1349 | ||
| 1350 | @defun minibuffer-prompt | ||
| 1351 | This function returns the prompt string of the currently active | ||
| 1352 | minibuffer. If no minibuffer is active, it returns @code{nil}. | ||
| 1353 | @end defun | ||
| 1354 | |||
| 1355 | @defun minibuffer-prompt-width | ||
| 1356 | This function returns the display width of the prompt string of the | ||
| 1357 | currently active minibuffer. If no minibuffer is active, it returns 0. | ||
| 1358 | @end defun | ||
| 1359 | |||
| 1360 | @defvar minibuffer-setup-hook | 1360 | @defvar minibuffer-setup-hook |
| 1361 | This is a normal hook that is run whenever the minibuffer is entered. | 1361 | This is a normal hook that is run whenever the minibuffer is entered. |
| 1362 | @xref{Hooks}. | 1362 | @xref{Hooks}. |
| @@ -1415,16 +1415,6 @@ minibuffer, a nonnegative integer. If no minibuffers are active, it | |||
| 1415 | returns zero. | 1415 | returns zero. |
| 1416 | @end defun | 1416 | @end defun |
| 1417 | 1417 | ||
| 1418 | @defun minibuffer-prompt | ||
| 1419 | This function returns the prompt string of the currently active | ||
| 1420 | minibuffer. If no minibuffer is active, it returns @code{nil}. | ||
| 1421 | @end defun | ||
| 1422 | |||
| 1423 | @defun minibuffer-prompt-width | ||
| 1424 | This function returns the display width of the prompt string of the | ||
| 1425 | currently active minibuffer. If no minibuffer is active, it returns 0. | ||
| 1426 | @end defun | ||
| 1427 | |||
| 1428 | @defopt enable-recursive-minibuffers | 1418 | @defopt enable-recursive-minibuffers |
| 1429 | If this variable is non-@code{nil}, you can invoke commands (such as | 1419 | If this variable is non-@code{nil}, you can invoke commands (such as |
| 1430 | @code{find-file}) that use minibuffers even while in the minibuffer | 1420 | @code{find-file}) that use minibuffers even while in the minibuffer |
| @@ -1442,5 +1432,5 @@ window is selected. | |||
| 1442 | If a command name has a property @code{enable-recursive-minibuffers} | 1432 | If a command name has a property @code{enable-recursive-minibuffers} |
| 1443 | that is non-@code{nil}, then the command can use the minibuffer to read | 1433 | that is non-@code{nil}, then the command can use the minibuffer to read |
| 1444 | arguments even if it is invoked from the minibuffer. The minibuffer | 1434 | arguments even if it is invoked from the minibuffer. The minibuffer |
| 1445 | command @code{next-matching-history-element} (normally bound to | 1435 | command @code{next-matching-history-element} (normally @kbd{M-s} in the |
| 1446 | @kbd{M-s} in the minibuffer) uses this feature. | 1436 | minibuffer) uses this feature. |
diff --git a/lispref/modes.texi b/lispref/modes.texi index 1927797080b..77cb11302a0 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -395,6 +395,8 @@ rest of @code{lisp-mode-variables}. | |||
| 395 | @smallexample | 395 | @smallexample |
| 396 | @group | 396 | @group |
| 397 | (make-local-variable 'paragraph-start) | 397 | (make-local-variable 'paragraph-start) |
| 398 | ;; @r{Having @samp{^} is not clean, but @code{page-delimiter}} | ||
| 399 | ;; @r{has them too, and removing those is a pain.} | ||
| 398 | (setq paragraph-start (concat "^$\\|" page-delimiter)) | 400 | (setq paragraph-start (concat "^$\\|" page-delimiter)) |
| 399 | @dots{} | 401 | @dots{} |
| 400 | @end group | 402 | @end group |
| @@ -486,25 +488,25 @@ state of Emacs.) | |||
| 486 | @end deffn | 488 | @end deffn |
| 487 | 489 | ||
| 488 | @deffn Command normal-mode &optional find-file | 490 | @deffn Command normal-mode &optional find-file |
| 489 | This function establishes the proper major mode and local variable | 491 | This function establishes the proper major mode and local variable |
| 490 | bindings for the current buffer. First it calls @code{set-auto-mode}, | 492 | bindings for the current buffer. First it calls @code{set-auto-mode}, |
| 491 | then it runs @code{hack-local-variables} to parse, and bind or | 493 | then it runs @code{hack-local-variables} to parse, and bind or |
| 492 | evaluate as appropriate, any local variables. | 494 | evaluate as appropriate, any local variables. |
| 493 | 495 | ||
| 494 | If the @var{find-file} argument to @code{normal-mode} is | 496 | If the @var{find-file} argument to @code{normal-mode} is |
| 495 | non-@code{nil}, @code{normal-mode} assumes that the @code{find-file} | 497 | non-@code{nil}, @code{normal-mode} assumes that the @code{find-file} |
| 496 | function is calling it. In this case, it may process a local variables | 498 | function is calling it. In this case, it may process a local variables |
| 497 | list at the end of the file. The variable @code{enable-local-variables} | 499 | list at the end of the file and in the @samp{-*-} line. The variable |
| 498 | controls whether to do so. | 500 | @code{enable-local-variables} controls whether to do so. |
| 499 | 501 | ||
| 500 | If you run @code{normal-mode} interactively, the argument | 502 | If you run @code{normal-mode} interactively, the argument |
| 501 | @var{find-file} is normally @code{nil}. In this case, | 503 | @var{find-file} is normally @code{nil}. In this case, |
| 502 | @code{normal-mode} unconditionally processes any local variables list. | 504 | @code{normal-mode} unconditionally processes any local variables list. |
| 503 | @xref{File variables, , Local Variables in Files, emacs, The GNU Emacs | 505 | @xref{File variables, , Local Variables in Files, emacs, The GNU Emacs |
| 504 | Manual}, for the syntax of the local variables section of a file. | 506 | Manual}, for the syntax of the local variables section of a file. |
| 505 | 507 | ||
| 506 | @cindex file mode specification error | 508 | @cindex file mode specification error |
| 507 | @code{normal-mode} uses @code{condition-case} around the call to the | 509 | @code{normal-mode} uses @code{condition-case} around the call to the |
| 508 | major mode function, so errors are caught and reported as a @samp{File | 510 | major mode function, so errors are caught and reported as a @samp{File |
| 509 | mode specification error}, followed by the original error message. | 511 | mode specification error}, followed by the original error message. |
| 510 | @end deffn | 512 | @end deffn |
| @@ -516,6 +518,15 @@ lists unconditionally; @code{nil} means ignore them; anything else means | |||
| 516 | ask the user what to do for each file. The default value is @code{t}. | 518 | ask the user what to do for each file. The default value is @code{t}. |
| 517 | @end defopt | 519 | @end defopt |
| 518 | 520 | ||
| 521 | @defvar ignored-local-variables | ||
| 522 | This variable holds a list of variables that should not be | ||
| 523 | set by a local variables list. Any value specified | ||
| 524 | for one of these variables is ignored. | ||
| 525 | @end defvar | ||
| 526 | |||
| 527 | In addition to this list, any variable whose name has a non-@code{nil} | ||
| 528 | @code{risky-local-variable} property is also ignored. | ||
| 529 | |||
| 519 | @defopt enable-local-eval | 530 | @defopt enable-local-eval |
| 520 | This variable controls processing of @samp{Eval:} in local variables | 531 | This variable controls processing of @samp{Eval:} in local variables |
| 521 | lists in files being visited. A value of @code{t} means process them | 532 | lists in files being visited. A value of @code{t} means process them |
| @@ -553,8 +564,8 @@ This function sets the major mode of @var{buffer} to the value of | |||
| 553 | the current buffer's major mode (if that is suitable). | 564 | the current buffer's major mode (if that is suitable). |
| 554 | 565 | ||
| 555 | The low-level primitives for creating buffers do not use this function, | 566 | The low-level primitives for creating buffers do not use this function, |
| 556 | but medium-level commands such as @code{switch-to-buffer} should use it | 567 | but medium-level commands such as @code{switch-to-buffer} and |
| 557 | whenever they create buffers. | 568 | @code{find-file-noselect} use it whenever they create buffers. |
| 558 | @end defun | 569 | @end defun |
| 559 | 570 | ||
| 560 | @defvar initial-major-mode | 571 | @defvar initial-major-mode |
| @@ -757,7 +768,7 @@ minor modes in effect. | |||
| 757 | 768 | ||
| 758 | Often the biggest problem in implementing a minor mode is finding a | 769 | Often the biggest problem in implementing a minor mode is finding a |
| 759 | way to insert the necessary hook into the rest of Emacs. Minor mode | 770 | way to insert the necessary hook into the rest of Emacs. Minor mode |
| 760 | keymaps make this easier in Emacs 19 than it used to be. | 771 | keymaps make this easier than it used to be. |
| 761 | 772 | ||
| 762 | @menu | 773 | @menu |
| 763 | * Minor Mode Conventions:: Tips for writing a minor mode. | 774 | * Minor Mode Conventions:: Tips for writing a minor mode. |
| @@ -805,15 +816,15 @@ a positive integer, a symbol other than @code{nil} or @code{-}, or a | |||
| 805 | list whose @sc{car} is such an integer or symbol; it should turn the | 816 | list whose @sc{car} is such an integer or symbol; it should turn the |
| 806 | mode off otherwise. | 817 | mode off otherwise. |
| 807 | 818 | ||
| 808 | Here is an example taken from the definition of @code{overwrite-mode}. | 819 | Here is an example taken from the definition of @code{transient-mark-mode}. |
| 809 | It shows the use of @code{overwrite-mode} as a variable that enables or | 820 | It shows the use of @code{transient-mark-mode} as a variable that enables or |
| 810 | disables the mode's behavior, and also shows the proper way to toggle, | 821 | disables the mode's behavior, and also shows the proper way to toggle, |
| 811 | enable or disable the minor mode based on the raw prefix argument value. | 822 | enable or disable the minor mode based on the raw prefix argument value. |
| 812 | 823 | ||
| 813 | @smallexample | 824 | @smallexample |
| 814 | @group | 825 | @group |
| 815 | (setq overwrite-mode | 826 | (setq transient-mark-mode |
| 816 | (if (null arg) (not overwrite-mode) | 827 | (if (null arg) (not transient-mark-mode) |
| 817 | (> (prefix-numeric-value arg) 0))) | 828 | (> (prefix-numeric-value arg) 0))) |
| 818 | @end group | 829 | @end group |
| 819 | @end smallexample | 830 | @end smallexample |
| @@ -847,10 +858,9 @@ check for an existing element, to avoid duplication. For example: | |||
| 847 | @node Keymaps and Minor Modes | 858 | @node Keymaps and Minor Modes |
| 848 | @subsection Keymaps and Minor Modes | 859 | @subsection Keymaps and Minor Modes |
| 849 | 860 | ||
| 850 | As of Emacs version 19, each minor mode can have its own keymap, which is | 861 | Each minor mode can have its own keymap, which is active when the mode |
| 851 | active when the mode is enabled. @xref{Active Keymaps}. To set up a | 862 | is enabled. To set up a keymap for a minor mode, add an element to the |
| 852 | keymap for a minor mode, add an element to the alist | 863 | alist @code{minor-mode-map-alist}. @xref{Active Keymaps}. |
| 853 | @code{minor-mode-map-alist}. | ||
| 854 | 864 | ||
| 855 | @cindex @code{self-insert-command}, minor modes | 865 | @cindex @code{self-insert-command}, minor modes |
| 856 | One use of minor mode keymaps is to modify the behavior of certain | 866 | One use of minor mode keymaps is to modify the behavior of certain |
| @@ -861,34 +871,6 @@ special cases (designed for abbrevs and Auto Fill mode). (Do not try | |||
| 861 | substituting your own definition of @code{self-insert-command} for the | 871 | substituting your own definition of @code{self-insert-command} for the |
| 862 | standard one. The editor command loop handles this function specially.) | 872 | standard one. The editor command loop handles this function specially.) |
| 863 | 873 | ||
| 864 | @defvar minor-mode-map-alist | ||
| 865 | This variable is an alist of elements that look like this: | ||
| 866 | |||
| 867 | @example | ||
| 868 | (@var{variable} . @var{keymap}) | ||
| 869 | @end example | ||
| 870 | |||
| 871 | @noindent | ||
| 872 | where @var{variable} is the variable that indicates whether the minor | ||
| 873 | mode is enabled, and @var{keymap} is the keymap. The keymap | ||
| 874 | @var{keymap} is active whenever @var{variable} has a non-@code{nil} | ||
| 875 | value. | ||
| 876 | |||
| 877 | Note that elements of @code{minor-mode-map-alist} do not have the same | ||
| 878 | structure as elements of @code{minor-mode-alist}. The map must be the | ||
| 879 | @sc{cdr} of the element; a list with the map as the second element will | ||
| 880 | not do. | ||
| 881 | |||
| 882 | What's more, the keymap itself must appear in the @sc{cdr}. It does not | ||
| 883 | work to store a variable in the @sc{cdr} and make the map the value of | ||
| 884 | that variable. | ||
| 885 | |||
| 886 | When more than one minor mode keymap is active, their order of priority | ||
| 887 | is the order of @code{minor-mode-map-alist}. But you should design | ||
| 888 | minor modes so that they don't interfere with each other. If you do | ||
| 889 | this properly, the order will not matter. | ||
| 890 | @end defvar | ||
| 891 | |||
| 892 | @node Mode Line Format | 874 | @node Mode Line Format |
| 893 | @section Mode Line Format | 875 | @section Mode Line Format |
| 894 | @cindex mode line | 876 | @cindex mode line |
| @@ -906,8 +888,8 @@ minor modes. | |||
| 906 | 888 | ||
| 907 | @code{mode-line-format} is a buffer-local variable that holds a | 889 | @code{mode-line-format} is a buffer-local variable that holds a |
| 908 | template used to display the mode line of the current buffer. All | 890 | template used to display the mode line of the current buffer. All |
| 909 | windows for the same buffer use the same @code{mode-line-format} and the | 891 | windows for the same buffer use the same @code{mode-line-format} and |
| 910 | mode lines will appear the same (except for scrolling percentages and | 892 | their mode lines appear the same (except for scrolling percentages and |
| 911 | line numbers). | 893 | line numbers). |
| 912 | 894 | ||
| 913 | The mode line of a window is normally updated whenever a different | 895 | The mode line of a window is normally updated whenever a different |
| @@ -940,7 +922,7 @@ strings, symbols, and numbers kept in the buffer-local variable | |||
| 940 | @code{mode-line-format}. The data structure is called a @dfn{mode line | 922 | @code{mode-line-format}. The data structure is called a @dfn{mode line |
| 941 | construct}, and it is built in recursive fashion out of simpler mode line | 923 | construct}, and it is built in recursive fashion out of simpler mode line |
| 942 | constructs. The same data structure is used for constructing | 924 | constructs. The same data structure is used for constructing |
| 943 | frame titles (pxref{Frame Titles}). | 925 | frame titles (@pxref{Frame Titles}). |
| 944 | 926 | ||
| 945 | @defvar mode-line-format | 927 | @defvar mode-line-format |
| 946 | The value of this variable is a mode line construct with overall | 928 | The value of this variable is a mode line construct with overall |
| @@ -967,7 +949,7 @@ value is a list, each element may be a list, a symbol, or a string. | |||
| 967 | @cindex percent symbol in mode line | 949 | @cindex percent symbol in mode line |
| 968 | @item @var{string} | 950 | @item @var{string} |
| 969 | A string as a mode line construct is displayed verbatim in the mode line | 951 | A string as a mode line construct is displayed verbatim in the mode line |
| 970 | except for @dfn{@code{%}-constructs}. Decimal digits after the @code{%} | 952 | except for @dfn{@code{%}-constructs}. Decimal digits after the @samp{%} |
| 971 | specify the field width for space filling on the right (i.e., the data | 953 | specify the field width for space filling on the right (i.e., the data |
| 972 | is left justified). @xref{%-Constructs}. | 954 | is left justified). @xref{%-Constructs}. |
| 973 | 955 | ||
| @@ -1010,8 +992,8 @@ the top of the window is to use a list like this: @code{(-3 "%p")}. | |||
| 1010 | use the same variables that appear in the default value (@pxref{Mode | 992 | use the same variables that appear in the default value (@pxref{Mode |
| 1011 | Line Variables}), rather than duplicating their contents or displaying | 993 | Line Variables}), rather than duplicating their contents or displaying |
| 1012 | the information in another fashion. This way, customizations made by | 994 | the information in another fashion. This way, customizations made by |
| 1013 | the user, by libraries (such as @code{display-time}) and by major modes | 995 | the user or by Lisp programs (such as @code{display-time} and major |
| 1014 | via changes to those variables remain effective. | 996 | modes) via changes to those variables remain effective. |
| 1015 | 997 | ||
| 1016 | @cindex Shell mode @code{mode-line-format} | 998 | @cindex Shell mode @code{mode-line-format} |
| 1017 | Here is an example of a @code{mode-line-format} that might be | 999 | Here is an example of a @code{mode-line-format} that might be |
| @@ -1037,7 +1019,7 @@ directory. | |||
| 1037 | "%n" | 1019 | "%n" |
| 1038 | ")%]----" | 1020 | ")%]----" |
| 1039 | @group | 1021 | @group |
| 1040 | (line-number-mode "L%l--") | 1022 | '(line-number-mode "L%l--") |
| 1041 | '(-3 . "%p") | 1023 | '(-3 . "%p") |
| 1042 | "-%-")) | 1024 | "-%-")) |
| 1043 | @end group | 1025 | @end group |
| @@ -1056,19 +1038,22 @@ other variables could have the same effects on the mode line if | |||
| 1056 | This variable holds the value of the mode-line construct that displays | 1038 | This variable holds the value of the mode-line construct that displays |
| 1057 | whether the current buffer is modified. | 1039 | whether the current buffer is modified. |
| 1058 | 1040 | ||
| 1059 | The default value of @code{mode-line-modified} is | 1041 | The default value of @code{mode-line-modified} is @code{("--%1*%1+-")}. |
| 1060 | @code{("--%1*%1*-")}. This means that the mode line displays | 1042 | This means that the mode line displays @samp{--**-} if the buffer is |
| 1061 | @samp{--**-} if the buffer is modified, @samp{-----} if the buffer is | 1043 | modified, @samp{-----} if the buffer is not modified, @samp{--%%-} if |
| 1062 | not modified, and @samp{--%%-} if the buffer is read only. | 1044 | the buffer is read only, and @samp{--%*--} if the buffer is read only |
| 1045 | and modified. | ||
| 1063 | 1046 | ||
| 1064 | Changing this variable does not force an update of the mode line. | 1047 | Changing this variable does not force an update of the mode line. |
| 1065 | @end defvar | 1048 | @end defvar |
| 1066 | 1049 | ||
| 1067 | @defvar mode-line-buffer-identification | 1050 | @defvar mode-line-buffer-identification |
| 1068 | This variable identifies the buffer being displayed in the window. Its | 1051 | This variable identifies the buffer being displayed in the window. Its |
| 1069 | default value is @code{("Emacs: %17b")}, which means that it displays | 1052 | default value is @code{("%F: %17b")}, which means that it usually |
| 1070 | @samp{Emacs:} followed by seventeen characters of the buffer name. You | 1053 | displays @samp{Emacs:} followed by seventeen characters of the buffer |
| 1071 | may want to change this in modes such as Rmail that do not behave like a | 1054 | name. (In a terminal frame, it displays the frame name instead of |
| 1055 | @samp{Emacs}; this has the effect of showing the frame number.) You may | ||
| 1056 | want to change this in modes such as Rmail that do not behave like a | ||
| 1072 | ``normal'' Emacs. | 1057 | ``normal'' Emacs. |
| 1073 | @end defvar | 1058 | @end defvar |
| 1074 | 1059 | ||
| @@ -1111,18 +1096,16 @@ The default value of @code{minor-mode-alist} is: | |||
| 1111 | @example | 1096 | @example |
| 1112 | @group | 1097 | @group |
| 1113 | minor-mode-alist | 1098 | minor-mode-alist |
| 1114 | @result{} ((abbrev-mode " Abbrev") | 1099 | @result{} ((vc-mode vc-mode) |
| 1115 | (overwrite-mode " Ovwrt") | 1100 | (abbrev-mode " Abbrev") |
| 1101 | (overwrite-mode overwrite-mode) | ||
| 1116 | (auto-fill-function " Fill") | 1102 | (auto-fill-function " Fill") |
| 1117 | (defining-kbd-macro " Def")) | 1103 | (defining-kbd-macro " Def") |
| 1104 | (isearch-mode isearch-mode)) | ||
| 1118 | @end group | 1105 | @end group |
| 1119 | @end example | 1106 | @end example |
| 1120 | 1107 | ||
| 1121 | @noindent | 1108 | @code{minor-mode-alist} is not buffer-local. The variables mentioned |
| 1122 | (In earlier Emacs versions, @code{auto-fill-function} was called | ||
| 1123 | @code{auto-fill-hook}.) | ||
| 1124 | |||
| 1125 | @code{minor-mode-alist} is not buffer-local. The variables mentioned | ||
| 1126 | in the alist should be buffer-local if the minor mode can be enabled | 1109 | in the alist should be buffer-local if the minor mode can be enabled |
| 1127 | separately in each buffer. | 1110 | separately in each buffer. |
| 1128 | @end defvar | 1111 | @end defvar |
| @@ -1155,10 +1138,11 @@ The default value of @code{default-mode-line-format} is: | |||
| 1155 | mode-name | 1138 | mode-name |
| 1156 | @end group | 1139 | @end group |
| 1157 | @group | 1140 | @group |
| 1141 | mode-line-process | ||
| 1158 | minor-mode-alist | 1142 | minor-mode-alist |
| 1159 | "%n" | 1143 | "%n" |
| 1160 | mode-line-process | ||
| 1161 | ")%]----" | 1144 | ")%]----" |
| 1145 | (line-number-mode "L%l--") | ||
| 1162 | (-3 . "%p") | 1146 | (-3 . "%p") |
| 1163 | "-%-") | 1147 | "-%-") |
| 1164 | @end group | 1148 | @end group |
| @@ -1293,15 +1277,15 @@ the functions are called with arguments, or their values are meaningful. | |||
| 1293 | The name shows you that the hook is abnormal and that you should look at | 1277 | The name shows you that the hook is abnormal and that you should look at |
| 1294 | its documentation string to see how to use it properly. | 1278 | its documentation string to see how to use it properly. |
| 1295 | 1279 | ||
| 1296 | Most major modes run hooks as the last step of initialization. This | 1280 | Major mode functions are supposed to run a hook called the @dfn{mode |
| 1297 | makes it easy for a user to customize the behavior of the mode, by | 1281 | hook} as the last step of initialization. This makes it easy for a user |
| 1298 | overriding the local variable assignments already made by the mode. But | 1282 | to customize the behavior of the mode, by overriding the local variable |
| 1299 | hooks are used in other contexts too. For example, the hook | 1283 | assignments already made by the mode. But hooks are used in other |
| 1300 | @code{suspend-hook} runs just before Emacs suspends itself | 1284 | contexts too. For example, the hook @code{suspend-hook} runs just |
| 1301 | (@pxref{Suspending Emacs}). | 1285 | before Emacs suspends itself (@pxref{Suspending Emacs}). |
| 1302 | 1286 | ||
| 1303 | Here's an expression you can put in your @file{.emacs} file to turn on | 1287 | Here's an expression that uses a mode hook to turn on Auto Fill mode |
| 1304 | Auto Fill mode when in Lisp Interaction mode: | 1288 | when in Lisp Interaction mode: |
| 1305 | 1289 | ||
| 1306 | @example | 1290 | @example |
| 1307 | (add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill) | 1291 | (add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill) |
| @@ -1330,39 +1314,9 @@ expression. | |||
| 1330 | @end group | 1314 | @end group |
| 1331 | @end example | 1315 | @end example |
| 1332 | 1316 | ||
| 1333 | Finally, here is an example of how to use the Text mode hook to | ||
| 1334 | provide a customized mode line for buffers in Text mode, displaying the | ||
| 1335 | default directory in addition to the standard components of the | ||
| 1336 | mode line. (This may cause the mode line to run out of space if you | ||
| 1337 | have very long file names or display the time and load.) | ||
| 1338 | |||
| 1339 | @example | ||
| 1340 | @group | ||
| 1341 | (add-hook 'text-mode-hook | ||
| 1342 | (function (lambda () | ||
| 1343 | (setq mode-line-format | ||
| 1344 | @end group | ||
| 1345 | '(mode-line-modified | ||
| 1346 | "Emacs: %14b" | ||
| 1347 | " " | ||
| 1348 | default-directory | ||
| 1349 | " " | ||
| 1350 | global-mode-string | ||
| 1351 | "%[(" | ||
| 1352 | mode-name | ||
| 1353 | minor-mode-alist | ||
| 1354 | @group | ||
| 1355 | "%n" | ||
| 1356 | mode-line-process | ||
| 1357 | ") %]---" | ||
| 1358 | (-3 . "%p") | ||
| 1359 | "-%-"))))) | ||
| 1360 | @end group | ||
| 1361 | @end example | ||
| 1362 | |||
| 1363 | At the appropriate time, Emacs uses the @code{run-hooks} function to | 1317 | At the appropriate time, Emacs uses the @code{run-hooks} function to |
| 1364 | run particular hooks. This function calls the hook functions you have | 1318 | run particular hooks. This function calls the hook functions that have |
| 1365 | added with @code{add-hooks}. | 1319 | been added with @code{add-hook}. |
| 1366 | 1320 | ||
| 1367 | @defun run-hooks &rest hookvar | 1321 | @defun run-hooks &rest hookvar |
| 1368 | This function takes one or more hook variable names as arguments, and | 1322 | This function takes one or more hook variable names as arguments, and |
| @@ -1376,7 +1330,7 @@ lambda expression or a symbol with a function definition), it is | |||
| 1376 | called. If it is a list, the elements are called, in order. | 1330 | called. If it is a list, the elements are called, in order. |
| 1377 | The hook functions are called with no arguments. | 1331 | The hook functions are called with no arguments. |
| 1378 | 1332 | ||
| 1379 | For example, here's how @code{emacs-lisp-hooks} runs its mode hook: | 1333 | For example, here's how @code{emacs-lisp-mode} runs its mode hook: |
| 1380 | 1334 | ||
| 1381 | @example | 1335 | @example |
| 1382 | (run-hooks 'emacs-lisp-mode-hook) | 1336 | (run-hooks 'emacs-lisp-mode-hook) |
diff --git a/lispref/numbers.texi b/lispref/numbers.texi index 0c331545e1d..e7db42f727b 100644 --- a/lispref/numbers.texi +++ b/lispref/numbers.texi | |||
| @@ -249,9 +249,10 @@ Here's a function to do this: | |||
| 249 | @example | 249 | @example |
| 250 | (defvar fuzz-factor 1.0e-6) | 250 | (defvar fuzz-factor 1.0e-6) |
| 251 | (defun approx-equal (x y) | 251 | (defun approx-equal (x y) |
| 252 | (< (/ (abs (- x y)) | 252 | (or (and (= x 0) (= y 0)) |
| 253 | (max (abs x) (abs y))) | 253 | (< (/ (abs (- x y)) |
| 254 | fuzz-factor)) | 254 | (max (abs x) (abs y))) |
| 255 | fuzz-factor))) | ||
| 255 | @end example | 256 | @end example |
| 256 | 257 | ||
| 257 | @cindex CL note---integers vrs @code{eq} | 258 | @cindex CL note---integers vrs @code{eq} |
| @@ -356,7 +357,9 @@ This returns @var{number}, converted to an integer by rounding upward | |||
| 356 | 357 | ||
| 357 | @defun round number | 358 | @defun round number |
| 358 | This returns @var{number}, converted to an integer by rounding towards the | 359 | This returns @var{number}, converted to an integer by rounding towards the |
| 359 | nearest integer. | 360 | nearest integer. Rounding a value equidistant between two integers |
| 361 | may choose the integer closer to zero, or it may prefer an even integer, | ||
| 362 | depending on your machine. | ||
| 360 | @end defun | 363 | @end defun |
| 361 | 364 | ||
| 362 | @node Arithmetic Operations | 365 | @node Arithmetic Operations |
| @@ -386,8 +389,8 @@ For example, | |||
| 386 | @result{} 5 | 389 | @result{} 5 |
| 387 | @end example | 390 | @end example |
| 388 | 391 | ||
| 389 | This function is not analogous to the C operator @code{++}---it does | 392 | This function is not analogous to the C operator @code{++}---it does not |
| 390 | not increment a variable. It just computes a sum. Thus, | 393 | increment a variable. It just computes a sum. Thus, if we continue, |
| 391 | 394 | ||
| 392 | @example | 395 | @example |
| 393 | foo | 396 | foo |
| @@ -413,7 +416,7 @@ This returns the absolute value of @var{number}. | |||
| 413 | 416 | ||
| 414 | @defun + &rest numbers-or-markers | 417 | @defun + &rest numbers-or-markers |
| 415 | This function adds its arguments together. When given no arguments, | 418 | This function adds its arguments together. When given no arguments, |
| 416 | @code{+} returns 0. It does not check for overflow. | 419 | @code{+} returns 0. |
| 417 | 420 | ||
| 418 | @example | 421 | @example |
| 419 | (+) | 422 | (+) |
| @@ -430,8 +433,7 @@ The @code{-} function serves two purposes: negation and subtraction. | |||
| 430 | When @code{-} has a single argument, the value is the negative of the | 433 | When @code{-} has a single argument, the value is the negative of the |
| 431 | argument. When there are multiple arguments, @code{-} subtracts each of | 434 | argument. When there are multiple arguments, @code{-} subtracts each of |
| 432 | the @var{other-numbers-or-markers} from @var{number-or-marker}, | 435 | the @var{other-numbers-or-markers} from @var{number-or-marker}, |
| 433 | cumulatively. If there are no arguments, the result is 0. This | 436 | cumulatively. If there are no arguments, the result is 0. |
| 434 | function does not check for overflow. | ||
| 435 | 437 | ||
| 436 | @example | 438 | @example |
| 437 | (- 10 1 2 3 4) | 439 | (- 10 1 2 3 4) |
| @@ -445,8 +447,7 @@ function does not check for overflow. | |||
| 445 | 447 | ||
| 446 | @defun * &rest numbers-or-markers | 448 | @defun * &rest numbers-or-markers |
| 447 | This function multiplies its arguments together, and returns the | 449 | This function multiplies its arguments together, and returns the |
| 448 | product. When given no arguments, @code{*} returns 1. It does | 450 | product. When given no arguments, @code{*} returns 1. |
| 449 | not check for overflow. | ||
| 450 | 451 | ||
| 451 | @example | 452 | @example |
| 452 | (*) | 453 | (*) |
| @@ -562,8 +563,9 @@ For any two numbers @var{dividend} and @var{divisor}, | |||
| 562 | @end example | 563 | @end example |
| 563 | 564 | ||
| 564 | @noindent | 565 | @noindent |
| 565 | always equals @var{dividend}, subject to rounding error if | 566 | always equals @var{dividend}, subject to rounding error if either |
| 566 | either argument is floating point. | 567 | argument is floating point. For @code{floor}, see @ref{Numeric |
| 568 | Conversions}. | ||
| 567 | @end defun | 569 | @end defun |
| 568 | 570 | ||
| 569 | @node Rounding Operations | 571 | @node Rounding Operations |
| @@ -640,36 +642,7 @@ As the examples illustrate, shifting the pattern of bits one place to | |||
| 640 | the left produces a number that is twice the value of the previous | 642 | the left produces a number that is twice the value of the previous |
| 641 | number. | 643 | number. |
| 642 | 644 | ||
| 643 | The function @code{lsh}, like all Emacs Lisp arithmetic functions, does | 645 | Shifting a pattern of bits two places to the left produces results |
| 644 | not check for overflow, so shifting left can discard significant bits | ||
| 645 | and change the sign of the number. For example, left shifting | ||
| 646 | 134,217,727 produces @minus{}2 on a 28-bit machine: | ||
| 647 | |||
| 648 | @example | ||
| 649 | (lsh 134217727 1) ; @r{left shift} | ||
| 650 | @result{} -2 | ||
| 651 | @end example | ||
| 652 | |||
| 653 | In binary, in the 28-bit implementation, the argument looks like this: | ||
| 654 | |||
| 655 | @example | ||
| 656 | @group | ||
| 657 | ;; @r{Decimal 134.217,727} | ||
| 658 | 0111 1111 1111 1111 1111 1111 1111 | ||
| 659 | @end group | ||
| 660 | @end example | ||
| 661 | |||
| 662 | @noindent | ||
| 663 | which becomes the following when left shifted: | ||
| 664 | |||
| 665 | @example | ||
| 666 | @group | ||
| 667 | ;; @r{Decimal @minus{}2} | ||
| 668 | 1111 1111 1111 1111 1111 1111 1110 | ||
| 669 | @end group | ||
| 670 | @end example | ||
| 671 | |||
| 672 | Shifting the pattern of bits two places to the left produces results | ||
| 673 | like this (with 8-bit binary numbers): | 646 | like this (with 8-bit binary numbers): |
| 674 | 647 | ||
| 675 | @example | 648 | @example |
| @@ -681,8 +654,7 @@ like this (with 8-bit binary numbers): | |||
| 681 | @end group | 654 | @end group |
| 682 | @end example | 655 | @end example |
| 683 | 656 | ||
| 684 | On the other hand, shifting the pattern of bits one place to the right | 657 | On the other hand, shifting one place to the right looks like this: |
| 685 | looks like this: | ||
| 686 | 658 | ||
| 687 | @example | 659 | @example |
| 688 | @group | 660 | @group |
| @@ -701,8 +673,37 @@ looks like this: | |||
| 701 | @end example | 673 | @end example |
| 702 | 674 | ||
| 703 | @noindent | 675 | @noindent |
| 704 | As the example illustrates, shifting the pattern of bits one place to | 676 | As the example illustrates, shifting one place to the right divides the |
| 705 | the right divides the value of the binary number by two, rounding downward. | 677 | value of a positive integer by two, rounding downward. |
| 678 | |||
| 679 | The function @code{lsh}, like all Emacs Lisp arithmetic functions, does | ||
| 680 | not check for overflow, so shifting left can discard significant bits | ||
| 681 | and change the sign of the number. For example, left shifting | ||
| 682 | 134,217,727 produces @minus{}2 on a 28-bit machine: | ||
| 683 | |||
| 684 | @example | ||
| 685 | (lsh 134217727 1) ; @r{left shift} | ||
| 686 | @result{} -2 | ||
| 687 | @end example | ||
| 688 | |||
| 689 | In binary, in the 28-bit implementation, the argument looks like this: | ||
| 690 | |||
| 691 | @example | ||
| 692 | @group | ||
| 693 | ;; @r{Decimal 134.217,727} | ||
| 694 | 0111 1111 1111 1111 1111 1111 1111 | ||
| 695 | @end group | ||
| 696 | @end example | ||
| 697 | |||
| 698 | @noindent | ||
| 699 | which becomes the following when left shifted: | ||
| 700 | |||
| 701 | @example | ||
| 702 | @group | ||
| 703 | ;; @r{Decimal @minus{}2} | ||
| 704 | 1111 1111 1111 1111 1111 1111 1110 | ||
| 705 | @end group | ||
| 706 | @end example | ||
| 706 | @end defun | 707 | @end defun |
| 707 | 708 | ||
| 708 | @defun ash integer1 count | 709 | @defun ash integer1 count |
| @@ -713,8 +714,8 @@ is negative. | |||
| 713 | 714 | ||
| 714 | @code{ash} gives the same results as @code{lsh} except when | 715 | @code{ash} gives the same results as @code{lsh} except when |
| 715 | @var{integer1} and @var{count} are both negative. In that case, | 716 | @var{integer1} and @var{count} are both negative. In that case, |
| 716 | @code{ash} puts a one in the leftmost position, while @code{lsh} puts | 717 | @code{ash} puts ones in the empty bit positions on the left, while |
| 717 | a zero in the leftmost position. | 718 | @code{lsh} puts zeros in those bit positions. |
| 718 | 719 | ||
| 719 | Thus, with @code{ash}, shifting the pattern of bits one place to the right | 720 | Thus, with @code{ash}, shifting the pattern of bits one place to the right |
| 720 | looks like this: | 721 | looks like this: |
| @@ -1008,18 +1009,8 @@ Emacs's process @sc{id} number. | |||
| 1008 | This function returns a pseudo-random integer. Repeated calls return a | 1009 | This function returns a pseudo-random integer. Repeated calls return a |
| 1009 | series of pseudo-random integers. | 1010 | series of pseudo-random integers. |
| 1010 | 1011 | ||
| 1011 | If @var{limit} is @code{nil}, then the value may in principle be any | ||
| 1012 | integer. However, on machines where integers have more than 32 bits, | ||
| 1013 | the possible values may be limited to the interval | ||
| 1014 | @tex | ||
| 1015 | $[0,2^{32})$. | ||
| 1016 | @end tex | ||
| 1017 | @ifinfo | ||
| 1018 | [0,2**32). | ||
| 1019 | @end ifinfo | ||
| 1020 | |||
| 1021 | If @var{limit} is a positive integer, the value is chosen to be | 1012 | If @var{limit} is a positive integer, the value is chosen to be |
| 1022 | nonnegative and less than @var{limit} (only in Emacs 19). | 1013 | nonnegative and less than @var{limit}. |
| 1023 | 1014 | ||
| 1024 | If @var{limit} is @code{t}, it means to choose a new seed based on the | 1015 | If @var{limit} is @code{t}, it means to choose a new seed based on the |
| 1025 | current time of day and on Emacs's process @sc{id} number. | 1016 | current time of day and on Emacs's process @sc{id} number. |
diff --git a/lispref/objects.texi b/lispref/objects.texi index fc06466112c..4952f07514e 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi | |||
| @@ -115,6 +115,11 @@ the end of line. The Lisp reader discards comments; they do not become | |||
| 115 | part of the Lisp objects which represent the program within the Lisp | 115 | part of the Lisp objects which represent the program within the Lisp |
| 116 | system. | 116 | system. |
| 117 | 117 | ||
| 118 | The @samp{#@@@var{count}} construct, which skips the next @var{count} | ||
| 119 | characters, is useful for program-generated comments containing binary | ||
| 120 | data. The Emacs Lisp byte compiler uses this in its output files | ||
| 121 | (@pxref{Byte Compilation}). It isn't meant for source files, however. | ||
| 122 | |||
| 118 | @xref{Comment Tips}, for conventions for formatting comments. | 123 | @xref{Comment Tips}, for conventions for formatting comments. |
| 119 | 124 | ||
| 120 | @node Programming Types | 125 | @node Programming Types |
| @@ -305,17 +310,30 @@ equivalent to @samp{?\^I} and to @samp{?\^i}: | |||
| 305 | characters that exist in @sc{ASCII}, but for keyboard input purposes, | 310 | characters that exist in @sc{ASCII}, but for keyboard input purposes, |
| 306 | you can turn any character into a control character with @samp{C-}. The | 311 | you can turn any character into a control character with @samp{C-}. The |
| 307 | character codes for these non-@sc{ASCII} control characters include the | 312 | character codes for these non-@sc{ASCII} control characters include the |
| 308 | 2**22 bit as well as the code for the corresponding non-control | 313 | @iftex |
| 314 | $2^{26}$ | ||
| 315 | @end iftex | ||
| 316 | @ifinfo | ||
| 317 | 2**26 | ||
| 318 | @end ifinfo | ||
| 319 | bit as well as the code for the corresponding non-control | ||
| 309 | character. Ordinary terminals have no way of generating non-@sc{ASCII} | 320 | character. Ordinary terminals have no way of generating non-@sc{ASCII} |
| 310 | control characters, but you can generate them straightforwardly using an | 321 | control characters, but you can generate them straightforwardly using an |
| 311 | X terminal. | 322 | X terminal. |
| 312 | 323 | ||
| 313 | You can think of the @key{DEL} character as @kbd{Control-?}: | 324 | For historical reasons, Emacs treats the @key{DEL} character as |
| 325 | the control equivalent of @kbd{?}: | ||
| 314 | 326 | ||
| 315 | @example | 327 | @example |
| 316 | ?\^? @result{} 127 ?\C-? @result{} 127 | 328 | ?\^? @result{} 127 ?\C-? @result{} 127 |
| 317 | @end example | 329 | @end example |
| 318 | 330 | ||
| 331 | @noindent | ||
| 332 | As a result, it is currently not possible to represent the character | ||
| 333 | @kbd{Control-?}, which is a meaningful input character under X. It is | ||
| 334 | not easy to change this as various Lisp files refer to @key{DEL} in this | ||
| 335 | way. | ||
| 336 | |||
| 319 | For representing control characters to be found in files or strings, | 337 | For representing control characters to be found in files or strings, |
| 320 | we recommend the @samp{^} syntax; for control characters in keyboard | 338 | we recommend the @samp{^} syntax; for control characters in keyboard |
| 321 | input, we prefer the @samp{C-} syntax. This does not affect the meaning | 339 | input, we prefer the @samp{C-} syntax. This does not affect the meaning |
| @@ -324,11 +342,24 @@ of the program, but may guide the understanding of people who read it. | |||
| 324 | @cindex meta characters | 342 | @cindex meta characters |
| 325 | A @dfn{meta character} is a character typed with the @key{META} | 343 | A @dfn{meta character} is a character typed with the @key{META} |
| 326 | modifier key. The integer that represents such a character has the | 344 | modifier key. The integer that represents such a character has the |
| 327 | 2**23 bit set (which on most machines makes it a negative number). We | 345 | @iftex |
| 346 | $2^{27}$ | ||
| 347 | @end iftex | ||
| 348 | @ifinfo | ||
| 349 | 2**27 | ||
| 350 | @end ifinfo | ||
| 351 | bit set (which on most machines makes it a negative number). We | ||
| 328 | use high bits for this and other modifiers to make possible a wide range | 352 | use high bits for this and other modifiers to make possible a wide range |
| 329 | of basic character codes. | 353 | of basic character codes. |
| 330 | 354 | ||
| 331 | In a string, the 2**7 bit indicates a meta character, so the meta | 355 | In a string, the |
| 356 | @iftex | ||
| 357 | $2^{7}$ | ||
| 358 | @end iftex | ||
| 359 | @ifinfo | ||
| 360 | 2**7 | ||
| 361 | @end ifinfo | ||
| 362 | bit indicates a meta character, so the meta | ||
| 332 | characters that can fit in a string have codes in the range from 128 to | 363 | characters that can fit in a string have codes in the range from 128 to |
| 333 | 255, and are the meta versions of the ordinary @sc{ASCII} characters. | 364 | 255, and are the meta versions of the ordinary @sc{ASCII} characters. |
| 334 | (In Emacs versions 18 and older, this convention was used for characters | 365 | (In Emacs versions 18 and older, this convention was used for characters |
| @@ -343,11 +374,17 @@ or as @samp{?\M-\101}. Likewise, you can write @kbd{C-M-b} as | |||
| 343 | 374 | ||
| 344 | The case of an ordinary letter is indicated by its character code as | 375 | The case of an ordinary letter is indicated by its character code as |
| 345 | part of @sc{ASCII}, but @sc{ASCII} has no way to represent whether a | 376 | part of @sc{ASCII}, but @sc{ASCII} has no way to represent whether a |
| 346 | control character is upper case or lower case. Emacs uses the 2**21 bit | 377 | control character is upper case or lower case. Emacs uses the |
| 347 | to indicate that the shift key was used for typing a control character. | 378 | @iftex |
| 348 | This distinction is possible only when you use X terminals or other | 379 | $2^{25}$ |
| 349 | special terminals; ordinary terminals do not indicate the distinction to | 380 | @end iftex |
| 350 | the computer in any way. | 381 | @ifinfo |
| 382 | 2**25 | ||
| 383 | @end ifinfo | ||
| 384 | bit to indicate that the shift key was used for typing a control | ||
| 385 | character. This distinction is possible only when you use X terminals | ||
| 386 | or other special terminals; ordinary terminals do not indicate the | ||
| 387 | distinction to the computer in any way. | ||
| 351 | 388 | ||
| 352 | @cindex hyper characters | 389 | @cindex hyper characters |
| 353 | @cindex super characters | 390 | @cindex super characters |
| @@ -355,8 +392,15 @@ the computer in any way. | |||
| 355 | The X Window System defines three other modifier bits that can be set | 392 | The X Window System defines three other modifier bits that can be set |
| 356 | in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes | 393 | in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes |
| 357 | for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus, | 394 | for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus, |
| 358 | @samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}. Numerically, the | 395 | @samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}. |
| 359 | bit values are 2**18 for alt, 2**19 for super and 2**20 for hyper. | 396 | @iftex |
| 397 | Numerically, the | ||
| 398 | bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. | ||
| 399 | @end iftex | ||
| 400 | @ifinfo | ||
| 401 | Numerically, the | ||
| 402 | bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper. | ||
| 403 | @end ifinfo | ||
| 360 | 404 | ||
| 361 | @cindex @samp{?} in character constant | 405 | @cindex @samp{?} in character constant |
| 362 | @cindex question mark in character constant | 406 | @cindex question mark in character constant |
| @@ -423,14 +467,13 @@ do such a thing. | |||
| 423 | @cindex CL note---case of letters | 467 | @cindex CL note---case of letters |
| 424 | @quotation | 468 | @quotation |
| 425 | @b{Common Lisp note:} In Common Lisp, lower case letters are always | 469 | @b{Common Lisp note:} In Common Lisp, lower case letters are always |
| 426 | ``folded'' to upper case, unless they are explicitly escaped. This is | 470 | ``folded'' to upper case, unless they are explicitly escaped. In Emacs |
| 427 | in contrast to Emacs Lisp, in which upper case and lower case letters | 471 | Lisp, upper case and lower case letters are distinct. |
| 428 | are distinct. | ||
| 429 | @end quotation | 472 | @end quotation |
| 430 | 473 | ||
| 431 | Here are several examples of symbol names. Note that the @samp{+} in | 474 | Here are several examples of symbol names. Note that the @samp{+} in |
| 432 | the fifth example is escaped to prevent it from being read as a number. | 475 | the fifth example is escaped to prevent it from being read as a number. |
| 433 | This is not necessary in the last example because the rest of the name | 476 | This is not necessary in the sixth example because the rest of the name |
| 434 | makes it invalid as a number. | 477 | makes it invalid as a number. |
| 435 | 478 | ||
| 436 | @example | 479 | @example |
| @@ -762,7 +805,14 @@ string containing just a single double-quote character. | |||
| 762 | characters.) | 805 | characters.) |
| 763 | 806 | ||
| 764 | If you use the @samp{\M-} syntax to indicate a meta character in a | 807 | If you use the @samp{\M-} syntax to indicate a meta character in a |
| 765 | string constant, this sets the 2**7 bit of the character in the string. | 808 | string constant, this sets the |
| 809 | @iftex | ||
| 810 | $2^{7}$ | ||
| 811 | @end iftex | ||
| 812 | @ifinfo | ||
| 813 | 2**7 | ||
| 814 | @end ifinfo | ||
| 815 | bit of the character in the string. | ||
| 766 | This is not the same representation that the meta modifier has in a | 816 | This is not the same representation that the meta modifier has in a |
| 767 | character on its own (not inside a string). @xref{Character Type}. | 817 | character on its own (not inside a string). @xref{Character Type}. |
| 768 | 818 | ||
| @@ -917,8 +967,9 @@ the evaluator handles this data type specially when it appears as a | |||
| 917 | function to be called. @xref{Byte Compilation}, for information about | 967 | function to be called. @xref{Byte Compilation}, for information about |
| 918 | the byte compiler. | 968 | the byte compiler. |
| 919 | 969 | ||
| 920 | The printed representation for a byte-code function object is like that | 970 | The printed representation and read syntax for a byte-code function |
| 921 | for a vector, with an additional @samp{#} before the opening @samp{[}. | 971 | object is like that for a vector, with an additional @samp{#} before the |
| 972 | opening @samp{[}. | ||
| 922 | 973 | ||
| 923 | @node Autoload Type | 974 | @node Autoload Type |
| 924 | @subsection Autoload Type | 975 | @subsection Autoload Type |
| @@ -998,6 +1049,12 @@ a local keymap (@pxref{Keymaps}); and, | |||
| 998 | 1049 | ||
| 999 | @item | 1050 | @item |
| 1000 | a local variable binding list (@pxref{Buffer-Local Variables}). | 1051 | a local variable binding list (@pxref{Buffer-Local Variables}). |
| 1052 | |||
| 1053 | @item | ||
| 1054 | a list of overlays (@pxref{Overlays}). | ||
| 1055 | |||
| 1056 | @item | ||
| 1057 | text properties for the text in the buffer (@pxref{Text Properties}). | ||
| 1001 | @end itemize | 1058 | @end itemize |
| 1002 | 1059 | ||
| 1003 | @noindent | 1060 | @noindent |
| @@ -1006,7 +1063,10 @@ override global bindings or values. These are used to customize the | |||
| 1006 | behavior of programs in different buffers, without actually changing the | 1063 | behavior of programs in different buffers, without actually changing the |
| 1007 | programs. | 1064 | programs. |
| 1008 | 1065 | ||
| 1009 | Buffers have no read syntax. They print in hash notation with the | 1066 | A buffer may be @dfn{indirect}, which means it shares the text |
| 1067 | of another buffer. @xref{Indirect Buffers}. | ||
| 1068 | |||
| 1069 | Buffers have no read syntax. They print in hash notation, showing the | ||
| 1010 | buffer name. | 1070 | buffer name. |
| 1011 | 1071 | ||
| 1012 | @example | 1072 | @example |
| @@ -1187,7 +1247,7 @@ and modify syntax tables. | |||
| 1187 | 1247 | ||
| 1188 | A @dfn{display table} specifies how to display each character code. | 1248 | A @dfn{display table} specifies how to display each character code. |
| 1189 | Each buffer and each window can have its own display table. A display | 1249 | Each buffer and each window can have its own display table. A display |
| 1190 | table is actually a vector of length 261. @xref{Display Tables}. | 1250 | table is actually a vector of length 262. @xref{Display Tables}. |
| 1191 | 1251 | ||
| 1192 | @node Overlay Type | 1252 | @node Overlay Type |
| 1193 | @subsection Overlay Type | 1253 | @subsection Overlay Type |
| @@ -1196,12 +1256,12 @@ table is actually a vector of length 261. @xref{Display Tables}. | |||
| 1196 | appearance of a part of a buffer. It contains markers delimiting a | 1256 | appearance of a part of a buffer. It contains markers delimiting a |
| 1197 | range of the buffer, plus a property list (a list whose elements are | 1257 | range of the buffer, plus a property list (a list whose elements are |
| 1198 | alternating property names and values). Overlays are used to present | 1258 | alternating property names and values). Overlays are used to present |
| 1199 | parts of the buffer temporarily in a different display style. | 1259 | parts of the buffer temporarily in a different display style. They have |
| 1200 | 1260 | no read syntax, and print in hash notation, giving the buffer name and | |
| 1201 | @xref{Overlays}, for how to create and use overlays. They have no | ||
| 1202 | read syntax, and print in hash notation, giving the buffer name and | ||
| 1203 | range of positions. | 1261 | range of positions. |
| 1204 | 1262 | ||
| 1263 | @xref{Overlays}, for how to create and use overlays. | ||
| 1264 | |||
| 1205 | @node Type Predicates | 1265 | @node Type Predicates |
| 1206 | @section Type Predicates | 1266 | @section Type Predicates |
| 1207 | @cindex predicates | 1267 | @cindex predicates |
| @@ -1521,6 +1581,9 @@ use @code{string=} (@pxref{Text Comparison}). | |||
| 1521 | @result{} nil | 1581 | @result{} nil |
| 1522 | @end group | 1582 | @end group |
| 1523 | @end example | 1583 | @end example |
| 1584 | |||
| 1585 | Two distinct buffers are never @code{equal}, even if their contents | ||
| 1586 | are the same. | ||
| 1524 | @end defun | 1587 | @end defun |
| 1525 | 1588 | ||
| 1526 | The test for equality is implemented recursively, and circular lists may | 1589 | The test for equality is implemented recursively, and circular lists may |
diff --git a/lispref/os.texi b/lispref/os.texi index e39c6ca752c..a21107bf4fe 100644 --- a/lispref/os.texi +++ b/lispref/os.texi | |||
| @@ -60,6 +60,10 @@ using a window system. This library's name is | |||
| 60 | @file{term/@var{windowsystem}-win.el}. | 60 | @file{term/@var{windowsystem}-win.el}. |
| 61 | 61 | ||
| 62 | @item | 62 | @item |
| 63 | It processes the initial options. (Some of them are handled | ||
| 64 | even earlier than this.) | ||
| 65 | |||
| 66 | @item | ||
| 63 | It initializes the X window frame and faces, if appropriate. | 67 | It initializes the X window frame and faces, if appropriate. |
| 64 | 68 | ||
| 65 | @item | 69 | @item |
| @@ -101,7 +105,7 @@ It displays the initial echo area message, unless you have suppressed | |||
| 101 | that with @code{inhibit-startup-echo-area-message}. | 105 | that with @code{inhibit-startup-echo-area-message}. |
| 102 | 106 | ||
| 103 | @item | 107 | @item |
| 104 | It processes any remaining command line arguments. | 108 | It processes the action arguments from the command line. |
| 105 | 109 | ||
| 106 | @item | 110 | @item |
| 107 | It runs @code{term-setup-hook}. | 111 | It runs @code{term-setup-hook}. |
| @@ -179,6 +183,11 @@ Emacs does not subsequently load the @file{default.el} file. | |||
| 179 | loads this @emph{before} the user's init file. You can inhibit the | 183 | loads this @emph{before} the user's init file. You can inhibit the |
| 180 | loading of this file with the option @samp{-no-site-file}. | 184 | loading of this file with the option @samp{-no-site-file}. |
| 181 | 185 | ||
| 186 | @defvar site-run-file | ||
| 187 | This variable specifies the site-customization file to load | ||
| 188 | before the user's init file. Its normal value is @code{"site-start"}. | ||
| 189 | @end defvar | ||
| 190 | |||
| 182 | If there is a great deal of code in your @file{.emacs} file, you | 191 | If there is a great deal of code in your @file{.emacs} file, you |
| 183 | should move it into another file named @file{@var{something}.el}, | 192 | should move it into another file named @file{@var{something}.el}, |
| 184 | byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} | 193 | byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} |
| @@ -543,9 +552,8 @@ through various functions. These variables include the name of the | |||
| 543 | system, the user's @sc{uid}, and so on. | 552 | system, the user's @sc{uid}, and so on. |
| 544 | 553 | ||
| 545 | @defvar system-type | 554 | @defvar system-type |
| 546 | The value of this variable is a symbol indicating the type of | 555 | The value of this variable is a symbol indicating the type of operating |
| 547 | operating system Emacs is operating on. Here is a table of the symbols | 556 | system Emacs is operating on. Here is a table of the possible values: |
| 548 | for the operating systems that Emacs can run on up to version 19.1. | ||
| 549 | 557 | ||
| 550 | @table @code | 558 | @table @code |
| 551 | @item aix-v3 | 559 | @item aix-v3 |
| @@ -554,14 +562,26 @@ AIX. | |||
| 554 | @item berkeley-unix | 562 | @item berkeley-unix |
| 555 | Berkeley BSD. | 563 | Berkeley BSD. |
| 556 | 564 | ||
| 565 | @item dgux | ||
| 566 | Data General DGUX operating system. | ||
| 567 | |||
| 568 | @item gnu | ||
| 569 | A GNU system using the GNU HURD and Mach. | ||
| 570 | |||
| 557 | @item hpux | 571 | @item hpux |
| 558 | Hewlett-Packard operating system. | 572 | Hewlett-Packard HPUX operating system. |
| 559 | 573 | ||
| 560 | @item irix | 574 | @item irix |
| 561 | Silicon Graphics Irix system. | 575 | Silicon Graphics Irix system. |
| 562 | 576 | ||
| 563 | @item linux | 577 | @item linux |
| 564 | The free Linux operating system. | 578 | A GNU system using the Linux kernel. |
| 579 | |||
| 580 | @item ms-dos | ||
| 581 | Microsoft MS-DOS ``operating system.'' | ||
| 582 | |||
| 583 | @item next-mach | ||
| 584 | NeXT Mach-based system. | ||
| 565 | 585 | ||
| 566 | @item rtu | 586 | @item rtu |
| 567 | Masscomp RTU, UCB universe. | 587 | Masscomp RTU, UCB universe. |
| @@ -575,6 +595,9 @@ AT&T System V. | |||
| 575 | @item vax-vms | 595 | @item vax-vms |
| 576 | VAX VMS. | 596 | VAX VMS. |
| 577 | 597 | ||
| 598 | @item windows-nt | ||
| 599 | Microsoft windows NT. | ||
| 600 | |||
| 578 | @item xenix | 601 | @item xenix |
| 579 | SCO Xenix 386. | 602 | SCO Xenix 386. |
| 580 | @end table | 603 | @end table |
| @@ -650,13 +673,6 @@ function works by modifying @code{process-environment}; binding that | |||
| 650 | variable with @code{let} is also reasonable practice. | 673 | variable with @code{let} is also reasonable practice. |
| 651 | @end deffn | 674 | @end deffn |
| 652 | 675 | ||
| 653 | @defvar path-separator | ||
| 654 | This variable holds a string which says which character separates | ||
| 655 | directories in a search path (as found in an environment variable). Its | ||
| 656 | value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS | ||
| 657 | and Windows NT. | ||
| 658 | @end defvar | ||
| 659 | |||
| 660 | @defvar process-environment | 676 | @defvar process-environment |
| 661 | This variable is a list of strings, each describing one environment | 677 | This variable is a list of strings, each describing one environment |
| 662 | variable. The functions @code{getenv} and @code{setenv} work by means | 678 | variable. The functions @code{getenv} and @code{setenv} work by means |
| @@ -677,6 +693,13 @@ process-environment | |||
| 677 | @end smallexample | 693 | @end smallexample |
| 678 | @end defvar | 694 | @end defvar |
| 679 | 695 | ||
| 696 | @defvar path-separator | ||
| 697 | This variable holds a string which says which character separates | ||
| 698 | directories in a search path (as found in an environment variable). Its | ||
| 699 | value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS | ||
| 700 | and Windows NT. | ||
| 701 | @end defvar | ||
| 702 | |||
| 680 | @defvar invocation-name | 703 | @defvar invocation-name |
| 681 | This variable holds the program name under which Emacs was invoked. The | 704 | This variable holds the program name under which Emacs was invoked. The |
| 682 | value is a string, and does not include a directory name. | 705 | value is a string, and does not include a directory name. |
| @@ -785,18 +808,6 @@ you to ``fake out'' Emacs by telling the functions what to return. The | |||
| 785 | variables are also useful for constructing frame titles (@pxref{Frame | 808 | variables are also useful for constructing frame titles (@pxref{Frame |
| 786 | Titles}). | 809 | Titles}). |
| 787 | 810 | ||
| 788 | @defvar user-real-login-name | ||
| 789 | This variable holds the same value that the function | ||
| 790 | @code{user-real-login-name} returns. The variable lets you alter the value; | ||
| 791 | also, you can use variables for constructing frame titles. | ||
| 792 | @end defvar | ||
| 793 | |||
| 794 | @defvar user-full-name | ||
| 795 | This variable holds the same value that the function | ||
| 796 | @code{user-full-name} returns. The variable lets you alter the value; | ||
| 797 | also, you can use variables for constructing frame titles. | ||
| 798 | @end defvar | ||
| 799 | |||
| 800 | @defun user-real-uid | 811 | @defun user-real-uid |
| 801 | This function returns the real @sc{uid} of the user. | 812 | This function returns the real @sc{uid} of the user. |
| 802 | 813 | ||
| @@ -822,16 +833,16 @@ zone. | |||
| 822 | This function returns the current time and date as a humanly-readable | 833 | This function returns the current time and date as a humanly-readable |
| 823 | string. The format of the string is unvarying; the number of characters | 834 | string. The format of the string is unvarying; the number of characters |
| 824 | used for each part is always the same, so you can reliably use | 835 | used for each part is always the same, so you can reliably use |
| 825 | @code{substring} to extract pieces of it. However, it would be wise to | 836 | @code{substring} to extract pieces of it. It is wise to count the |
| 826 | count the characters from the beginning of the string rather than from | 837 | characters from the beginning of the string rather than from the end, as |
| 827 | the end, as additional information may be added at the end. | 838 | additional information may be added at the end. |
| 828 | 839 | ||
| 829 | @c Emacs 19 feature | 840 | @c Emacs 19 feature |
| 830 | The argument @var{time-value}, if given, specifies a time to format | 841 | The argument @var{time-value}, if given, specifies a time to format |
| 831 | instead of the current time. The argument should be a cons cell | 842 | instead of the current time. The argument should be a list whose first |
| 832 | containing two integers, or a list whose first two elements are | 843 | two elements are integers. Thus, you can use times obtained from |
| 833 | integers. Thus, you can use times obtained from @code{current-time} | 844 | @code{current-time} (see below) and from @code{file-attributes} |
| 834 | (see below) and from @code{file-attributes} (@pxref{File Attributes}). | 845 | (@pxref{File Attributes}). |
| 835 | 846 | ||
| 836 | @example | 847 | @example |
| 837 | @group | 848 | @group |
| @@ -912,8 +923,8 @@ This stands for the full name of the month. | |||
| 912 | @item %c | 923 | @item %c |
| 913 | This is a synonym for @samp{%x %X}. | 924 | This is a synonym for @samp{%x %X}. |
| 914 | @item %C | 925 | @item %C |
| 915 | This has a locale-specific meaning. In the C locale, it is equivalent | 926 | This has a locale-specific meaning. In the default locale (named C), it |
| 916 | to @samp{%A, %B %e, %Y}. | 927 | is equivalent to @samp{%A, %B %e, %Y}. |
| 917 | @item %d | 928 | @item %d |
| 918 | This stands for the day of month, zero-padded. | 929 | This stands for the day of month, zero-padded. |
| 919 | @item %D | 930 | @item %D |
| @@ -959,11 +970,11 @@ This stands for the numeric day of week (0-6). Sunday is day 0. | |||
| 959 | This stands for the week of the year (01-52), assuming that weeks | 970 | This stands for the week of the year (01-52), assuming that weeks |
| 960 | start on Monday. | 971 | start on Monday. |
| 961 | @item %x | 972 | @item %x |
| 962 | This has a locale-specific meaning. In the C locale, it is equivalent | 973 | This has a locale-specific meaning. In the default locale (named C), it |
| 963 | to @samp{%D}. | 974 | is equivalent to @samp{%D}. |
| 964 | @item %X | 975 | @item %X |
| 965 | This has a locale-specific meaning. In the C locale, it is equivalent | 976 | This has a locale-specific meaning. In the default locale (named C), it |
| 966 | to @samp{%T}. | 977 | is equivalent to @samp{%T}. |
| 967 | @item %y | 978 | @item %y |
| 968 | This stands for the year without century (00-99). | 979 | This stands for the year without century (00-99). |
| 969 | @item %Y | 980 | @item %Y |
| @@ -974,8 +985,8 @@ This stands for the time zone abbreviation. | |||
| 974 | @end defun | 985 | @end defun |
| 975 | 986 | ||
| 976 | @defun decode-time time | 987 | @defun decode-time time |
| 977 | This function converts a time value into calendrical form. The return | 988 | This function converts a time value into calendrical information. The |
| 978 | value is a list of nine elements, as follows: | 989 | return value is a list of nine elements, as follows: |
| 979 | 990 | ||
| 980 | @example | 991 | @example |
| 981 | (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{zone}) | 992 | (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{zone}) |
| @@ -1002,7 +1013,8 @@ Sunday. | |||
| 1002 | @item dst | 1013 | @item dst |
| 1003 | @code{t} if daylight savings time is effect, otherwise @code{nil}. | 1014 | @code{t} if daylight savings time is effect, otherwise @code{nil}. |
| 1004 | @item zone | 1015 | @item zone |
| 1005 | An integer indicating the number of seconds east of Greenwich. | 1016 | An integer indicating the time zone, as the number of seconds east of |
| 1017 | Greenwich. | ||
| 1006 | @end table | 1018 | @end table |
| 1007 | 1019 | ||
| 1008 | Note that Common Lisp has different meanings for @var{dow} and | 1020 | Note that Common Lisp has different meanings for @var{dow} and |
| @@ -1011,10 +1023,8 @@ Note that Common Lisp has different meanings for @var{dow} and | |||
| 1011 | 1023 | ||
| 1012 | @defun encode-time seconds minutes hour day month year &optional zone | 1024 | @defun encode-time seconds minutes hour day month year &optional zone |
| 1013 | This function is the inverse of @code{decode-time}. It converts seven | 1025 | This function is the inverse of @code{decode-time}. It converts seven |
| 1014 | items of calendrical data into a time value. | 1026 | items of calendrical data into a time value. For the meanings of the |
| 1015 | 1027 | arguments, see the table above under @code{decode-time}. | |
| 1016 | For the meanings of the arguments, see the table above under | ||
| 1017 | @code{decode-time}. | ||
| 1018 | 1028 | ||
| 1019 | Year numbers less than 100 are treated just like other year numbers. If | 1029 | Year numbers less than 100 are treated just like other year numbers. If |
| 1020 | you them to stand for years above 1900, you must alter them yourself | 1030 | you them to stand for years above 1900, you must alter them yourself |
| @@ -1028,7 +1038,7 @@ any further alteration for daylight savings time. | |||
| 1028 | @end defun | 1038 | @end defun |
| 1029 | 1039 | ||
| 1030 | @node Timers | 1040 | @node Timers |
| 1031 | @section Timers | 1041 | @section Timers for Delayed Execution |
| 1032 | 1042 | ||
| 1033 | You can set up a timer to call a function at a specified future time. | 1043 | You can set up a timer to call a function at a specified future time. |
| 1034 | 1044 | ||
| @@ -1100,7 +1110,9 @@ functions. | |||
| 1100 | @defun set-input-mode interrupt flow meta quit-char | 1110 | @defun set-input-mode interrupt flow meta quit-char |
| 1101 | This function sets the mode for reading keyboard input. If | 1111 | This function sets the mode for reading keyboard input. If |
| 1102 | @var{interrupt} is non-null, then Emacs uses input interrupts. If it is | 1112 | @var{interrupt} is non-null, then Emacs uses input interrupts. If it is |
| 1103 | @code{nil}, then it uses @sc{cbreak} mode. | 1113 | @code{nil}, then it uses @sc{cbreak} mode. When Emacs communicates |
| 1114 | directly with X, it ignores this argument and uses interrupts if that is | ||
| 1115 | the way it knows how to communicate. | ||
| 1104 | 1116 | ||
| 1105 | If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff} (@kbd{C-q}, | 1117 | If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff} (@kbd{C-q}, |
| 1106 | @kbd{C-s}) flow control for output to the terminal. This has no effect except | 1118 | @kbd{C-s}) flow control for output to the terminal. This has no effect except |
| @@ -1142,7 +1154,7 @@ is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) | |||
| 1142 | flow control for output to the terminal. This value has no effect | 1154 | flow control for output to the terminal. This value has no effect |
| 1143 | unless @var{interrupt} is non-@code{nil}. | 1155 | unless @var{interrupt} is non-@code{nil}. |
| 1144 | @item meta | 1156 | @item meta |
| 1145 | is non-@code{t} if Emacs treats the eighth bit of input characters as | 1157 | is @code{t} if Emacs treats the eighth bit of input characters as |
| 1146 | the meta bit; @code{nil} means Emacs clears the eighth bit of every | 1158 | the meta bit; @code{nil} means Emacs clears the eighth bit of every |
| 1147 | input character; any other value means Emacs uses all eight bits as the | 1159 | input character; any other value means Emacs uses all eight bits as the |
| 1148 | basic character code. | 1160 | basic character code. |
| @@ -1151,14 +1163,6 @@ is the character Emacs currently uses for quitting, usually @kbd{C-g}. | |||
| 1151 | @end table | 1163 | @end table |
| 1152 | @end defun | 1164 | @end defun |
| 1153 | 1165 | ||
| 1154 | @defvar meta-flag | ||
| 1155 | This variable used to control whether to treat the eight bit in keyboard | ||
| 1156 | input characters as the @key{Meta} bit. @code{nil} meant no, and | ||
| 1157 | anything else meant yes. This variable existed in Emacs versions 18 and | ||
| 1158 | earlier but no longer exists in Emacs 19; use @code{set-input-mode} | ||
| 1159 | instead. | ||
| 1160 | @end defvar | ||
| 1161 | |||
| 1162 | @node Translating Input | 1166 | @node Translating Input |
| 1163 | @subsection Translating Input Events | 1167 | @subsection Translating Input Events |
| 1164 | @cindex translating input events | 1168 | @cindex translating input events |
| @@ -1185,7 +1189,7 @@ The @key{META} key. | |||
| 1185 | Each time the user types a keyboard key, it is altered as if the | 1189 | Each time the user types a keyboard key, it is altered as if the |
| 1186 | modifier keys specified in the bit mask were held down. | 1190 | modifier keys specified in the bit mask were held down. |
| 1187 | 1191 | ||
| 1188 | When you use X windows, the program can ``press'' any of the modifier | 1192 | When using X windows, the program can ``press'' any of the modifier |
| 1189 | keys in this way. Otherwise, only the @key{CTL} and @key{META} keys can | 1193 | keys in this way. Otherwise, only the @key{CTL} and @key{META} keys can |
| 1190 | be virtually pressed. | 1194 | be virtually pressed. |
| 1191 | @end defvar | 1195 | @end defvar |
| @@ -1513,8 +1517,10 @@ for flow control is not an official standard. Interestingly, on the | |||
| 1513 | model 33 teletype with a paper tape punch (which is very old), @kbd{C-s} | 1517 | model 33 teletype with a paper tape punch (which is very old), @kbd{C-s} |
| 1514 | and @kbd{C-q} were sent by the computer to turn the punch on and off! | 1518 | and @kbd{C-q} were sent by the computer to turn the punch on and off! |
| 1515 | 1519 | ||
| 1516 | GNU Emacs version 19 provides a convenient way of enabling flow | 1520 | As X servers and other window systems replace character-only |
| 1517 | control if you want it: call the function @code{enable-flow-control}. | 1521 | terminals, this problem is gradually being cured. For the mean time, |
| 1522 | Emacs provides a convenient way of enabling flow control if you want it: | ||
| 1523 | call the function @code{enable-flow-control}. | ||
| 1518 | 1524 | ||
| 1519 | @defun enable-flow-control | 1525 | @defun enable-flow-control |
| 1520 | This function enables use of @kbd{C-s} and @kbd{C-q} for output flow | 1526 | This function enables use of @kbd{C-s} and @kbd{C-q} for output flow |
| @@ -1575,7 +1581,7 @@ calls @var{function} with no arguments. | |||
| 1575 | 1581 | ||
| 1576 | Any Lisp program output that would normally go to the echo area, | 1582 | Any Lisp program output that would normally go to the echo area, |
| 1577 | either using @code{message} or using @code{prin1}, etc., with @code{t} | 1583 | either using @code{message} or using @code{prin1}, etc., with @code{t} |
| 1578 | as the stream, goes instead to Emacs's standard output descriptor when | 1584 | as the stream, goes instead to Emacs's standard error descriptor when |
| 1579 | in batch mode. Thus, Emacs behaves much like a noninteractive | 1585 | in batch mode. Thus, Emacs behaves much like a noninteractive |
| 1580 | application program. (The echo area output that Emacs itself normally | 1586 | application program. (The echo area output that Emacs itself normally |
| 1581 | generates, such as command echoing, is suppressed entirely.) | 1587 | generates, such as command echoing, is suppressed entirely.) |
diff --git a/lispref/positions.texi b/lispref/positions.texi index 6691a63c827..1032c85453b 100644 --- a/lispref/positions.texi +++ b/lispref/positions.texi | |||
| @@ -37,9 +37,9 @@ to allow editing and insertion at different places. | |||
| 37 | 37 | ||
| 38 | Like other positions, point designates a place between two characters | 38 | Like other positions, point designates a place between two characters |
| 39 | (or before the first character, or after the last character), rather | 39 | (or before the first character, or after the last character), rather |
| 40 | than a particular character. Many terminals display the cursor over the | 40 | than a particular character. Usually terminals display the cursor over |
| 41 | character that immediately follows point; on such terminals, point is | 41 | the character that immediately follows point; point is actually before |
| 42 | actually before the character on which the cursor sits. | 42 | the character on which the cursor sits. |
| 43 | 43 | ||
| 44 | @cindex point with narrowing | 44 | @cindex point with narrowing |
| 45 | The value of point is a number between 1 and the buffer size plus 1. | 45 | The value of point is a number between 1 and the buffer size plus 1. |
| @@ -119,8 +119,6 @@ or relative to the edges of the selected window. @xref{Point}. | |||
| 119 | * Buffer End Motion:: Moving to the beginning or end of the buffer. | 119 | * Buffer End Motion:: Moving to the beginning or end of the buffer. |
| 120 | * Text Lines:: Moving in terms of lines of text. | 120 | * Text Lines:: Moving in terms of lines of text. |
| 121 | * Screen Lines:: Moving in terms of lines as displayed. | 121 | * Screen Lines:: Moving in terms of lines as displayed. |
| 122 | * Vertical Motion:: Implementation of @code{next-line} and | ||
| 123 | @code{previous-line}. | ||
| 124 | * List Motion:: Moving by parsing lists and sexps. | 122 | * List Motion:: Moving by parsing lists and sexps. |
| 125 | * Skipping Characters:: Skipping characters belonging to a certain set. | 123 | * Skipping Characters:: Skipping characters belonging to a certain set. |
| 126 | @end menu | 124 | @end menu |
| @@ -422,36 +420,6 @@ to use and more reliable (no dependence on goal column, etc.). | |||
| 422 | @c ================ | 420 | @c ================ |
| 423 | @end ignore | 421 | @end ignore |
| 424 | 422 | ||
| 425 | @defvar cache-long-line-scans | ||
| 426 | This variable determines whether Emacs should use caches to handle long | ||
| 427 | lines more quickly. This variable is buffer-local, in all buffers. | ||
| 428 | |||
| 429 | Normally, the line-motion functions work by scanning the buffer for | ||
| 430 | newlines. Columnar operations (like @code{move-to-column} and | ||
| 431 | @code{compute-motion}) also work by scanning the buffer, summing | ||
| 432 | character widths as they go. This works well for ordinary text, but if | ||
| 433 | the buffer's lines are very long (say, more than 500 characters), these | ||
| 434 | motion functions will take longer to execute. Emacs may also take | ||
| 435 | longer to update the display. | ||
| 436 | |||
| 437 | If @code{cache-long-line-scans} is non-@code{nil}, these motion | ||
| 438 | functions cache the results of their scans, and consult the cache to | ||
| 439 | avoid rescanning regions of the buffer until the text is modified. The | ||
| 440 | caches are most beneficial when they prevent the most searching---that | ||
| 441 | is, when the buffer contains long lines and large regions of characters | ||
| 442 | with the same, fixed screen width. | ||
| 443 | |||
| 444 | When @code{cache-long-line-scans} is non-@code{nil}, processing short | ||
| 445 | lines will become slightly slower (because of the overhead of consulting | ||
| 446 | the cache), and the caches will use memory roughly proportional to the | ||
| 447 | number of newlines and characters whose screen width varies. | ||
| 448 | |||
| 449 | The caches require no explicit maintenance; their accuracy is | ||
| 450 | maintained internally by the Emacs primitives. Enabling or disabling | ||
| 451 | the cache should not affect the behavior of any of the motion functions; | ||
| 452 | it should only affect their performance. | ||
| 453 | @end defvar | ||
| 454 | |||
| 455 | Also see the functions @code{bolp} and @code{eolp} in @ref{Near Point}. | 423 | Also see the functions @code{bolp} and @code{eolp} in @ref{Near Point}. |
| 456 | These functions do not move point, but test whether it is already at the | 424 | These functions do not move point, but test whether it is already at the |
| 457 | beginning or end of a line. | 425 | beginning or end of a line. |
| @@ -532,7 +500,8 @@ the form @code{(@var{hpos} . @var{vpos})}. | |||
| 532 | 500 | ||
| 533 | The argument @var{width} is the number of columns available to display | 501 | The argument @var{width} is the number of columns available to display |
| 534 | text; this affects handling of continuation lines. Use the value | 502 | text; this affects handling of continuation lines. Use the value |
| 535 | returned by @code{window-width} for the window of your choice. | 503 | returned by @code{window-width} for the window of your choice; |
| 504 | normally, use @code{(window-width @var{window})}. | ||
| 536 | 505 | ||
| 537 | The argument @var{offsets} is either @code{nil} or a cons cell of the | 506 | The argument @var{offsets} is either @code{nil} or a cons cell of the |
| 538 | form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is | 507 | form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is |
| @@ -585,49 +554,6 @@ When you use @code{compute-motion} for the minibuffer, you need to use | |||
| 585 | beginning of the first screen line. @xref{Minibuffer Misc}. | 554 | beginning of the first screen line. @xref{Minibuffer Misc}. |
| 586 | @end defun | 555 | @end defun |
| 587 | 556 | ||
| 588 | @node Vertical Motion | ||
| 589 | @comment node-name, next, previous, up | ||
| 590 | @subsection The User-Level Vertical Motion Commands | ||
| 591 | @cindex goal column | ||
| 592 | @cindex vertical text line motion | ||
| 593 | @findex next-line | ||
| 594 | @findex previous-line | ||
| 595 | |||
| 596 | A goal column is useful if you want to edit text such as a table in | ||
| 597 | which you want to move point to a certain column on each line. The goal | ||
| 598 | column affects the vertical text line motion commands, @code{next-line} | ||
| 599 | and @code{previous-line}. @xref{Basic,, Basic Editing Commands, emacs, | ||
| 600 | The GNU Emacs Manual}. | ||
| 601 | |||
| 602 | @defopt goal-column | ||
| 603 | This variable holds an explicitly specified goal column for vertical | ||
| 604 | line motion commands. If it is an integer, it specifies a column, and | ||
| 605 | these commands try to move to that column on each line. If it is | ||
| 606 | @code{nil}, then the commands set their own goal columns. Any other | ||
| 607 | value is invalid. | ||
| 608 | @end defopt | ||
| 609 | |||
| 610 | @defvar temporary-goal-column | ||
| 611 | This variable holds the temporary goal column during a sequence of | ||
| 612 | consecutive vertical line motion commands. It is overridden by | ||
| 613 | @code{goal-column} if that is non-@code{nil}. It is set each time a | ||
| 614 | vertical motion command is invoked, unless the previous command was also | ||
| 615 | a vertical motion command. | ||
| 616 | @end defvar | ||
| 617 | |||
| 618 | @defopt track-eol | ||
| 619 | This variable controls how the vertical line motion commands operate | ||
| 620 | when starting at the end of a line. If @code{track-eol} is | ||
| 621 | non-@code{nil}, then vertical motion starting at the end of a line will | ||
| 622 | keep to the ends of lines (instead of keeping to a particular column). | ||
| 623 | This means moving to the end of each line moved onto. The value of | ||
| 624 | @code{track-eol} has no effect if point is not at the end of a line when | ||
| 625 | the first vertical motion command is given. | ||
| 626 | |||
| 627 | @code{track-eol} has its effect by telling line motion commands to set | ||
| 628 | @code{temporary-goal-column} to 9999 instead of to the current column. | ||
| 629 | @end defopt | ||
| 630 | |||
| 631 | @node List Motion | 557 | @node List Motion |
| 632 | @comment node-name, next, previous, up | 558 | @comment node-name, next, previous, up |
| 633 | @subsection Moving over Balanced Expressions | 559 | @subsection Moving over Balanced Expressions |
diff --git a/lispref/processes.texi b/lispref/processes.texi index a089ba0994d..a5d83c868cb 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -46,7 +46,7 @@ This function returns @code{t} if @var{object} is a process, | |||
| 46 | * Output from Processes:: Collecting output from an asynchronous subprocess. | 46 | * Output from Processes:: Collecting output from an asynchronous subprocess. |
| 47 | * Sentinels:: Sentinels run when process run-status changes. | 47 | * Sentinels:: Sentinels run when process run-status changes. |
| 48 | * Transaction Queues:: Transaction-based communication with subprocesses. | 48 | * Transaction Queues:: Transaction-based communication with subprocesses. |
| 49 | * TCP:: Opening network connections. | 49 | * Network:: Opening network connections. |
| 50 | @end menu | 50 | @end menu |
| 51 | 51 | ||
| 52 | @node Subprocess Creation | 52 | @node Subprocess Creation |
| @@ -313,7 +313,7 @@ inputinput@point{} | |||
| 313 | a synchronous subprocess are text or binary. Text data requires | 313 | a synchronous subprocess are text or binary. Text data requires |
| 314 | translation between the end-of-line convention used within Emacs | 314 | translation between the end-of-line convention used within Emacs |
| 315 | (a single newline character) and the convention used outside Emacs | 315 | (a single newline character) and the convention used outside Emacs |
| 316 | (the two-character sequence, CRLF). | 316 | (the two-character sequence, @sc{crlf}). |
| 317 | 317 | ||
| 318 | The variable @code{binary-process-input} applies to input sent to the | 318 | The variable @code{binary-process-input} applies to input sent to the |
| 319 | subprocess, and @code{binary-process-output} applies to output received | 319 | subprocess, and @code{binary-process-output} applies to output received |
| @@ -321,12 +321,12 @@ from it. A non-@code{nil} value means the data is non-text; @code{nil} | |||
| 321 | means the data is text, and calls for conversion. | 321 | means the data is text, and calls for conversion. |
| 322 | 322 | ||
| 323 | @defvar binary-process-input | 323 | @defvar binary-process-input |
| 324 | If this variable is @code{nil}, convert newlines to CRLF sequences in | 324 | If this variable is @code{nil}, convert newlines to @sc{crlf} sequences in |
| 325 | the input to a synchronous subprocess. | 325 | the input to a synchronous subprocess. |
| 326 | @end defvar | 326 | @end defvar |
| 327 | 327 | ||
| 328 | @defvar binary-process-output | 328 | @defvar binary-process-output |
| 329 | If this variable is @code{nil}, convert CRLF sequences to newlines in | 329 | If this variable is @code{nil}, convert @sc{crlf} sequences to newlines in |
| 330 | the output from a synchronous subprocess. | 330 | the output from a synchronous subprocess. |
| 331 | @end defvar | 331 | @end defvar |
| 332 | 332 | ||
| @@ -396,9 +396,8 @@ command. | |||
| 396 | @cindex pipes | 396 | @cindex pipes |
| 397 | @cindex @sc{pty}s | 397 | @cindex @sc{pty}s |
| 398 | This variable controls the type of device used to communicate with | 398 | This variable controls the type of device used to communicate with |
| 399 | asynchronous subprocesses. If it is @code{nil}, then pipes are used. | 399 | asynchronous subprocesses. If it is non-@code{nil}, then @sc{pty}s are |
| 400 | If it is @code{t}, then @sc{pty}s are used (or pipes if @sc{pty}s are | 400 | used, when available. Otherwise, pipes are used. |
| 401 | not supported). | ||
| 402 | 401 | ||
| 403 | @sc{pty}s are usually preferable for processes visible to the user, as | 402 | @sc{pty}s are usually preferable for processes visible to the user, as |
| 404 | in Shell mode, because they allow job control (@kbd{C-c}, @kbd{C-z}, | 403 | in Shell mode, because they allow job control (@kbd{C-c}, @kbd{C-z}, |
| @@ -945,7 +944,7 @@ Now Emacs does this automatically; filter functions never need to do it | |||
| 945 | explicitly. @xref{Match Data}. | 944 | explicitly. @xref{Match Data}. |
| 946 | 945 | ||
| 947 | A filter function that writes the output into the buffer of the | 946 | A filter function that writes the output into the buffer of the |
| 948 | process should check whether the process is still alive. If it tries to | 947 | process should check whether the buffer is still alive. If it tries to |
| 949 | insert into a dead buffer, it will get an error. If the buffer is dead, | 948 | insert into a dead buffer, it will get an error. If the buffer is dead, |
| 950 | @code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. | 949 | @code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. |
| 951 | 950 | ||
| @@ -1043,6 +1042,13 @@ thus specified are added together, and @code{accept-process-output} | |||
| 1043 | returns after that much time whether or not there has been any | 1042 | returns after that much time whether or not there has been any |
| 1044 | subprocess output. | 1043 | subprocess output. |
| 1045 | 1044 | ||
| 1045 | The argument @var{seconds} need not be an integer. If it is a floating | ||
| 1046 | point number, this function waits for a fractional number of seconds. | ||
| 1047 | Some systems support only a whole number of seconds; on these systems, | ||
| 1048 | @var{seconds} is rounded down. If the system doesn't support waiting | ||
| 1049 | fractions of a second, you get an error if you specify nonzero | ||
| 1050 | @var{millisec}. | ||
| 1051 | |||
| 1046 | Not all operating systems support waiting periods other than multiples | 1052 | Not all operating systems support waiting periods other than multiples |
| 1047 | of a second; on those that do not, you get an error if you specify | 1053 | of a second; on those that do not, you get an error if you specify |
| 1048 | nonzero @var{millisec}. | 1054 | nonzero @var{millisec}. |
| @@ -1095,15 +1101,10 @@ would be unpredictable. If you want to permit quitting inside a | |||
| 1095 | sentinel, bind @code{inhibit-quit} to @code{nil}. @xref{Quitting}. | 1101 | sentinel, bind @code{inhibit-quit} to @code{nil}. @xref{Quitting}. |
| 1096 | 1102 | ||
| 1097 | A sentinel that writes the output into the buffer of the process | 1103 | A sentinel that writes the output into the buffer of the process |
| 1098 | should check whether the process is still alive. If it tries to insert | 1104 | should check whether the buffer is still alive. If it tries to insert |
| 1099 | into a dead buffer, it will get an error. If the buffer is dead, | 1105 | into a dead buffer, it will get an error. If the buffer is dead, |
| 1100 | @code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. | 1106 | @code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. |
| 1101 | 1107 | ||
| 1102 | In earlier Emacs versions, every sentinel that did regexp searching or | ||
| 1103 | matching had to explicitly save and restore the match data. Now Emacs | ||
| 1104 | does this automatically; sentinels never need to do it explicitly. | ||
| 1105 | @xref{Match Data}. | ||
| 1106 | |||
| 1107 | If an error happens during execution of a sentinel, it is caught | 1108 | If an error happens during execution of a sentinel, it is caught |
| 1108 | automatically, so that it doesn't stop the execution of whatever | 1109 | automatically, so that it doesn't stop the execution of whatever |
| 1109 | programs was running when the sentinel was started. However, if | 1110 | programs was running when the sentinel was started. However, if |
| @@ -1111,6 +1112,11 @@ programs was running when the sentinel was started. However, if | |||
| 1111 | off. This makes it possible to use the Lisp debugger to debug the | 1112 | off. This makes it possible to use the Lisp debugger to debug the |
| 1112 | sentinel. @xref{Debugger}. | 1113 | sentinel. @xref{Debugger}. |
| 1113 | 1114 | ||
| 1115 | In earlier Emacs versions, every sentinel that did regexp searching or | ||
| 1116 | matching had to explicitly save and restore the match data. Now Emacs | ||
| 1117 | does this automatically; sentinels never need to do it explicitly. | ||
| 1118 | @xref{Match Data}. | ||
| 1119 | |||
| 1114 | @defun set-process-sentinel process sentinel | 1120 | @defun set-process-sentinel process sentinel |
| 1115 | This function associates @var{sentinel} with @var{process}. If | 1121 | This function associates @var{sentinel} with @var{process}. If |
| 1116 | @var{sentinel} is @code{nil}, then the process will have no sentinel. | 1122 | @var{sentinel} is @code{nil}, then the process will have no sentinel. |
| @@ -1186,12 +1192,13 @@ to complete, and then terminate the connection or child process. | |||
| 1186 | Transaction queues are implemented by means of a filter function. | 1192 | Transaction queues are implemented by means of a filter function. |
| 1187 | @xref{Filter Functions}. | 1193 | @xref{Filter Functions}. |
| 1188 | 1194 | ||
| 1189 | @node TCP | 1195 | @node Network |
| 1190 | @section TCP | 1196 | @section Network Connections |
| 1197 | @cindex network connection | ||
| 1191 | @cindex TCP | 1198 | @cindex TCP |
| 1192 | 1199 | ||
| 1193 | Emacs Lisp programs can open TCP connections to other processes on the | 1200 | Emacs Lisp programs can open TCP network connections to other processes on |
| 1194 | same machine or other machines. A network connection is handled by Lisp | 1201 | the same machine or other machines. A network connection is handled by Lisp |
| 1195 | much like a subprocess, and is represented by a process object. | 1202 | much like a subprocess, and is represented by a process object. |
| 1196 | However, the process you are communicating with is not a child of the | 1203 | However, the process you are communicating with is not a child of the |
| 1197 | Emacs process, so you can't kill it or send it signals. All you can do | 1204 | Emacs process, so you can't kill it or send it signals. All you can do |
| @@ -1201,7 +1208,9 @@ what to do about closure of the connection. | |||
| 1201 | 1208 | ||
| 1202 | You can distinguish process objects representing network connections | 1209 | You can distinguish process objects representing network connections |
| 1203 | from those representing subprocesses with the @code{process-status} | 1210 | from those representing subprocesses with the @code{process-status} |
| 1204 | function. @xref{Process Information}. | 1211 | function. It always returns either @code{open} or @code{closed} for a |
| 1212 | network connection, and it never returns either of those values for a | ||
| 1213 | real subprocess. @xref{Process Information}. | ||
| 1205 | 1214 | ||
| 1206 | @defun open-network-stream name buffer-or-name host service | 1215 | @defun open-network-stream name buffer-or-name host service |
| 1207 | This function opens a TCP connection for a service to a host. It | 1216 | This function opens a TCP connection for a service to a host. It |
diff --git a/lispref/searching.texi b/lispref/searching.texi index 7919804d35c..29852a3624f 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi | |||
| @@ -974,7 +974,8 @@ This function returns, as a string, the text matched in the last search | |||
| 974 | or match operation. It returns the entire text if @var{count} is zero, | 974 | or match operation. It returns the entire text if @var{count} is zero, |
| 975 | or just the portion corresponding to the @var{count}th parenthetical | 975 | or just the portion corresponding to the @var{count}th parenthetical |
| 976 | subexpression, if @var{count} is positive. If @var{count} is out of | 976 | subexpression, if @var{count} is positive. If @var{count} is out of |
| 977 | range, the value is @code{nil}. | 977 | range, or if that subexpression didn't match anything, the value is |
| 978 | @code{nil}. | ||
| 978 | 979 | ||
| 979 | If the last such operation was done against a string with | 980 | If the last such operation was done against a string with |
| 980 | @code{string-match}, then you should pass the same string as the | 981 | @code{string-match}, then you should pass the same string as the |
| @@ -1083,10 +1084,14 @@ This function replaces the text in the buffer (or in @var{string}) that | |||
| 1083 | was matched by the last search. It replaces that text with | 1084 | was matched by the last search. It replaces that text with |
| 1084 | @var{replacement}. | 1085 | @var{replacement}. |
| 1085 | 1086 | ||
| 1086 | If @var{string} is @code{nil}, @code{replace-match} does the replacement | 1087 | If you did the last search in a buffer, you should specify @code{nil} |
| 1087 | by editing the buffer; it leaves point at the end of the replacement | 1088 | for @var{string}. Then @code{replace-match} does the replacement by |
| 1088 | text, and returns @code{t}. If @var{string} is a string, it does the | 1089 | editing the buffer; it leaves point at the end of the replacement text, |
| 1089 | replacement by constructing and returning a new string. | 1090 | and returns @code{t}. |
| 1091 | |||
| 1092 | If you did the search in a string, pass the same string as @var{string}. | ||
| 1093 | Then @code{replace-match} does the replacement by constructing and | ||
| 1094 | returning a new string. | ||
| 1090 | 1095 | ||
| 1091 | If @var{fixedcase} is non-@code{nil}, then the case of the replacement | 1096 | If @var{fixedcase} is non-@code{nil}, then the case of the replacement |
| 1092 | text is not changed; otherwise, the replacement text is converted to a | 1097 | text is not changed; otherwise, the replacement text is converted to a |
| @@ -1207,10 +1212,10 @@ that shows the problem that arises if you fail to save the match data: | |||
| 1207 | 1212 | ||
| 1208 | You can save and restore the match data with @code{save-match-data}: | 1213 | You can save and restore the match data with @code{save-match-data}: |
| 1209 | 1214 | ||
| 1210 | @defspec save-match-data body@dots{} | 1215 | @defmac save-match-data body@dots{} |
| 1211 | This special form executes @var{body}, saving and restoring the match | 1216 | This special form executes @var{body}, saving and restoring the match |
| 1212 | data around it. | 1217 | data around it. |
| 1213 | @end defspec | 1218 | @end defmac |
| 1214 | 1219 | ||
| 1215 | You can use @code{set-match-data} together with @code{match-data} to | 1220 | You can use @code{set-match-data} together with @code{match-data} to |
| 1216 | imitate the effect of the special form @code{save-match-data}. This is | 1221 | imitate the effect of the special form @code{save-match-data}. This is |
| @@ -1318,9 +1323,10 @@ this matches a line that starts with a formfeed character. | |||
| 1318 | match always starts at the beginning of a line; they should not use | 1323 | match always starts at the beginning of a line; they should not use |
| 1319 | @samp{^} to anchor the match. Most often, the paragraph commands do | 1324 | @samp{^} to anchor the match. Most often, the paragraph commands do |
| 1320 | check for a match only at the beginning of a line, which means that | 1325 | check for a match only at the beginning of a line, which means that |
| 1321 | @samp{^} would be superfluous. When there is a left margin, they accept | 1326 | @samp{^} would be superfluous. When there is a nonzero left margin, |
| 1322 | matches that start after the left margin. In that case, a @samp{^} | 1327 | they accept matches that start after the left margin. In that case, a |
| 1323 | would be incorrect. | 1328 | @samp{^} would be incorrect. However, a @samp{^} is harmless in modes |
| 1329 | where a left margin is never used. | ||
| 1324 | 1330 | ||
| 1325 | @defvar paragraph-separate | 1331 | @defvar paragraph-separate |
| 1326 | This is the regular expression for recognizing the beginning of a line | 1332 | This is the regular expression for recognizing the beginning of a line |
diff --git a/lispref/sequences.texi b/lispref/sequences.texi index 0982b19c743..c6de3f1c94d 100644 --- a/lispref/sequences.texi +++ b/lispref/sequences.texi | |||
| @@ -15,8 +15,8 @@ collection of elements. | |||
| 15 | 15 | ||
| 16 | An @dfn{array} is a single primitive object that has a slot for each | 16 | An @dfn{array} is a single primitive object that has a slot for each |
| 17 | elements. All the elements are accessible in constant time, but the | 17 | elements. All the elements are accessible in constant time, but the |
| 18 | length of an existing array cannot be changed. Both strings and vectors | 18 | length of an existing array cannot be changed. Strings and vectors are |
| 19 | are arrays. | 19 | the two types of arrays. |
| 20 | 20 | ||
| 21 | A list is a sequence of elements, but it is not a single primitive | 21 | A list is a sequence of elements, but it is not a single primitive |
| 22 | object; it is made of cons cells, one cell per element. Finding the | 22 | object; it is made of cons cells, one cell per element. Finding the |
| @@ -36,7 +36,7 @@ But it is possible to add elements to the list, or remove elements. | |||
| 36 | | | List | | Array | | | 36 | | | List | | Array | | |
| 37 | | | | | ________ _______ | | | 37 | | | | | ________ _______ | | |
| 38 | | |______| | | | | | | | | 38 | | |______| | | | | | | | |
| 39 | | | | String | | Vector| | | | 39 | | | | Vector | | String| | | |
| 40 | | | |________| |_______| | | | 40 | | | |________| |_______| | | |
| 41 | | |______________________| | | 41 | | |______________________| | |
| 42 | |___________________________________| | 42 | |___________________________________| |
| @@ -191,9 +191,8 @@ otherwise, they trigger an @code{args-out-of-range} error. | |||
| 191 | @end group | 191 | @end group |
| 192 | @end example | 192 | @end example |
| 193 | 193 | ||
| 194 | This function duplicates @code{aref} (@pxref{Array Functions}) and | 194 | This function generalizes @code{aref} (@pxref{Array Functions}) and |
| 195 | @code{nth} (@pxref{List Elements}), except that it works for any kind of | 195 | @code{nth} (@pxref{List Elements}). |
| 196 | sequence. | ||
| 197 | @end defun | 196 | @end defun |
| 198 | 197 | ||
| 199 | @node Arrays | 198 | @node Arrays |
| @@ -232,9 +231,9 @@ The elements of an array may be referenced or changed with the functions | |||
| 232 | @code{aref} and @code{aset}, respectively (@pxref{Array Functions}). | 231 | @code{aref} and @code{aset}, respectively (@pxref{Array Functions}). |
| 233 | @end itemize | 232 | @end itemize |
| 234 | 233 | ||
| 235 | In principle, if you wish to have an array of characters, you could use | 234 | In principle, if you wish to have an array of text characters, you |
| 236 | either a string or a vector. In practice, we always choose strings for | 235 | could use either a string or a vector. In practice, we always choose |
| 237 | such applications, for four reasons: | 236 | strings for such applications, for four reasons: |
| 238 | 237 | ||
| 239 | @itemize @bullet | 238 | @itemize @bullet |
| 240 | @item | 239 | @item |
| @@ -253,6 +252,11 @@ strings. For example, you cannot insert a vector of characters into a | |||
| 253 | buffer the way you can insert a string. @xref{Strings and Characters}. | 252 | buffer the way you can insert a string. @xref{Strings and Characters}. |
| 254 | @end itemize | 253 | @end itemize |
| 255 | 254 | ||
| 255 | By contrast, for an array of keyboard input characters (such as a key | ||
| 256 | sequence), a vector may be necessary, because many keyboard input | ||
| 257 | characters are outside the range that will fit in a string. @xref{Key | ||
| 258 | Sequence Input}. | ||
| 259 | |||
| 256 | @node Array Functions | 260 | @node Array Functions |
| 257 | @section Functions that Operate on Arrays | 261 | @section Functions that Operate on Arrays |
| 258 | 262 | ||
diff --git a/lispref/streams.texi b/lispref/streams.texi index 6efa571ff9c..db7e9aa38ea 100644 --- a/lispref/streams.texi +++ b/lispref/streams.texi | |||
| @@ -52,7 +52,7 @@ text produces a list (but not the same list) with elements @code{a} | |||
| 52 | and @code{b}. | 52 | and @code{b}. |
| 53 | 53 | ||
| 54 | However, these two operations are not precisely inverses. There are | 54 | However, these two operations are not precisely inverses. There are |
| 55 | two kinds of exceptions: | 55 | three kinds of exceptions: |
| 56 | 56 | ||
| 57 | @itemize @bullet | 57 | @itemize @bullet |
| 58 | @item | 58 | @item |
| @@ -66,6 +66,10 @@ One object can have multiple textual representations. For example, | |||
| 66 | @samp{1} and @samp{01} represent the same integer, and @samp{(a b)} and | 66 | @samp{1} and @samp{01} represent the same integer, and @samp{(a b)} and |
| 67 | @samp{(a .@: (b))} represent the same list. Reading will accept any of | 67 | @samp{(a .@: (b))} represent the same list. Reading will accept any of |
| 68 | the alternatives, but printing must choose one of them. | 68 | the alternatives, but printing must choose one of them. |
| 69 | |||
| 70 | @item | ||
| 71 | Comments can appear at certain points in the middle of an object's | ||
| 72 | read sequence without affecting the result of reading it. | ||
| 69 | @end itemize | 73 | @end itemize |
| 70 | 74 | ||
| 71 | @node Input Streams | 75 | @node Input Streams |
| @@ -160,8 +164,9 @@ whitespace preceding the significant text. | |||
| 160 | In Emacs 18, reading a symbol discarded the delimiter terminating the | 164 | In Emacs 18, reading a symbol discarded the delimiter terminating the |
| 161 | symbol. Thus, point would end up at the beginning of @samp{contents} | 165 | symbol. Thus, point would end up at the beginning of @samp{contents} |
| 162 | rather than after @samp{the}. The Emacs 19 behavior is superior because | 166 | rather than after @samp{the}. The Emacs 19 behavior is superior because |
| 163 | it correctly handles input such as @samp{bar(foo)}, where the delimiter | 167 | it correctly handles input such as @samp{bar(foo)}, where the |
| 164 | that ends one object is needed as the beginning of another object. | 168 | open-parenthesis that ends one object is needed as the beginning of |
| 169 | another object. | ||
| 165 | 170 | ||
| 166 | Here is an example of reading from a stream that is a marker, | 171 | Here is an example of reading from a stream that is a marker, |
| 167 | initially positioned at the beginning of the buffer shown. The value | 172 | initially positioned at the beginning of the buffer shown. The value |
diff --git a/lispref/strings.texi b/lispref/strings.texi index a0321476dc0..d923d0407cd 100644 --- a/lispref/strings.texi +++ b/lispref/strings.texi | |||
| @@ -70,8 +70,16 @@ characters. @xref{Character Type}, for more information about | |||
| 70 | representation of meta and other modifiers for keyboard input | 70 | representation of meta and other modifiers for keyboard input |
| 71 | characters. | 71 | characters. |
| 72 | 72 | ||
| 73 | Strings are useful for holding regular expressions. You can also | ||
| 74 | match regular expressions against strings (@pxref{Regexp Search}). The | ||
| 75 | functions @code{match-string} (@pxref{Simple Match Data}) and | ||
| 76 | @code{replace-match} (@pxref{Replacing Match}) are useful for | ||
| 77 | decomposing and modifying strings based on regular expression matching. | ||
| 78 | |||
| 73 | Like a buffer, a string can contain text properties for the characters | 79 | Like a buffer, a string can contain text properties for the characters |
| 74 | in it, as well as the characters themselves. @xref{Text Properties}. | 80 | in it, as well as the characters themselves. @xref{Text Properties}. |
| 81 | All the Lisp primitives that copy text from strings to buffers or other | ||
| 82 | strings also copy the properties of the characters being copied. | ||
| 75 | 83 | ||
| 76 | @xref{Text}, for information about functions that display strings or | 84 | @xref{Text}, for information about functions that display strings or |
| 77 | copy them into buffers. @xref{Character Type}, and @ref{String Type}, | 85 | copy them into buffers. @xref{Character Type}, and @ref{String Type}, |
| @@ -116,7 +124,7 @@ putting strings together, or by taking them apart. | |||
| 116 | @end defun | 124 | @end defun |
| 117 | 125 | ||
| 118 | @defun substring string start &optional end | 126 | @defun substring string start &optional end |
| 119 | This function returns a new string which consists of those characters | 127 | This function returns a new string which consists of those characters |
| 120 | from @var{string} in the range from (and including) the character at the | 128 | from @var{string} in the range from (and including) the character at the |
| 121 | index @var{start} up to (but excluding) the character at the index | 129 | index @var{start} up to (but excluding) the character at the index |
| 122 | @var{end}. The first character is at index zero. | 130 | @var{end}. The first character is at index zero. |
| @@ -175,6 +183,9 @@ of @var{string}. | |||
| 175 | But we recommend @code{copy-sequence} for this purpose (@pxref{Sequence | 183 | But we recommend @code{copy-sequence} for this purpose (@pxref{Sequence |
| 176 | Functions}). | 184 | Functions}). |
| 177 | 185 | ||
| 186 | If the characters copied from @var{string} have text properties, the | ||
| 187 | properties are copied into the new string also. @xref{Text Properties}. | ||
| 188 | |||
| 178 | A @code{wrong-type-argument} error is signaled if either @var{start} or | 189 | A @code{wrong-type-argument} error is signaled if either @var{start} or |
| 179 | @var{end} is not an integer or @code{nil}. An @code{args-out-of-range} | 190 | @var{end} is not an integer or @code{nil}. An @code{args-out-of-range} |
| 180 | error is signaled if @var{start} indicates a character following | 191 | error is signaled if @var{start} indicates a character following |
| @@ -190,9 +201,10 @@ beginning of a buffer is at index 1. | |||
| 190 | @cindex copying strings | 201 | @cindex copying strings |
| 191 | @cindex concatenating strings | 202 | @cindex concatenating strings |
| 192 | This function returns a new string consisting of the characters in the | 203 | This function returns a new string consisting of the characters in the |
| 193 | arguments passed to it. The arguments may be strings, lists of numbers, | 204 | arguments passed to it (along with their text properties, if any). The |
| 194 | or vectors of numbers; they are not themselves changed. If | 205 | arguments may be strings, lists of numbers, or vectors of numbers; they |
| 195 | @code{concat} receives no arguments, it returns an empty string. | 206 | are not themselves changed. If @code{concat} receives no arguments, it |
| 207 | returns an empty string. | ||
| 196 | 208 | ||
| 197 | @example | 209 | @example |
| 198 | (concat "abc" "-def") | 210 | (concat "abc" "-def") |
diff --git a/lispref/symbols.texi b/lispref/symbols.texi index caba9a9bd7e..1921dec922c 100644 --- a/lispref/symbols.texi +++ b/lispref/symbols.texi | |||
| @@ -151,7 +151,8 @@ expression and storing it in the function cell of the symbol. This | |||
| 151 | lambda expression thus becomes the function definition of the symbol. | 151 | lambda expression thus becomes the function definition of the symbol. |
| 152 | (The term ``function definition'', meaning the contents of the function | 152 | (The term ``function definition'', meaning the contents of the function |
| 153 | cell, is derived from the idea that @code{defun} gives the symbol its | 153 | cell, is derived from the idea that @code{defun} gives the symbol its |
| 154 | definition as a function.) @xref{Functions}. | 154 | definition as a function.) @code{defsubst} and @code{defalias} are two |
| 155 | other ways of defining a function. @xref{Functions}. | ||
| 155 | 156 | ||
| 156 | @code{defmacro} defines a symbol as a macro. It creates a macro | 157 | @code{defmacro} defines a symbol as a macro. It creates a macro |
| 157 | object and stores it in the function cell of the symbol. Note that a | 158 | object and stores it in the function cell of the symbol. Note that a |
| @@ -160,8 +161,8 @@ both macro and function definitions are kept in the function cell, and | |||
| 160 | that cell can hold only one Lisp object at any given time. | 161 | that cell can hold only one Lisp object at any given time. |
| 161 | @xref{Macros}. | 162 | @xref{Macros}. |
| 162 | 163 | ||
| 163 | In GNU Emacs Lisp, a definition is not required in order to use a | 164 | In Emacs Lisp, a definition is not required in order to use a symbol |
| 164 | symbol as a variable or function. Thus, you can make a symbol a global | 165 | as a variable or function. Thus, you can make a symbol a global |
| 165 | variable with @code{setq}, whether you define it first or not. The real | 166 | variable with @code{setq}, whether you define it first or not. The real |
| 166 | purpose of definitions is to guide programmers and programming tools. | 167 | purpose of definitions is to guide programmers and programming tools. |
| 167 | They inform programmers who read the code that certain symbols are | 168 | They inform programmers who read the code that certain symbols are |
| @@ -503,11 +504,11 @@ stored in the property list @var{plist}. For example, | |||
| 503 | @end defun | 504 | @end defun |
| 504 | 505 | ||
| 505 | @defun plist-put plist property value | 506 | @defun plist-put plist property value |
| 506 | This stores @var{value} as the value of the @var{property} property | 507 | This stores @var{value} as the value of the @var{property} property in |
| 507 | stored in the property list @var{plist}. It may modify @var{plist} | 508 | the property list @var{plist}. It may modify @var{plist} destructively, |
| 508 | destructively, or it may construct new list structure without altering | 509 | or it may construct new list structure without altering the old. The |
| 509 | the old. The function returns the modified property list, so you can | 510 | function returns the modified property list, so you can store that back |
| 510 | store that back in the place where you got @var{plist}. For example, | 511 | in the place where you got @var{plist}. For example, |
| 511 | 512 | ||
| 512 | @example | 513 | @example |
| 513 | (setq my-plist '(bar t foo 4)) | 514 | (setq my-plist '(bar t foo 4)) |
diff --git a/lispref/syntax.texi b/lispref/syntax.texi index f621e0c0ddf..585df47580a 100644 --- a/lispref/syntax.texi +++ b/lispref/syntax.texi | |||
| @@ -43,7 +43,7 @@ this chapter. | |||
| 43 | @end ifinfo | 43 | @end ifinfo |
| 44 | 44 | ||
| 45 | A syntax table is a vector of 256 elements; it contains one entry for | 45 | A syntax table is a vector of 256 elements; it contains one entry for |
| 46 | each of the 256 @sc{ASCII} characters of an 8-bit byte. Each element is | 46 | each of the 256 possible characters in an 8-bit byte. Each element is |
| 47 | an integer that encodes the syntax of the character in question. | 47 | an integer that encodes the syntax of the character in question. |
| 48 | 48 | ||
| 49 | Syntax tables are used only for moving across text, not for the Emacs | 49 | Syntax tables are used only for moving across text, not for the Emacs |
| @@ -650,8 +650,8 @@ exceed that many. | |||
| 650 | @node Standard Syntax Tables | 650 | @node Standard Syntax Tables |
| 651 | @section Some Standard Syntax Tables | 651 | @section Some Standard Syntax Tables |
| 652 | 652 | ||
| 653 | Each of the major modes in Emacs has its own syntax table. Here are | 653 | Most of the major modes in Emacs have their own syntax tables. Here |
| 654 | several of them: | 654 | are several of them: |
| 655 | 655 | ||
| 656 | @defun standard-syntax-table | 656 | @defun standard-syntax-table |
| 657 | This function returns the standard syntax table, which is the syntax | 657 | This function returns the standard syntax table, which is the syntax |
diff --git a/lispref/text.texi b/lispref/text.texi index eefd2c30259..b4547224308 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -26,7 +26,7 @@ interactive call, point and the mark are used for these arguments. | |||
| 26 | 26 | ||
| 27 | @cindex buffer contents | 27 | @cindex buffer contents |
| 28 | Throughout this chapter, ``text'' refers to the characters in the | 28 | Throughout this chapter, ``text'' refers to the characters in the |
| 29 | buffer. | 29 | buffer, together with their properties (when relevant). |
| 30 | 30 | ||
| 31 | @menu | 31 | @menu |
| 32 | * Near Point:: Examining text in the vicinity of point. | 32 | * Near Point:: Examining text in the vicinity of point. |
| @@ -41,6 +41,7 @@ buffer. | |||
| 41 | * Maintaining Undo:: How to enable and disable undo information. | 41 | * Maintaining Undo:: How to enable and disable undo information. |
| 42 | How to control how much information is kept. | 42 | How to control how much information is kept. |
| 43 | * Filling:: Functions for explicit filling. | 43 | * Filling:: Functions for explicit filling. |
| 44 | * Margins:: How to specify margins for filling commands. | ||
| 44 | * Auto Filling:: How auto-fill mode is implemented to break lines. | 45 | * Auto Filling:: How auto-fill mode is implemented to break lines. |
| 45 | * Sorting:: Functions for sorting parts of the buffer. | 46 | * Sorting:: Functions for sorting parts of the buffer. |
| 46 | * Columns:: Computing horizontal positions, and using them. | 47 | * Columns:: Computing horizontal positions, and using them. |
| @@ -239,7 +240,8 @@ the result is one plus the index of the first differing characters | |||
| 239 | within the substrings. | 240 | within the substrings. |
| 240 | 241 | ||
| 241 | This function ignores case when comparing characters | 242 | This function ignores case when comparing characters |
| 242 | if @code{case-fold-search} is non-@code{nil}. | 243 | if @code{case-fold-search} is non-@code{nil}. It always ignores |
| 244 | text properties. | ||
| 243 | 245 | ||
| 244 | Suppose the current buffer contains the text @samp{foobarbar | 246 | Suppose the current buffer contains the text @samp{foobarbar |
| 245 | haha!rara!}; then in this example the two substrings are @samp{rbar } | 247 | haha!rara!}; then in this example the two substrings are @samp{rbar } |
| @@ -250,12 +252,10 @@ at the second character. | |||
| 250 | (compare-buffer-substring nil 6 11 nil 16 21) | 252 | (compare-buffer-substring nil 6 11 nil 16 21) |
| 251 | @result{} 2 | 253 | @result{} 2 |
| 252 | @end example | 254 | @end example |
| 253 | |||
| 254 | This function does not exist in Emacs version 18 and earlier. | ||
| 255 | @end defun | 255 | @end defun |
| 256 | 256 | ||
| 257 | @node Insertion | 257 | @node Insertion |
| 258 | @section Insertion | 258 | @section Inserting Text |
| 259 | @cindex insertion of text | 259 | @cindex insertion of text |
| 260 | @cindex text insertion | 260 | @cindex text insertion |
| 261 | 261 | ||
| @@ -280,6 +280,12 @@ point} and the latter insertion @dfn{before point}. | |||
| 280 | Insertion functions signal an error if the current buffer is | 280 | Insertion functions signal an error if the current buffer is |
| 281 | read-only. | 281 | read-only. |
| 282 | 282 | ||
| 283 | These functions copy text characters from strings and buffers along | ||
| 284 | with their properties. The inserted characters have exactly the same | ||
| 285 | properties as the characters they were copied from. By contrast, | ||
| 286 | characters specified as separate arguments, not part of a string or | ||
| 287 | buffer, inherit their text properties from the neighboring text. | ||
| 288 | |||
| 283 | @defun insert &rest args | 289 | @defun insert &rest args |
| 284 | This function inserts the strings and/or characters @var{args} into the | 290 | This function inserts the strings and/or characters @var{args} into the |
| 285 | current buffer, at point, moving point forward. In other words, it | 291 | current buffer, at point, moving point forward. In other words, it |
| @@ -393,6 +399,9 @@ result in this case is to insert two newlines at different places: one | |||
| 393 | at point, and another earlier in the line. @code{newline} does not | 399 | at point, and another earlier in the line. @code{newline} does not |
| 394 | auto-fill if @var{number-of-newlines} is non-@code{nil}. | 400 | auto-fill if @var{number-of-newlines} is non-@code{nil}. |
| 395 | 401 | ||
| 402 | This command indents to the left margin if that is not zero. | ||
| 403 | @xref{Margins}. | ||
| 404 | |||
| 396 | The value returned is @code{nil}. In an interactive call, @var{count} | 405 | The value returned is @code{nil}. In an interactive call, @var{count} |
| 397 | is the numeric prefix argument. | 406 | is the numeric prefix argument. |
| 398 | @end deffn | 407 | @end deffn |
| @@ -414,7 +423,7 @@ buffer-local when set in any fashion. | |||
| 414 | @end defvar | 423 | @end defvar |
| 415 | 424 | ||
| 416 | @node Deletion | 425 | @node Deletion |
| 417 | @section Deletion of Text | 426 | @section Deleting Text |
| 418 | 427 | ||
| 419 | @cindex deletion vs killing | 428 | @cindex deletion vs killing |
| 420 | Deletion means removing part of the text in a buffer, without saving | 429 | Deletion means removing part of the text in a buffer, without saving |
| @@ -544,7 +553,7 @@ instead. The value is @code{nil}. | |||
| 544 | 553 | ||
| 545 | If there is a fill prefix, and the second of the lines being joined | 554 | If there is a fill prefix, and the second of the lines being joined |
| 546 | starts with the prefix, then @code{delete-indentation} deletes the | 555 | starts with the prefix, then @code{delete-indentation} deletes the |
| 547 | fill prefix before joining the lines. @xref{Filling}. | 556 | fill prefix before joining the lines. @xref{Margins}. |
| 548 | 557 | ||
| 549 | In the example below, point is located on the line starting | 558 | In the example below, point is located on the line starting |
| 550 | @samp{events}, and it makes no difference if there are trailing spaces | 559 | @samp{events}, and it makes no difference if there are trailing spaces |
| @@ -713,8 +722,8 @@ and if so appends the killed text to the most recent entry. | |||
| 713 | 722 | ||
| 714 | @deffn Command kill-region start end | 723 | @deffn Command kill-region start end |
| 715 | This function kills the text in the region defined by @var{start} and | 724 | This function kills the text in the region defined by @var{start} and |
| 716 | @var{end}. The text is deleted but saved in the kill ring. The value | 725 | @var{end}. The text is deleted but saved in the kill ring, along with |
| 717 | is always @code{nil}. | 726 | its text properties. The value is always @code{nil}. |
| 718 | 727 | ||
| 719 | In an interactive call, @var{start} and @var{end} are point and | 728 | In an interactive call, @var{start} and @var{end} are point and |
| 720 | the mark. | 729 | the mark. |
| @@ -728,9 +737,10 @@ text into the kill ring from a read-only buffer. | |||
| 728 | 737 | ||
| 729 | @deffn Command copy-region-as-kill start end | 738 | @deffn Command copy-region-as-kill start end |
| 730 | This command saves the region defined by @var{start} and @var{end} on | 739 | This command saves the region defined by @var{start} and @var{end} on |
| 731 | the kill ring, but does not delete the text from the buffer. It returns | 740 | the kill ring (including text properties), but does not delete the text |
| 732 | @code{nil}. It also indicates the extent of the text copied by moving | 741 | from the buffer. It returns @code{nil}. It also indicates the extent |
| 733 | the cursor momentarily, or by displaying a message in the echo area. | 742 | of the text copied by moving the cursor momentarily, or by displaying a |
| 743 | message in the echo area. | ||
| 734 | 744 | ||
| 735 | The command does not set @code{this-command} to @code{kill-region}, so a | 745 | The command does not set @code{this-command} to @code{kill-region}, so a |
| 736 | subsequent kill command does not append to the same kill ring entry. | 746 | subsequent kill command does not append to the same kill ring entry. |
| @@ -745,7 +755,7 @@ support Emacs 18. For Emacs 19, it is better to use @code{kill-new} or | |||
| 745 | @subsection Functions for Yanking | 755 | @subsection Functions for Yanking |
| 746 | 756 | ||
| 747 | @dfn{Yanking} means reinserting an entry of previously killed text | 757 | @dfn{Yanking} means reinserting an entry of previously killed text |
| 748 | from the kill ring. | 758 | from the kill ring. The text properties are copied too. |
| 749 | 759 | ||
| 750 | @deffn Command yank &optional arg | 760 | @deffn Command yank &optional arg |
| 751 | @cindex inserting killed text | 761 | @cindex inserting killed text |
| @@ -975,8 +985,9 @@ Here's how you might undo the change: | |||
| 975 | @end example | 985 | @end example |
| 976 | 986 | ||
| 977 | @item @var{position} | 987 | @item @var{position} |
| 978 | This element indicates where point was at an earlier time. | 988 | This element indicates where point was at an earlier time. Undoing this |
| 979 | Undoing this element sets point to @var{position}. | 989 | element sets point to @var{position}. Deletion normally creates an |
| 990 | element of this kind as well as a reinsertion element. | ||
| 980 | 991 | ||
| 981 | @item nil | 992 | @item nil |
| 982 | This element is a boundary. The elements between two boundaries are | 993 | This element is a boundary. The elements between two boundaries are |
| @@ -1018,7 +1029,7 @@ but it is convenient to have it in C. | |||
| 1018 | changes the buffer. Undo commands avoid confusion by saving the undo | 1029 | changes the buffer. Undo commands avoid confusion by saving the undo |
| 1019 | list value at the beginning of a sequence of undo operations. Then the | 1030 | list value at the beginning of a sequence of undo operations. Then the |
| 1020 | undo operations use and update the saved value. The new elements added | 1031 | undo operations use and update the saved value. The new elements added |
| 1021 | by undoing are not part of the saved value, so they don't interfere with | 1032 | by undoing are not part of this saved value, so they don't interfere with |
| 1022 | continuing to undo. | 1033 | continuing to undo. |
| 1023 | @end defun | 1034 | @end defun |
| 1024 | 1035 | ||
| @@ -1089,10 +1100,9 @@ change group is never discarded separate no matter how big it is. | |||
| 1089 | @dfn{Filling} means adjusting the lengths of lines (by moving the line | 1100 | @dfn{Filling} means adjusting the lengths of lines (by moving the line |
| 1090 | breaks) so that they are nearly (but no greater than) a specified | 1101 | breaks) so that they are nearly (but no greater than) a specified |
| 1091 | maximum width. Additionally, lines can be @dfn{justified}, which means | 1102 | maximum width. Additionally, lines can be @dfn{justified}, which means |
| 1092 | that spaces are inserted between words to make the line exactly the | 1103 | inserting spaces to make the left and/or right margins line up |
| 1093 | specified width. The width is controlled by the variable | 1104 | precisely. The width is controlled by the variable @code{fill-column}. |
| 1094 | @code{fill-column}. For ease of reading, lines should be no longer than | 1105 | For ease of reading, lines should be no longer than 70 or so columns. |
| 1095 | 70 or so columns. | ||
| 1096 | 1106 | ||
| 1097 | You can use Auto Fill mode (@pxref{Auto Filling}) to fill text | 1107 | You can use Auto Fill mode (@pxref{Auto Filling}) to fill text |
| 1098 | automatically as you insert it, but changes to existing text may leave | 1108 | automatically as you insert it, but changes to existing text may leave |
| @@ -1100,28 +1110,38 @@ it improperly filled. Then you must fill the text explicitly. | |||
| 1100 | 1110 | ||
| 1101 | Most of the commands in this section return values that are not | 1111 | Most of the commands in this section return values that are not |
| 1102 | meaningful. All the functions that do filling take note of the current | 1112 | meaningful. All the functions that do filling take note of the current |
| 1103 | left margin, current right margin, and current justification style. If | 1113 | left margin, current right margin, and current justification style |
| 1104 | the current justification style is @code{none}, the filling functions | 1114 | (@pxref{Margins}). If the current justification style is |
| 1105 | don't actually do anything. | 1115 | @code{none}, the filling functions don't actually do anything. |
| 1116 | |||
| 1117 | Several of the filling functions have an argument @var{justify}. | ||
| 1118 | If it is non-@code{nil}, that requests some kind of justification. It | ||
| 1119 | can be @code{left}, @code{right}, @code{full}, or @code{center}, to | ||
| 1120 | request a specific style of justification. If it is @code{t}, that | ||
| 1121 | means to use the current justification style for this part of the text | ||
| 1122 | (see @code{current-justification}, below). | ||
| 1123 | |||
| 1124 | When you call the filling functions interactively, using a prefix | ||
| 1125 | argument implies the value @code{full} for @var{justify}. | ||
| 1106 | 1126 | ||
| 1107 | @deffn Command fill-paragraph justify-flag | 1127 | @deffn Command fill-paragraph justify |
| 1108 | @cindex filling a paragraph | 1128 | @cindex filling a paragraph |
| 1109 | This command fills the paragraph at or after point. If | 1129 | This command fills the paragraph at or after point. If |
| 1110 | @var{justify-flag} is non-@code{nil}, each line is justified as well. | 1130 | @var{justify} is non-@code{nil}, each line is justified as well. |
| 1111 | It uses the ordinary paragraph motion commands to find paragraph | 1131 | It uses the ordinary paragraph motion commands to find paragraph |
| 1112 | boundaries. @xref{Paragraphs,,, emacs, The Emacs Manual}. | 1132 | boundaries. @xref{Paragraphs,,, emacs, The Emacs Manual}. |
| 1113 | @end deffn | 1133 | @end deffn |
| 1114 | 1134 | ||
| 1115 | @deffn Command fill-region start end &optional justify-flag | 1135 | @deffn Command fill-region start end &optional justify |
| 1116 | This command fills each of the paragraphs in the region from @var{start} | 1136 | This command fills each of the paragraphs in the region from @var{start} |
| 1117 | to @var{end}. It justifies as well if @var{justify-flag} is | 1137 | to @var{end}. It justifies as well if @var{justify} is |
| 1118 | non-@code{nil}. | 1138 | non-@code{nil}. |
| 1119 | 1139 | ||
| 1120 | The variable @code{paragraph-separate} controls how to distinguish | 1140 | The variable @code{paragraph-separate} controls how to distinguish |
| 1121 | paragraphs. @xref{Standard Regexps}. | 1141 | paragraphs. @xref{Standard Regexps}. |
| 1122 | @end deffn | 1142 | @end deffn |
| 1123 | 1143 | ||
| 1124 | @deffn Command fill-individual-paragraphs start end &optional justify-flag mail-flag | 1144 | @deffn Command fill-individual-paragraphs start end &optional justify mail-flag |
| 1125 | This command fills each paragraph in the region according to its | 1145 | This command fills each paragraph in the region according to its |
| 1126 | individual fill prefix. Thus, if the lines of a paragraph were indented | 1146 | individual fill prefix. Thus, if the lines of a paragraph were indented |
| 1127 | with spaces, the filled paragraph will remain indented in the same | 1147 | with spaces, the filled paragraph will remain indented in the same |
| @@ -1129,8 +1149,8 @@ fashion. | |||
| 1129 | 1149 | ||
| 1130 | The first two arguments, @var{start} and @var{end}, are the beginning | 1150 | The first two arguments, @var{start} and @var{end}, are the beginning |
| 1131 | and end of the region to be filled. The third and fourth arguments, | 1151 | and end of the region to be filled. The third and fourth arguments, |
| 1132 | @var{justify-flag} and @var{mail-flag}, are optional. If | 1152 | @var{justify} and @var{mail-flag}, are optional. If |
| 1133 | @var{justify-flag} is non-@code{nil}, the paragraphs are justified as | 1153 | @var{justify} is non-@code{nil}, the paragraphs are justified as |
| 1134 | well as filled. If @var{mail-flag} is non-@code{nil}, it means the | 1154 | well as filled. If @var{mail-flag} is non-@code{nil}, it means the |
| 1135 | function is operating on a mail message and therefore should not fill | 1155 | function is operating on a mail message and therefore should not fill |
| 1136 | the header lines. | 1156 | the header lines. |
| @@ -1147,13 +1167,11 @@ This variable alters the action of @code{fill-individual-paragraphs} as | |||
| 1147 | described above. | 1167 | described above. |
| 1148 | @end defopt | 1168 | @end defopt |
| 1149 | 1169 | ||
| 1150 | @deffn Command fill-region-as-paragraph start end &optional justify-flag | 1170 | @deffn Command fill-region-as-paragraph start end &optional justify |
| 1151 | This command considers a region of text as a paragraph and fills it. If | 1171 | This command considers a region of text as a paragraph and fills it. If |
| 1152 | the region was made up of many paragraphs, the blank lines between | 1172 | the region was made up of many paragraphs, the blank lines between |
| 1153 | paragraphs are removed. This function justifies as well as filling when | 1173 | paragraphs are removed. This function justifies as well as filling when |
| 1154 | @var{justify-flag} is non-@code{nil}. The precise value of | 1174 | @var{justify} is non-@code{nil}. |
| 1155 | @var{justify-flag} specifies a style of justification, as in | ||
| 1156 | @code{justify-current-line}, below. | ||
| 1157 | 1175 | ||
| 1158 | In an interactive call, any prefix argument requests justification. | 1176 | In an interactive call, any prefix argument requests justification. |
| 1159 | 1177 | ||
| @@ -1187,7 +1205,7 @@ whitespace. | |||
| 1187 | This variable's value specifies the style of justification to use for | 1205 | This variable's value specifies the style of justification to use for |
| 1188 | text that doesn't specify a style with a text property. The possible | 1206 | text that doesn't specify a style with a text property. The possible |
| 1189 | values are @code{left}, @code{right}, @code{full}, @code{center}, or | 1207 | values are @code{left}, @code{right}, @code{full}, @code{center}, or |
| 1190 | @code{none}. | 1208 | @code{none}. The default value is @code{left}. |
| 1191 | @end defopt | 1209 | @end defopt |
| 1192 | 1210 | ||
| 1193 | @defun current-justification | 1211 | @defun current-justification |
| @@ -1195,6 +1213,32 @@ This function returns the proper justification style to use for filling | |||
| 1195 | the text around point. | 1213 | the text around point. |
| 1196 | @end defun | 1214 | @end defun |
| 1197 | 1215 | ||
| 1216 | @defvar fill-paragraph-function | ||
| 1217 | This variable provides a way for major modes to override the filling of | ||
| 1218 | paragraphs. If the value is non-@code{nil}, @code{fill-paragraph} calls | ||
| 1219 | this function to do the work. If the function returns a non-@code{nil} | ||
| 1220 | value, @code{fill-paragraph} assumes the job is done, and immediately | ||
| 1221 | returns that value. | ||
| 1222 | |||
| 1223 | The usual use of this feature is to fill comments in programming | ||
| 1224 | language modes. If the function needs to fill a paragraph in the usual | ||
| 1225 | way, it can do so as follows: | ||
| 1226 | |||
| 1227 | @example | ||
| 1228 | (let ((fill-paragraph-function nil)) | ||
| 1229 | (fill-paragraph arg)) | ||
| 1230 | @end example | ||
| 1231 | @end defvar | ||
| 1232 | |||
| 1233 | @defvar use-hard-newlines | ||
| 1234 | If this variable is non-@code{nil}, the filling functions do not delete | ||
| 1235 | newlines that have the @code{hard} text property. These ``hard | ||
| 1236 | newlines'' act as paragraph separators. | ||
| 1237 | @end defvar | ||
| 1238 | |||
| 1239 | @node Margins | ||
| 1240 | @section Margins for Filling | ||
| 1241 | |||
| 1198 | @defopt fill-prefix | 1242 | @defopt fill-prefix |
| 1199 | This variable specifies a string of text that appears at the beginning | 1243 | This variable specifies a string of text that appears at the beginning |
| 1200 | of normal text lines and should be disregarded when filling them. Any | 1244 | of normal text lines and should be disregarded when filling them. Any |
| @@ -1203,6 +1247,8 @@ a paragraph; so is any line that starts with the fill prefix followed by | |||
| 1203 | additional whitespace. Lines that start with the fill prefix but no | 1247 | additional whitespace. Lines that start with the fill prefix but no |
| 1204 | additional whitespace are ordinary text lines that can be filled | 1248 | additional whitespace are ordinary text lines that can be filled |
| 1205 | together. The resulting filled lines also start with the fill prefix. | 1249 | together. The resulting filled lines also start with the fill prefix. |
| 1250 | |||
| 1251 | The fill prefix follows the left margin whitespace, if any. | ||
| 1206 | @end defopt | 1252 | @end defopt |
| 1207 | 1253 | ||
| 1208 | @defopt fill-column | 1254 | @defopt fill-column |
| @@ -1225,23 +1271,6 @@ buffers that do not override it. This is the same as | |||
| 1225 | The default value for @code{default-fill-column} is 70. | 1271 | The default value for @code{default-fill-column} is 70. |
| 1226 | @end defvar | 1272 | @end defvar |
| 1227 | 1273 | ||
| 1228 | @defvar fill-paragraph-function | ||
| 1229 | This variable provides a way for major modes to override the filling of | ||
| 1230 | paragraphs. If the value is non-@code{nil}, @code{fill-paragraph} calls | ||
| 1231 | this function to do the work. If the function returns a non-@code{nil} | ||
| 1232 | value, @code{fill-paragraph} assumes the job is done, and immediately | ||
| 1233 | returns that value. | ||
| 1234 | |||
| 1235 | The usual use of this feature is to fill comments in programming | ||
| 1236 | language modes. If the function needs to fill a paragraph in the usual | ||
| 1237 | way, it can do so as follows: | ||
| 1238 | |||
| 1239 | @example | ||
| 1240 | (let ((fill-paragraph-function nil)) | ||
| 1241 | (fill-paragraph arg)) | ||
| 1242 | @end example | ||
| 1243 | @end defvar | ||
| 1244 | |||
| 1245 | @deffn Command set-left-margin from to margin | 1274 | @deffn Command set-left-margin from to margin |
| 1246 | This sets the @code{left-margin} property on the text from @var{from} to | 1275 | This sets the @code{left-margin} property on the text from @var{from} to |
| 1247 | @var{to} to the value @var{margin}. If Auto Fill mode is enabled, this | 1276 | @var{to} to the value @var{margin}. If Auto Fill mode is enabled, this |
| @@ -1249,17 +1278,16 @@ command also refills the region to fit the new margin. | |||
| 1249 | @end deffn | 1278 | @end deffn |
| 1250 | 1279 | ||
| 1251 | @deffn Command set-right-margin from to margin | 1280 | @deffn Command set-right-margin from to margin |
| 1252 | This sets the @code{fill-colmn} property on the text from @var{from} to | 1281 | This sets the @code{right-margin} property on the text from @var{from} |
| 1253 | @var{to} so as to yield a right margin of width @var{margin}. If Auto | 1282 | to @var{to} to the value @var{margin}. If Auto Fill mode is enabled, |
| 1254 | Fill mode is enabled, this command also refills the region to fit the | 1283 | this command also refills the region to fit the new margin. |
| 1255 | new margin. | ||
| 1256 | @end deffn | 1284 | @end deffn |
| 1257 | 1285 | ||
| 1258 | @defun current-left-margin | 1286 | @defun current-left-margin |
| 1259 | This function returns the proper left margin value to use for filling | 1287 | This function returns the proper left margin value to use for filling |
| 1260 | the text around point. The value is the sum of the @code{left-margin} | 1288 | the text around point. The value is the sum of the @code{left-margin} |
| 1261 | property of the character at the start of the current line (or zero if | 1289 | property of the character at the start of the current line (or zero if |
| 1262 | none), plus the value of the variable @code{left-margin}. | 1290 | none), and the value of the variable @code{left-margin}. |
| 1263 | @end defun | 1291 | @end defun |
| 1264 | 1292 | ||
| 1265 | @defun current-fill-column | 1293 | @defun current-fill-column |
| @@ -1272,7 +1300,7 @@ character after point. | |||
| 1272 | @deffn Command move-to-left-margin &optional n force | 1300 | @deffn Command move-to-left-margin &optional n force |
| 1273 | This function moves point to the left margin of the current line. The | 1301 | This function moves point to the left margin of the current line. The |
| 1274 | column moved to is determined by calling the function | 1302 | column moved to is determined by calling the function |
| 1275 | @code{current-left-margin}. If the argument @var{n} is specified, | 1303 | @code{current-left-margin}. If the argument @var{n} is non-@code{nil}, |
| 1276 | @code{move-to-left-margin} moves forward @var{n}@minus{}1 lines first. | 1304 | @code{move-to-left-margin} moves forward @var{n}@minus{}1 lines first. |
| 1277 | 1305 | ||
| 1278 | If @var{force} is non-@code{nil}, that says to fix the line's | 1306 | If @var{force} is non-@code{nil}, that says to fix the line's |
| @@ -1286,6 +1314,20 @@ to delete is determined by calling @code{current-left-margin}. | |||
| 1286 | In no case does this function delete non-whitespace. | 1314 | In no case does this function delete non-whitespace. |
| 1287 | @end defun | 1315 | @end defun |
| 1288 | 1316 | ||
| 1317 | @defun indent-to-left-margin | ||
| 1318 | This is the default @code{indent-line-function}, used in Fundamental | ||
| 1319 | mode, Text mode, etc. Its effect is to adjust the indentation at the | ||
| 1320 | beginning of the current line to the value specified by the variable | ||
| 1321 | @code{left-margin}. This may involve either inserting or deleting | ||
| 1322 | whitespace. | ||
| 1323 | @end defun | ||
| 1324 | |||
| 1325 | @defvar left-margin | ||
| 1326 | This variable specifies the base left margin column. In Fundamental | ||
| 1327 | mode, @key{LFD} indents to this column. This variable automatically | ||
| 1328 | becomes buffer-local when set in any fashion. | ||
| 1329 | @end defvar | ||
| 1330 | |||
| 1289 | @node Auto Filling | 1331 | @node Auto Filling |
| 1290 | @comment node-name, next, previous, up | 1332 | @comment node-name, next, previous, up |
| 1291 | @section Auto Filling | 1333 | @section Auto Filling |
| @@ -1297,6 +1339,9 @@ as inserted. This section describes the hook used by Auto Fill mode. | |||
| 1297 | For a description of functions that you can call explicitly to fill and | 1339 | For a description of functions that you can call explicitly to fill and |
| 1298 | justify existing text, see @ref{Filling}. | 1340 | justify existing text, see @ref{Filling}. |
| 1299 | 1341 | ||
| 1342 | Auto Fill mode also enables the functions that change the margins and | ||
| 1343 | justification style to refill portions of the text. @xref{Margins}. | ||
| 1344 | |||
| 1300 | @defvar auto-fill-function | 1345 | @defvar auto-fill-function |
| 1301 | The value of this variable should be a function (of no arguments) to be | 1346 | The value of this variable should be a function (of no arguments) to be |
| 1302 | called after self-inserting a space or a newline. It may be @code{nil}, | 1347 | called after self-inserting a space or a newline. It may be @code{nil}, |
| @@ -1539,8 +1584,6 @@ containing position @var{beg}, and the entire line containing position | |||
| 1539 | Note that @code{sort-columns} uses the @code{sort} utility program, | 1584 | Note that @code{sort-columns} uses the @code{sort} utility program, |
| 1540 | and so cannot work properly on text containing tab characters. Use | 1585 | and so cannot work properly on text containing tab characters. Use |
| 1541 | @kbd{M-x @code{untabify}} to convert tabs to spaces before sorting. | 1586 | @kbd{M-x @code{untabify}} to convert tabs to spaces before sorting. |
| 1542 | |||
| 1543 | The @code{sort-columns} function did not work on VMS prior to Emacs 19. | ||
| 1544 | @end deffn | 1587 | @end deffn |
| 1545 | 1588 | ||
| 1546 | @node Columns | 1589 | @node Columns |
| @@ -1689,20 +1732,6 @@ the current line; except that if that function is | |||
| 1689 | is a trivial command that inserts a tab character.) | 1732 | is a trivial command that inserts a tab character.) |
| 1690 | @end deffn | 1733 | @end deffn |
| 1691 | 1734 | ||
| 1692 | @defun indent-to-left-margin | ||
| 1693 | This is the default @code{indent-line-function}, used in Fundamental | ||
| 1694 | mode, Text mode, etc. Its effect is to adjust the indentation at the | ||
| 1695 | beginning of the current line to the value specified by the variable | ||
| 1696 | @code{left-margin}. This may involve either inserting or deleting | ||
| 1697 | whitespace. | ||
| 1698 | @end defun | ||
| 1699 | |||
| 1700 | @defvar left-margin | ||
| 1701 | This variable specifies the column for @code{indent-to-left-margin} to | ||
| 1702 | indent to. In Fundamental mode, @key{LFD} indents to this column. This | ||
| 1703 | variable automatically becomes buffer-local when set in any fashion. | ||
| 1704 | @end defvar | ||
| 1705 | |||
| 1706 | @deffn Command newline-and-indent | 1735 | @deffn Command newline-and-indent |
| 1707 | @comment !!SourceFile simple.el | 1736 | @comment !!SourceFile simple.el |
| 1708 | This function inserts a newline, then indents the new line (the one | 1737 | This function inserts a newline, then indents the new line (the one |
| @@ -2107,8 +2136,8 @@ This function returns the entire property list of the character at | |||
| 2107 | @defvar default-text-properties | 2136 | @defvar default-text-properties |
| 2108 | This variable holds a property list giving default values for text | 2137 | This variable holds a property list giving default values for text |
| 2109 | properties. Whenever a character does not specify a value for a | 2138 | properties. Whenever a character does not specify a value for a |
| 2110 | property, the value stored in this list is used instead. Here is an | 2139 | property, neither directly nor through a category symbol, the value |
| 2111 | example: | 2140 | stored in this list is used instead. Here is an example: |
| 2112 | 2141 | ||
| 2113 | @example | 2142 | @example |
| 2114 | (setq default-text-properties '(foo 69)) | 2143 | (setq default-text-properties '(foo 69)) |
| @@ -2134,6 +2163,12 @@ can affect how the buffer looks on the screen, any change in the text | |||
| 2134 | properties is considered a buffer modification. Buffer text property | 2163 | properties is considered a buffer modification. Buffer text property |
| 2135 | changes are undoable (@pxref{Undo}). | 2164 | changes are undoable (@pxref{Undo}). |
| 2136 | 2165 | ||
| 2166 | @defun put-text-property start end prop value &optional object | ||
| 2167 | This function sets the @var{prop} property to @var{value} for the text | ||
| 2168 | between @var{start} and @var{end} in the string or buffer @var{object}. | ||
| 2169 | If @var{object} is @code{nil}, it defaults to the current buffer. | ||
| 2170 | @end defun | ||
| 2171 | |||
| 2137 | @defun add-text-properties start end props &optional object | 2172 | @defun add-text-properties start end props &optional object |
| 2138 | This function modifies the text properties for the text between | 2173 | This function modifies the text properties for the text between |
| 2139 | @var{start} and @var{end} in the string or buffer @var{object}. If | 2174 | @var{start} and @var{end} in the string or buffer @var{object}. If |
| @@ -2157,12 +2192,6 @@ properties of a range of text: | |||
| 2157 | @end example | 2192 | @end example |
| 2158 | @end defun | 2193 | @end defun |
| 2159 | 2194 | ||
| 2160 | @defun put-text-property start end prop value &optional object | ||
| 2161 | This function sets the @var{prop} property to @var{value} for the text | ||
| 2162 | between @var{start} and @var{end} in the string or buffer @var{object}. | ||
| 2163 | If @var{object} is @code{nil}, it defaults to the current buffer. | ||
| 2164 | @end defun | ||
| 2165 | |||
| 2166 | @defun remove-text-properties start end props &optional object | 2195 | @defun remove-text-properties start end props &optional object |
| 2167 | This function deletes specified text properties from the text between | 2196 | This function deletes specified text properties from the text between |
| 2168 | @var{start} and @var{end} in the string or buffer @var{object}. If | 2197 | @var{start} and @var{end} in the string or buffer @var{object}. If |
| @@ -2214,13 +2243,14 @@ consecutive characters have the same value for a property. Rather than | |||
| 2214 | writing your programs to examine characters one by one, it is much | 2243 | writing your programs to examine characters one by one, it is much |
| 2215 | faster to process chunks of text that have the same property value. | 2244 | faster to process chunks of text that have the same property value. |
| 2216 | 2245 | ||
| 2217 | Here are functions you can use to do this. In all cases, @var{object} | 2246 | Here are functions you can use to do this. They use @code{eq} for |
| 2218 | defaults to the current buffer. | 2247 | comparing property values. In all cases, @var{object} defaults to the |
| 2248 | current buffer. | ||
| 2219 | 2249 | ||
| 2220 | For high performance, it's very important to use the @var{limit} | 2250 | For high performance, it's very important to use the @var{limit} |
| 2221 | argument to these functions, especially the ones that search for a | 2251 | argument to these functions, especially the ones that search for a |
| 2222 | single property---otherwise, they may spend a long time considering | 2252 | single property---otherwise, they may spend a long time scanning to the |
| 2223 | changes in other properties while scanning to the end of the buffer. | 2253 | end of the buffer, if the property you are interested in does not change. |
| 2224 | 2254 | ||
| 2225 | Remember that a position is always between two characters; the position | 2255 | Remember that a position is always between two characters; the position |
| 2226 | returned by these functions is between two characters with different | 2256 | returned by these functions is between two characters with different |
| @@ -2314,6 +2344,11 @@ for @var{object} is the current buffer. | |||
| 2314 | @node Special Properties | 2344 | @node Special Properties |
| 2315 | @subsection Properties with Special Meanings | 2345 | @subsection Properties with Special Meanings |
| 2316 | 2346 | ||
| 2347 | Here is a table of text property names that have special built-in | ||
| 2348 | meanings. The following section lists a few more special property names | ||
| 2349 | that are used to control filling. All other names have no standard | ||
| 2350 | meaning, and you can use them as you like. | ||
| 2351 | |||
| 2317 | @table @code | 2352 | @table @code |
| 2318 | @cindex category of text character | 2353 | @cindex category of text character |
| 2319 | @kindex category @r{(text property)} | 2354 | @kindex category @r{(text property)} |
| @@ -2370,8 +2405,8 @@ on the screen. @xref{Invisible Text}, for details. | |||
| 2370 | @kindex intangible @r{(text property)} | 2405 | @kindex intangible @r{(text property)} |
| 2371 | If a group of consecutive characters have equal and non-@code{nil} | 2406 | If a group of consecutive characters have equal and non-@code{nil} |
| 2372 | @code{intangible} properties, then you cannot place point between them. | 2407 | @code{intangible} properties, then you cannot place point between them. |
| 2373 | If you move point forward into the group, point actually moves to the | 2408 | If you try to move point forward into the group, point actually moves to |
| 2374 | end of the group. If you try to move point backward into the group, | 2409 | the end of the group. If you try to move point backward into the group, |
| 2375 | point actually moves to the start of the group. | 2410 | point actually moves to the start of the group. |
| 2376 | 2411 | ||
| 2377 | When the variable @code{inhibit-point-motion-hooks} is non-@code{nil}, | 2412 | When the variable @code{inhibit-point-motion-hooks} is non-@code{nil}, |
| @@ -2444,12 +2479,13 @@ property has no effect. | |||
| 2444 | @end defvar | 2479 | @end defvar |
| 2445 | 2480 | ||
| 2446 | @node Format Properties | 2481 | @node Format Properties |
| 2447 | @section Formatted Text Properties | 2482 | @subsection Formatted Text Properties |
| 2448 | 2483 | ||
| 2449 | These text properties affect the behavior of the fill commands. They | 2484 | These text properties affect the behavior of the fill commands. They |
| 2450 | are used for representing formatted text. @xref{Filling}. | 2485 | are used for representing formatted text. @xref{Filling}, and |
| 2486 | @ref{Margins}. | ||
| 2451 | 2487 | ||
| 2452 | @table code | 2488 | @table @code |
| 2453 | @item hard | 2489 | @item hard |
| 2454 | If a newline character has this property, it is a ``hard'' newline. | 2490 | If a newline character has this property, it is a ``hard'' newline. |
| 2455 | The fill commands do not alter hard newlines and do not move words | 2491 | The fill commands do not alter hard newlines and do not move words |
| @@ -2457,11 +2493,11 @@ across them. However, this property takes effect only if the variable | |||
| 2457 | @code{use-hard-newlines} is non-@code{nil}. | 2493 | @code{use-hard-newlines} is non-@code{nil}. |
| 2458 | 2494 | ||
| 2459 | @item right-margin | 2495 | @item right-margin |
| 2460 | This property specifies the right margin for filling this part of the | 2496 | This property specifies an extra right margin for filling this part of the |
| 2461 | text. | 2497 | text. |
| 2462 | 2498 | ||
| 2463 | @item left-margin | 2499 | @item left-margin |
| 2464 | This property specifies the left margin for filling this part of the | 2500 | This property specifies an extra left margin for filling this part of the |
| 2465 | text. | 2501 | text. |
| 2466 | 2502 | ||
| 2467 | @item justification | 2503 | @item justification |
| @@ -2541,7 +2577,7 @@ adjoining text. | |||
| 2541 | You can save text properties in files, and restore text properties | 2577 | You can save text properties in files, and restore text properties |
| 2542 | when inserting the files, using these two hooks: | 2578 | when inserting the files, using these two hooks: |
| 2543 | 2579 | ||
| 2544 | @defvar write-region-annotation-functions | 2580 | @defvar write-region-annotate-functions |
| 2545 | This variable's value is a list of functions for @code{write-region} to | 2581 | This variable's value is a list of functions for @code{write-region} to |
| 2546 | run to encode text properties in some fashion as annotations to the text | 2582 | run to encode text properties in some fashion as annotations to the text |
| 2547 | being written in the file. @xref{Writing to Files}. | 2583 | being written in the file. @xref{Writing to Files}. |
| @@ -2597,6 +2633,10 @@ names or property values---because a program that general is probably | |||
| 2597 | difficult to write, and slow. Instead, choose a set of possible data | 2633 | difficult to write, and slow. Instead, choose a set of possible data |
| 2598 | types that are reasonably flexible, and not too hard to encode. | 2634 | types that are reasonably flexible, and not too hard to encode. |
| 2599 | 2635 | ||
| 2636 | @xref{Format Conversion}, for a related feature. | ||
| 2637 | |||
| 2638 | @c ??? In next edition, merge this info Format Conversion. | ||
| 2639 | |||
| 2600 | @node Not Intervals | 2640 | @node Not Intervals |
| 2601 | @subsection Why Text Properties are not Intervals | 2641 | @subsection Why Text Properties are not Intervals |
| 2602 | @cindex intervals | 2642 | @cindex intervals |
| @@ -2659,11 +2699,10 @@ defined by @var{start} and @var{end}. | |||
| 2659 | 2699 | ||
| 2660 | @cindex Outline mode | 2700 | @cindex Outline mode |
| 2661 | @cindex undo avoidance | 2701 | @cindex undo avoidance |
| 2662 | If @var{noundo} is non-@code{nil}, then @code{subst-char-in-region} | 2702 | If @var{noundo} is non-@code{nil}, then @code{subst-char-in-region} does |
| 2663 | does not record the change for undo and does not mark the buffer as | 2703 | not record the change for undo and does not mark the buffer as modified. |
| 2664 | modified. This feature is useful for changes that are not considered | 2704 | This feature is used for controlling selective display (@pxref{Selective |
| 2665 | significant, such as when Outline mode changes visible lines to | 2705 | Display}). |
| 2666 | invisible lines and vice versa. | ||
| 2667 | 2706 | ||
| 2668 | @code{subst-char-in-region} does not move point and returns | 2707 | @code{subst-char-in-region} does not move point and returns |
| 2669 | @code{nil}. | 2708 | @code{nil}. |
| @@ -2700,8 +2739,6 @@ The return value of @code{translate-region} is the number of | |||
| 2700 | characters that were actually changed by the translation. This does | 2739 | characters that were actually changed by the translation. This does |
| 2701 | not count characters that were mapped into themselves in the | 2740 | not count characters that were mapped into themselves in the |
| 2702 | translation table. | 2741 | translation table. |
| 2703 | |||
| 2704 | This function is available in Emacs versions 19 and later. | ||
| 2705 | @end defun | 2742 | @end defun |
| 2706 | 2743 | ||
| 2707 | @node Registers | 2744 | @node Registers |
| @@ -2875,13 +2912,13 @@ buffer that's about to change is always the current buffer. | |||
| 2875 | @end defvar | 2912 | @end defvar |
| 2876 | 2913 | ||
| 2877 | @defvar before-change-function | 2914 | @defvar before-change-function |
| 2878 | This variable holds one function to call before any buffer modification | 2915 | This obsolete variable holds one function to call before any buffer |
| 2879 | (or @code{nil} for no function). It is called just like the functions | 2916 | modification (or @code{nil} for no function). It is called just like |
| 2880 | in @code{before-change-functions}. | 2917 | the functions in @code{before-change-functions}. |
| 2881 | @end defvar | 2918 | @end defvar |
| 2882 | 2919 | ||
| 2883 | @defvar after-change-function | 2920 | @defvar after-change-function |
| 2884 | This variable holds one function to call after any buffer modification | 2921 | This obsolete variable holds one function to call after any buffer modification |
| 2885 | (or @code{nil} for no function). It is called just like the functions in | 2922 | (or @code{nil} for no function). It is called just like the functions in |
| 2886 | @code{after-change-functions}. | 2923 | @code{after-change-functions}. |
| 2887 | @end defvar | 2924 | @end defvar |
| @@ -2916,6 +2953,3 @@ to call. Here is an example: | |||
| 2916 | This variable is a normal hook that is run whenever a buffer is changed | 2953 | This variable is a normal hook that is run whenever a buffer is changed |
| 2917 | that was previously in the unmodified state. | 2954 | that was previously in the unmodified state. |
| 2918 | @end defvar | 2955 | @end defvar |
| 2919 | |||
| 2920 | The variables described in this section are meaningful only starting | ||
| 2921 | with Emacs version 19. | ||
diff --git a/lispref/tips.texi b/lispref/tips.texi index 9c252748230..76cd3427eef 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi | |||
| @@ -60,14 +60,28 @@ library program, at least if there is more than one entry point to the | |||
| 60 | program. | 60 | program. |
| 61 | 61 | ||
| 62 | @item | 62 | @item |
| 63 | If a file requires certain other library programs to be loaded | ||
| 64 | beforehand, then the comments at the beginning of the file should say | ||
| 65 | so. Also, use @code{require} to make sure they are loaded. | ||
| 66 | |||
| 67 | @item | ||
| 63 | If one file @var{foo} uses a macro defined in another file @var{bar}, | 68 | If one file @var{foo} uses a macro defined in another file @var{bar}, |
| 64 | @var{foo} should contain @code{(require '@var{bar})} before the first | 69 | @var{foo} should contain this expression before the first use of the |
| 65 | use of the macro. (And @var{bar} should contain @code{(provide | 70 | macro: |
| 66 | '@var{bar})}, to make the @code{require} work.) This will cause | 71 | |
| 67 | @var{bar} to be loaded when you byte-compile @var{foo}. Otherwise, you | 72 | @example |
| 68 | risk compiling @var{foo} without the necessary macro loaded, and that | 73 | (eval-when-compile (require '@var{bar})) |
| 69 | would produce compiled code that won't work right. @xref{Compiling | 74 | @end example |
| 70 | Macros}. | 75 | |
| 76 | @noindent | ||
| 77 | (And @var{bar} should contain @code{(provide '@var{bar})}, to make the | ||
| 78 | @code{require} work.) This will cause @var{bar} to be loaded when you | ||
| 79 | byte-compile @var{foo}. Otherwise, you risk compiling @var{foo} without | ||
| 80 | the necessary macro loaded, and that would produce compiled code that | ||
| 81 | won't work right. @xref{Compiling Macros}. | ||
| 82 | |||
| 83 | Using @code{eval-when-compile} avoids loading @var{bar} when | ||
| 84 | the compiled version of @var{foo} is @emph{used}. | ||
| 71 | 85 | ||
| 72 | @item | 86 | @item |
| 73 | If you define a major mode, make sure to run a hook variable using | 87 | If you define a major mode, make sure to run a hook variable using |
| @@ -156,11 +170,6 @@ say which functions are replaced, and how the behavior of the | |||
| 156 | replacements differs from that of the originals. | 170 | replacements differs from that of the originals. |
| 157 | 171 | ||
| 158 | @item | 172 | @item |
| 159 | If a file requires certain standard library programs to be loaded | ||
| 160 | beforehand, then the comments at the beginning of the file should say | ||
| 161 | so. | ||
| 162 | |||
| 163 | @item | ||
| 164 | Please keep the names of your Emacs Lisp source files to 13 characters | 173 | Please keep the names of your Emacs Lisp source files to 13 characters |
| 165 | or less. This way, if the files are compiled, the compiled files' names | 174 | or less. This way, if the files are compiled, the compiled files' names |
| 166 | will be 14 characters or less, which is short enough to fit on all kinds | 175 | will be 14 characters or less, which is short enough to fit on all kinds |
| @@ -212,6 +221,10 @@ Do not use @code{message}, @code{throw}, @code{sleep-for}, | |||
| 212 | or @code{beep} to report errors. | 221 | or @code{beep} to report errors. |
| 213 | 222 | ||
| 214 | @item | 223 | @item |
| 224 | An error message should start with a capital letter but should not end | ||
| 225 | with a period. | ||
| 226 | |||
| 227 | @item | ||
| 215 | Try to avoid using recursive edits. Instead, do what the Rmail @kbd{e} | 228 | Try to avoid using recursive edits. Instead, do what the Rmail @kbd{e} |
| 216 | command does: use a new local keymap that contains one command defined | 229 | command does: use a new local keymap that contains one command defined |
| 217 | to switch back to the old local keymap. Or do what the | 230 | to switch back to the old local keymap. Or do what the |
| @@ -265,10 +278,10 @@ Function calls are slow in Emacs Lisp even when a compiled function | |||
| 265 | is calling another compiled function. | 278 | is calling another compiled function. |
| 266 | 279 | ||
| 267 | @item | 280 | @item |
| 268 | Using the primitive list-searching functions @code{memq}, @code{assq}, or | 281 | Using the primitive list-searching functions @code{memq}, @code{member}, |
| 269 | @code{assoc} is even faster than explicit iteration. It may be worth | 282 | @code{assq}, or @code{assoc} is even faster than explicit iteration. It |
| 270 | rearranging a data structure so that one of these primitive search | 283 | may be worth rearranging a data structure so that one of these primitive |
| 271 | functions can be used. | 284 | search functions can be used. |
| 272 | 285 | ||
| 273 | @item | 286 | @item |
| 274 | Certain built-in functions are handled specially in byte-compiled code, | 287 | Certain built-in functions are handled specially in byte-compiled code, |
| @@ -431,10 +444,6 @@ It is not practical to use @samp{\\[@dots{}]} very many times, because | |||
| 431 | display of the documentation string will become slow. So use this to | 444 | display of the documentation string will become slow. So use this to |
| 432 | describe the most important commands in your major mode, and then use | 445 | describe the most important commands in your major mode, and then use |
| 433 | @samp{\\@{@dots{}@}} to display the rest of the mode's keymap. | 446 | @samp{\\@{@dots{}@}} to display the rest of the mode's keymap. |
| 434 | |||
| 435 | @item | ||
| 436 | Don't use the term ``Elisp'', since that is or was a trademark. | ||
| 437 | Use the term ``Emacs Lisp''. | ||
| 438 | @end itemize | 447 | @end itemize |
| 439 | 448 | ||
| 440 | @node Comment Tips | 449 | @node Comment Tips |
diff --git a/lispref/variables.texi b/lispref/variables.texi index fb08a390c6d..34cd07b6769 100644 --- a/lispref/variables.texi +++ b/lispref/variables.texi | |||
| @@ -231,6 +231,12 @@ Macro calls (@pxref{Macros}). | |||
| 231 | @code{condition-case} (@pxref{Errors}). | 231 | @code{condition-case} (@pxref{Errors}). |
| 232 | @end itemize | 232 | @end itemize |
| 233 | 233 | ||
| 234 | Variables can also have buffer-local bindings (@pxref{Buffer-Local | ||
| 235 | Variables}); a few variables have terminal-local bindings | ||
| 236 | (@pxref{Multiple Displays}). These kinds of bindings work somewhat like | ||
| 237 | ordinary local bindings, but they are localized depending on ``where'' | ||
| 238 | you are in Emacs, rather than localized in time. | ||
| 239 | |||
| 234 | @defvar max-specpdl-size | 240 | @defvar max-specpdl-size |
| 235 | @cindex variable limit error | 241 | @cindex variable limit error |
| 236 | @cindex evaluation error | 242 | @cindex evaluation error |
| @@ -409,6 +415,12 @@ is not even evaluated, and @var{symbol}'s value remains unchanged. If | |||
| 409 | evaluates it and sets @var{symbol} to the result. (If @var{value} is | 415 | evaluates it and sets @var{symbol} to the result. (If @var{value} is |
| 410 | omitted, the value of @var{symbol} is not changed in any case.) | 416 | omitted, the value of @var{symbol} is not changed in any case.) |
| 411 | 417 | ||
| 418 | When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in | ||
| 419 | Emacs Lisp mode (@code{eval-defun}), a special feature of | ||
| 420 | @code{eval-defun} evaluates it as a @code{defconst}. The purpose of | ||
| 421 | this is to make sure the variable's value is reinitialized, when you ask | ||
| 422 | for it specifically. | ||
| 423 | |||
| 412 | If @var{symbol} has a buffer-local binding in the current buffer, | 424 | If @var{symbol} has a buffer-local binding in the current buffer, |
| 413 | @code{defvar} sets the default value, not the local value. | 425 | @code{defvar} sets the default value, not the local value. |
| 414 | @xref{Buffer-Local Variables}. | 426 | @xref{Buffer-Local Variables}. |
| @@ -532,9 +544,9 @@ then the variable is a user option. | |||
| 532 | @end defun | 544 | @end defun |
| 533 | 545 | ||
| 534 | If a user option variable has a @code{variable-interactive} property, | 546 | If a user option variable has a @code{variable-interactive} property, |
| 535 | @code{set-variable} uses that value to control reading the new value for | 547 | the @code{set-variable} command uses that value to control reading the |
| 536 | the variable. The property's value is used as if it were the argument | 548 | new value for the variable. The property's value is used as if it were |
| 537 | to @code{interactive}. | 549 | the argument to @code{interactive}. |
| 538 | 550 | ||
| 539 | @strong{Warning:} If the @code{defconst} and @code{defvar} special | 551 | @strong{Warning:} If the @code{defconst} and @code{defvar} special |
| 540 | forms are used while the variable has a local binding, they set the | 552 | forms are used while the variable has a local binding, they set the |
| @@ -714,7 +726,12 @@ an element to a list if it is not already present in the list. | |||
| 714 | @defun add-to-list symbol element | 726 | @defun add-to-list symbol element |
| 715 | This function sets the variable @var{symbol} by consing @var{element} | 727 | This function sets the variable @var{symbol} by consing @var{element} |
| 716 | onto the old value, if @var{element} is not already a member of that | 728 | onto the old value, if @var{element} is not already a member of that |
| 717 | value. The value of @var{symbol} had better be a list already. | 729 | value. It returns the resulting list, whether updated or not. The |
| 730 | value of @var{symbol} had better be a list already before the call. | ||
| 731 | |||
| 732 | The argument @var{symbol} is not implicitly quoted; @code{add-to-list} | ||
| 733 | is an ordinary function, like @code{set} and unlike @code{setq}. Quote | ||
| 734 | the argument yourself if that is what you want. | ||
| 718 | 735 | ||
| 719 | Here's a scenario showing how to use @code{add-to-list}: | 736 | Here's a scenario showing how to use @code{add-to-list}: |
| 720 | 737 | ||
| @@ -944,6 +961,12 @@ Then you can bind the variable in other programs, knowing reliably what | |||
| 944 | the effect will be. | 961 | the effect will be. |
| 945 | @end itemize | 962 | @end itemize |
| 946 | 963 | ||
| 964 | In either case, you should define the variable with @code{defvar}. | ||
| 965 | This helps other people understand your program by telling them to look | ||
| 966 | for inter-function usage. It also avoids a warning from the byte | ||
| 967 | compiler. Choose the variable's name to avoid name conflicts---don't | ||
| 968 | use short names like @code{x}. | ||
| 969 | |||
| 947 | @node Buffer-Local Variables | 970 | @node Buffer-Local Variables |
| 948 | @section Buffer-Local Variables | 971 | @section Buffer-Local Variables |
| 949 | @cindex variables, buffer-local | 972 | @cindex variables, buffer-local |
| @@ -1027,7 +1050,7 @@ example of what to avoid: | |||
| 1027 | (setq foo 'a) | 1050 | (setq foo 'a) |
| 1028 | (let ((foo 'temp)) | 1051 | (let ((foo 'temp)) |
| 1029 | (set-buffer "b") | 1052 | (set-buffer "b") |
| 1030 | @dots{}) | 1053 | @var{body}@dots{}) |
| 1031 | @group | 1054 | @group |
| 1032 | foo @result{} 'a ; @r{The old buffer-local value from buffer @samp{a}} | 1055 | foo @result{} 'a ; @r{The old buffer-local value from buffer @samp{a}} |
| 1033 | ; @r{is now the default value.} | 1056 | ; @r{is now the default value.} |
| @@ -1107,6 +1130,10 @@ variable does not work. This is because @code{let} does not distinguish | |||
| 1107 | between different kinds of bindings; it knows only which variable the | 1130 | between different kinds of bindings; it knows only which variable the |
| 1108 | binding was made for. | 1131 | binding was made for. |
| 1109 | 1132 | ||
| 1133 | If the variable is terminal-local, this function signals an error. Such | ||
| 1134 | variables cannot have buffer-local bindings as well. @xref{Multiple | ||
| 1135 | Displays}. | ||
| 1136 | |||
| 1110 | @strong{Note:} do not use @code{make-local-variable} for a hook | 1137 | @strong{Note:} do not use @code{make-local-variable} for a hook |
| 1111 | variable. Instead, use @code{make-local-hook}. @xref{Hooks}. | 1138 | variable. Instead, use @code{make-local-hook}. @xref{Hooks}. |
| 1112 | @end deffn | 1139 | @end deffn |
| @@ -1119,6 +1146,12 @@ local to the current buffer at the time. | |||
| 1119 | The value returned is @var{variable}. | 1146 | The value returned is @var{variable}. |
| 1120 | @end deffn | 1147 | @end deffn |
| 1121 | 1148 | ||
| 1149 | @defun local-variable-p variable &optional buffer | ||
| 1150 | This returns @code{t} if @var{variable} is buffer-local in buffer | ||
| 1151 | @var{buffer} (which defaults to the current buffer); otherwise, | ||
| 1152 | @code{nil}. | ||
| 1153 | @end defun | ||
| 1154 | |||
| 1122 | @defun buffer-local-variables &optional buffer | 1155 | @defun buffer-local-variables &optional buffer |
| 1123 | This function returns a list describing the buffer-local variables in | 1156 | This function returns a list describing the buffer-local variables in |
| 1124 | buffer @var{buffer}. It returns an association list (@pxref{Association | 1157 | buffer @var{buffer}. It returns an association list (@pxref{Association |
| @@ -1153,12 +1186,6 @@ Note that storing new values into the @sc{cdr}s of cons cells in this | |||
| 1153 | list does @emph{not} change the local values of the variables. | 1186 | list does @emph{not} change the local values of the variables. |
| 1154 | @end defun | 1187 | @end defun |
| 1155 | 1188 | ||
| 1156 | @defun local-variable-p variable | ||
| 1157 | This returns @code{t} if @var{variable} is buffer-local in the current | ||
| 1158 | buffer. It is much faster to get the answer this way than to examine | ||
| 1159 | the value of @code{buffer-local-variables}. | ||
| 1160 | @end defun | ||
| 1161 | |||
| 1162 | @deffn Command kill-local-variable variable | 1189 | @deffn Command kill-local-variable variable |
| 1163 | This function deletes the buffer-local binding (if any) for | 1190 | This function deletes the buffer-local binding (if any) for |
| 1164 | @var{variable} (a symbol) in the current buffer. As a result, the | 1191 | @var{variable} (a symbol) in the current buffer. As a result, the |
diff --git a/lispref/windows.texi b/lispref/windows.texi index b1dcd2d6e0e..35202827e18 100644 --- a/lispref/windows.texi +++ b/lispref/windows.texi | |||
| @@ -36,25 +36,29 @@ displayed in windows. | |||
| 36 | @cindex window | 36 | @cindex window |
| 37 | @cindex selected window | 37 | @cindex selected window |
| 38 | 38 | ||
| 39 | A @dfn{window} is the physical area of the screen in which a buffer is | 39 | A @dfn{window} in Emacs is the physical area of the screen in which a |
| 40 | displayed. The term is also used to refer to a Lisp object that | 40 | buffer is displayed. The term is also used to refer to a Lisp object that |
| 41 | represents that screen area in Emacs Lisp. It should be | 41 | represents that screen area in Emacs Lisp. It should be |
| 42 | clear from the context which is meant. | 42 | clear from the context which is meant. |
| 43 | 43 | ||
| 44 | There is always at least one window in any frame. In each frame, at | 44 | Emacs groups windows into frames. A frame represents an area of |
| 45 | any time, one and only one window is designated as @dfn{selected within | 45 | screen available for Emacs to use. Each frame always contains at least |
| 46 | the frame}. The frame's cursor appears in that window. There is also | 46 | one window, but you can subdivide it vertically or horizontally into |
| 47 | one selected frame; and the window selected within that frame is | 47 | multiple nonoverlapping Emacs windows. |
| 48 | @dfn{the selected window}. The selected window's buffer is usually the | 48 | |
| 49 | current buffer (except when @code{set-buffer} has been used). | 49 | In each frame, at any time, one and only one window is designated as |
| 50 | @xref{Current Buffer}. | 50 | @dfn{selected within the frame}. The frame's cursor appears in that |
| 51 | 51 | window. At ant time, one frame is the selected frame; and the window | |
| 52 | For practical purposes, a window exists only while it is displayed on the | 52 | selected within that frame is @dfn{the selected window}. The selected |
| 53 | terminal. Once removed from the display, the window is effectively | 53 | window's buffer is usually the current buffer (except when |
| 54 | deleted and should not be used, @emph{even though there may still be | 54 | @code{set-buffer} has been used). @xref{Current Buffer}. |
| 55 | references to it} from other Lisp objects. Restoring a saved window | 55 | |
| 56 | configuration is the only way for a window no longer on the screen to | 56 | For practical purposes, a window exists only while it is displayed in |
| 57 | come back to life. (@xref{Deleting Windows}.) | 57 | a frame. Once removed from the frame, the window is effectively deleted |
| 58 | and should not be used, @emph{even though there may still be references | ||
| 59 | to it} from other Lisp objects. Restoring a saved window configuration | ||
| 60 | is the only way for a window no longer on the screen to come back to | ||
| 61 | life. (@xref{Deleting Windows}.) | ||
| 58 | 62 | ||
| 59 | Each window has the following attributes: | 63 | Each window has the following attributes: |
| 60 | 64 | ||
| @@ -93,17 +97,16 @@ how recently the window was selected | |||
| 93 | @cindex multiple windows | 97 | @cindex multiple windows |
| 94 | Users create multiple windows so they can look at several buffers at | 98 | Users create multiple windows so they can look at several buffers at |
| 95 | once. Lisp libraries use multiple windows for a variety of reasons, but | 99 | once. Lisp libraries use multiple windows for a variety of reasons, but |
| 96 | most often to give different views of the same information. In Rmail, | 100 | most often to display related information. In Rmail, for example, you |
| 97 | for example, you can move through a summary buffer in one window while | 101 | can move through a summary buffer in one window while the other window |
| 98 | the other window shows messages one at a time as they are reached. | 102 | shows messages one at a time as they are reached. |
| 99 | 103 | ||
| 100 | The meaning of ``window'' in Emacs is similar to what it means in the | 104 | The meaning of ``window'' in Emacs is similar to what it means in the |
| 101 | context of general-purpose window systems such as X, but not identical. | 105 | context of general-purpose window systems such as X, but not identical. |
| 102 | The X Window System subdivides the screen into X windows; Emacs uses one | 106 | The X Window System places X windows on the screen; Emacs uses one or |
| 103 | or more X windows, called @dfn{frames} in Emacs terminology, and | 107 | more X windows as frames, and subdivides them into |
| 104 | subdivides each of them into (nonoverlapping) Emacs windows. When you | 108 | Emacs windows. When you use Emacs on a character-only terminal, Emacs |
| 105 | use Emacs on an ordinary display terminal, Emacs subdivides the terminal | 109 | treats the whole terminal screen as one frame. |
| 106 | screen into Emacs windows. | ||
| 107 | 110 | ||
| 108 | @cindex terminal screen | 111 | @cindex terminal screen |
| 109 | @cindex screen of terminal | 112 | @cindex screen of terminal |
| @@ -300,6 +303,9 @@ Count all windows in all existing frames. | |||
| 300 | @item @code{visible} | 303 | @item @code{visible} |
| 301 | Count all windows in all visible frames. | 304 | Count all windows in all visible frames. |
| 302 | 305 | ||
| 306 | @item 0 | ||
| 307 | Count all windows in all visible or iconified frames. | ||
| 308 | |||
| 303 | @item anything else | 309 | @item anything else |
| 304 | Count precisely the windows in the selected frame, and no others. | 310 | Count precisely the windows in the selected frame, and no others. |
| 305 | @end table | 311 | @end table |
| @@ -370,6 +376,8 @@ If it is @code{nil}, operate on the selected frame. | |||
| 370 | If it is @code{t}, operate on all frames. | 376 | If it is @code{t}, operate on all frames. |
| 371 | @item | 377 | @item |
| 372 | If it is @code{visible}, operate on all visible frames. | 378 | If it is @code{visible}, operate on all visible frames. |
| 379 | @item 0 | ||
| 380 | If it is 0, operate on all visible or iconified frames. | ||
| 373 | @item | 381 | @item |
| 374 | If it is a frame, operate on that frame. | 382 | If it is a frame, operate on that frame. |
| 375 | @end itemize | 383 | @end itemize |
| @@ -405,6 +413,14 @@ The return value is @var{window}. | |||
| 405 | @end example | 413 | @end example |
| 406 | @end defun | 414 | @end defun |
| 407 | 415 | ||
| 416 | @defmac save-selected-window forms@dots{} | ||
| 417 | This macro records the selected window, executes @var{forms} | ||
| 418 | in sequence, then restores the earlier selected window. | ||
| 419 | It does not save or restore anything about the sizes, arrangement | ||
| 420 | or contents of windows; therefore, if the @var{forms} change them, | ||
| 421 | the changes are permanent. | ||
| 422 | @end defmac | ||
| 423 | |||
| 408 | @cindex finding windows | 424 | @cindex finding windows |
| 409 | The following functions choose one of the windows on the screen, | 425 | The following functions choose one of the windows on the screen, |
| 410 | offering various criteria for the choice. | 426 | offering various criteria for the choice. |
| @@ -427,6 +443,8 @@ If it is @code{t}, consider windows on all frames. | |||
| 427 | @item | 443 | @item |
| 428 | If it is @code{visible}, consider windows on all visible frames. | 444 | If it is @code{visible}, consider windows on all visible frames. |
| 429 | @item | 445 | @item |
| 446 | If it is 0, consider windows on all visible or iconified frames. | ||
| 447 | @item | ||
| 430 | If it is a frame, consider windows on that frame. | 448 | If it is a frame, consider windows on that frame. |
| 431 | @end itemize | 449 | @end itemize |
| 432 | @end defun | 450 | @end defun |
| @@ -503,6 +521,9 @@ Consider all windows in all existing frames. | |||
| 503 | Consider all windows in all visible frames. (To get useful results, you | 521 | Consider all windows in all visible frames. (To get useful results, you |
| 504 | must ensure @var{window} is in a visible frame.) | 522 | must ensure @var{window} is in a visible frame.) |
| 505 | 523 | ||
| 524 | @item @code{t} | ||
| 525 | Consider all windows in all visible or iconified frames. | ||
| 526 | |||
| 506 | @item anything else | 527 | @item anything else |
| 507 | Consider precisely the windows in @var{window}'s frame, and no others. | 528 | Consider precisely the windows in @var{window}'s frame, and no others. |
| 508 | @end table | 529 | @end table |
| @@ -611,20 +632,12 @@ If it is @code{t}, consider windows on all frames. | |||
| 611 | @item | 632 | @item |
| 612 | If it is @code{visible}, consider windows on all visible frames. | 633 | If it is @code{visible}, consider windows on all visible frames. |
| 613 | @item | 634 | @item |
| 635 | If it is 0, consider windows on all visible or iconified frames. | ||
| 636 | @item | ||
| 614 | If it is a frame, consider windows on that frame. | 637 | If it is a frame, consider windows on that frame. |
| 615 | @end itemize | 638 | @end itemize |
| 616 | @end defun | 639 | @end defun |
| 617 | 640 | ||
| 618 | @deffn Command replace-buffer-in-windows buffer | ||
| 619 | This function replaces @var{buffer} with some other buffer in all | ||
| 620 | windows displaying it. The other buffer used is chosen with | ||
| 621 | @code{other-buffer}. In the usual applications of this function, you | ||
| 622 | don't care which other buffer is used; you just want to make sure that | ||
| 623 | @var{buffer} is no longer displayed. | ||
| 624 | |||
| 625 | This function returns @code{nil}. | ||
| 626 | @end deffn | ||
| 627 | |||
| 628 | @node Displaying Buffers | 641 | @node Displaying Buffers |
| 629 | @section Displaying Buffers in Windows | 642 | @section Displaying Buffers in Windows |
| 630 | @cindex switching to a buffer | 643 | @cindex switching to a buffer |
| @@ -716,12 +729,25 @@ already displayed in the selected window and @var{other-window} is | |||
| 716 | @code{nil}, then the selected window is considered sufficient display | 729 | @code{nil}, then the selected window is considered sufficient display |
| 717 | for @var{buffer-or-name}, so that nothing needs to be done. | 730 | for @var{buffer-or-name}, so that nothing needs to be done. |
| 718 | 731 | ||
| 732 | All the variables that affect @code{display-buffer} affect | ||
| 733 | @code{pop-to-buffer} as well. @xref{Choosing Window}. | ||
| 734 | |||
| 719 | If @var{buffer-or-name} is a string that does not name an existing | 735 | If @var{buffer-or-name} is a string that does not name an existing |
| 720 | buffer, a buffer by that name is created. The major mode for the new | 736 | buffer, a buffer by that name is created. The major mode for the new |
| 721 | buffer is set according to the variable @code{default-major-mode}. | 737 | buffer is set according to the variable @code{default-major-mode}. |
| 722 | @xref{Auto Major Mode}. | 738 | @xref{Auto Major Mode}. |
| 723 | @end defun | 739 | @end defun |
| 724 | 740 | ||
| 741 | @deffn Command replace-buffer-in-windows buffer | ||
| 742 | This function replaces @var{buffer} with some other buffer in all | ||
| 743 | windows displaying it. The other buffer used is chosen with | ||
| 744 | @code{other-buffer}. In the usual applications of this function, you | ||
| 745 | don't care which other buffer is used; you just want to make sure that | ||
| 746 | @var{buffer} is no longer displayed. | ||
| 747 | |||
| 748 | This function returns @code{nil}. | ||
| 749 | @end deffn | ||
| 750 | |||
| 725 | @node Choosing Window | 751 | @node Choosing Window |
| 726 | @section Choosing a Window for Display | 752 | @section Choosing a Window for Display |
| 727 | 753 | ||
| @@ -804,6 +830,13 @@ If the buffer's name is in this list, @code{display-buffer} handles the | |||
| 804 | buffer specially. | 830 | buffer specially. |
| 805 | 831 | ||
| 806 | By default, special display means to give the buffer a dedicated frame. | 832 | By default, special display means to give the buffer a dedicated frame. |
| 833 | |||
| 834 | If an element is a list, instead of a string, then the @sc{car} of the | ||
| 835 | list is the buffer name, and the rest of the list says how to create the | ||
| 836 | frame. There are two possibilities for the rest of the list. It can be | ||
| 837 | an alist, specifying frame parameters, or it can contain a function and | ||
| 838 | arguments to give to it. (The function's first argument is always the | ||
| 839 | buffer to be displayed; the arguments from the list come after that.) | ||
| 807 | @end defvar | 840 | @end defvar |
| 808 | 841 | ||
| 809 | @defvar special-display-regexps | 842 | @defvar special-display-regexps |
| @@ -813,6 +846,10 @@ expressions in this list, @code{display-buffer} handles the buffer | |||
| 813 | specially. | 846 | specially. |
| 814 | 847 | ||
| 815 | By default, special display means to give the buffer a dedicated frame. | 848 | By default, special display means to give the buffer a dedicated frame. |
| 849 | |||
| 850 | If an element is a list, instead of a string, then the @sc{car} of the | ||
| 851 | list is the regular expression, and the rest of the list says how to | ||
| 852 | create the frame. See above, under @code{special-display-buffer-names}. | ||
| 816 | @end defvar | 853 | @end defvar |
| 817 | 854 | ||
| 818 | @defvar special-display-function | 855 | @defvar special-display-function |
| @@ -841,6 +878,20 @@ This variable holds frame parameters for | |||
| 841 | @code{special-display-popup-frame} to use when it creates a frame. | 878 | @code{special-display-popup-frame} to use when it creates a frame. |
| 842 | @end defopt | 879 | @end defopt |
| 843 | 880 | ||
| 881 | @defvar same-window-buffer-names | ||
| 882 | A list of buffer names for buffers that should be displayed in the | ||
| 883 | selected window. If the buffer's name is in this list, | ||
| 884 | @code{display-buffer} handles the buffer by switching to it in the | ||
| 885 | selected window. | ||
| 886 | @end defvar | ||
| 887 | |||
| 888 | @defvar same-window-regexps | ||
| 889 | A list of regular expressions that specify buffers that should be | ||
| 890 | displayed in the selected window. If the buffer's name matches any of | ||
| 891 | the regular expressions in this list, @code{display-buffer} handles the | ||
| 892 | buffer by switching to it in the selected window. | ||
| 893 | @end defvar | ||
| 894 | |||
| 844 | @c Emacs 19 feature | 895 | @c Emacs 19 feature |
| 845 | @defvar display-buffer-function | 896 | @defvar display-buffer-function |
| 846 | This variable is the most flexible way to customize the behavior of | 897 | This variable is the most flexible way to customize the behavior of |
| @@ -1125,10 +1176,6 @@ This function scrolls the text in another window upward @var{count} | |||
| 1125 | lines. Negative values of @var{count}, or @code{nil}, are handled | 1176 | lines. Negative values of @var{count}, or @code{nil}, are handled |
| 1126 | as in @code{scroll-up}. | 1177 | as in @code{scroll-up}. |
| 1127 | 1178 | ||
| 1128 | The window that is scrolled is normally the one following the selected | ||
| 1129 | window in the cyclic ordering of windows---the window that | ||
| 1130 | @code{next-window} would return. @xref{Cyclic Window Ordering}. | ||
| 1131 | |||
| 1132 | You can specify a buffer to scroll with the variable | 1179 | You can specify a buffer to scroll with the variable |
| 1133 | @code{other-window-scroll-buffer}. When the selected window is the | 1180 | @code{other-window-scroll-buffer}. When the selected window is the |
| 1134 | minibuffer, the next window is normally the one at the top left corner. | 1181 | minibuffer, the next window is normally the one at the top left corner. |
| @@ -1539,6 +1586,11 @@ comparing the old size data with the new. | |||
| 1539 | Creating or deleting windows counts as a size change, and therefore | 1586 | Creating or deleting windows counts as a size change, and therefore |
| 1540 | causes these functions to be called. Changing the frame size also | 1587 | causes these functions to be called. Changing the frame size also |
| 1541 | counts, because it changes the sizes of the existing windows. | 1588 | counts, because it changes the sizes of the existing windows. |
| 1589 | |||
| 1590 | It is not a good idea to use @code{save-window-excursion} in these | ||
| 1591 | functions, because that always counts as a size change, and it would | ||
| 1592 | cause these functions to be called over and over. In most cases, | ||
| 1593 | @code{save-selected-window} is what you need here. | ||
| 1542 | @end defvar | 1594 | @end defvar |
| 1543 | 1595 | ||
| 1544 | @node Coordinates and Windows | 1596 | @node Coordinates and Windows |
| @@ -1627,6 +1679,11 @@ buffers to the state specified by @var{configuration}. The argument | |||
| 1627 | @var{configuration} must be a value that was previously returned by | 1679 | @var{configuration} must be a value that was previously returned by |
| 1628 | @code{current-window-configuration}. | 1680 | @code{current-window-configuration}. |
| 1629 | 1681 | ||
| 1682 | This function always counts as a window size change and triggers | ||
| 1683 | execution of the @code{window-size-change-functions}. (It doesn't know | ||
| 1684 | how to tell whether the new configuration actually differs from the old | ||
| 1685 | one.) | ||
| 1686 | |||
| 1630 | Here is a way of using this function to get the same effect | 1687 | Here is a way of using this function to get the same effect |
| 1631 | as @code{save-window-excursion}: | 1688 | as @code{save-window-excursion}: |
| 1632 | 1689 | ||
| @@ -1649,6 +1706,13 @@ that is visible. It also includes the choice of selected window. | |||
| 1649 | However, it does not include the value of point in the current buffer; | 1706 | However, it does not include the value of point in the current buffer; |
| 1650 | use @code{save-excursion} if you wish to preserve that. | 1707 | use @code{save-excursion} if you wish to preserve that. |
| 1651 | 1708 | ||
| 1709 | Don't use this construct when @code{save-selected-window} is all you need. | ||
| 1710 | |||
| 1711 | Exit from @code{save-window-excursion} always triggers execution of the | ||
| 1712 | @code{window-size-change-functions}. (It doesn't know how to tell | ||
| 1713 | whether the restored configuration actually differs from the one in | ||
| 1714 | effect at the end of the @var{forms}.) | ||
| 1715 | |||
| 1652 | The return value is the value of the final form in @var{forms}. | 1716 | The return value is the value of the final form in @var{forms}. |
| 1653 | For example: | 1717 | For example: |
| 1654 | 1718 | ||