diff options
| author | Karl Heuer | 1995-06-05 12:23:13 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-05 12:23:13 +0000 |
| commit | 22697dac66806b67eca956ad8cf8907b16d750b4 (patch) | |
| tree | 57a28d25543669c66512a7fd1977eea4973115c4 | |
| parent | a8a818c00e9cc73259aa3c519ba5fc34741c11ab (diff) | |
| download | emacs-22697dac66806b67eca956ad8cf8907b16d750b4.tar.gz emacs-22697dac66806b67eca956ad8cf8907b16d750b4.zip | |
*** empty log message ***
| -rw-r--r-- | lispref/buffers.texi | 307 | ||||
| -rw-r--r-- | lispref/calendar.texi | 10 | ||||
| -rw-r--r-- | lispref/commands.texi | 44 | ||||
| -rw-r--r-- | lispref/compile.texi | 129 | ||||
| -rw-r--r-- | lispref/debugging.texi | 4 | ||||
| -rw-r--r-- | lispref/display.texi | 201 | ||||
| -rw-r--r-- | lispref/elisp.texi | 27 | ||||
| -rw-r--r-- | lispref/eval.texi | 4 | ||||
| -rw-r--r-- | lispref/files.texi | 144 | ||||
| -rw-r--r-- | lispref/frames.texi | 335 | ||||
| -rw-r--r-- | lispref/keymaps.texi | 27 | ||||
| -rw-r--r-- | lispref/lists.texi | 46 | ||||
| -rw-r--r-- | lispref/loading.texi | 14 | ||||
| -rw-r--r-- | lispref/macros.texi | 66 | ||||
| -rw-r--r-- | lispref/minibuf.texi | 20 | ||||
| -rw-r--r-- | lispref/modes.texi | 74 | ||||
| -rw-r--r-- | lispref/numbers.texi | 23 | ||||
| -rw-r--r-- | lispref/objects.texi | 63 | ||||
| -rw-r--r-- | lispref/os.texi | 216 | ||||
| -rw-r--r-- | lispref/processes.texi | 88 | ||||
| -rw-r--r-- | lispref/searching.texi | 157 | ||||
| -rw-r--r-- | lispref/sequences.texi | 11 | ||||
| -rw-r--r-- | lispref/strings.texi | 12 | ||||
| -rw-r--r-- | lispref/symbols.texi | 63 | ||||
| -rw-r--r-- | lispref/text.texi | 222 | ||||
| -rw-r--r-- | lispref/variables.texi | 46 | ||||
| -rw-r--r-- | lispref/windows.texi | 27 |
27 files changed, 1914 insertions, 466 deletions
diff --git a/lispref/buffers.texi b/lispref/buffers.texi index 4ce4c4c2037..bfa8f020c62 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi | |||
| @@ -17,6 +17,8 @@ not be displayed in any windows. | |||
| 17 | 17 | ||
| 18 | @menu | 18 | @menu |
| 19 | * Buffer Basics:: What is a buffer? | 19 | * Buffer Basics:: What is a buffer? |
| 20 | * Current Buffer:: Designating a buffer as current | ||
| 21 | so primitives will access its contents. | ||
| 20 | * Buffer Names:: Accessing and changing buffer names. | 22 | * Buffer Names:: Accessing and changing buffer names. |
| 21 | * Buffer File Name:: The buffer file name indicates which file is visited. | 23 | * Buffer File Name:: The buffer file name indicates which file is visited. |
| 22 | * Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved. | 24 | * Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved. |
| @@ -26,8 +28,7 @@ not be displayed in any windows. | |||
| 26 | * The Buffer List:: How to look at all the existing buffers. | 28 | * The Buffer List:: How to look at all the existing buffers. |
| 27 | * Creating Buffers:: Functions that create buffers. | 29 | * Creating Buffers:: Functions that create buffers. |
| 28 | * Killing Buffers:: Buffers exist until explicitly killed. | 30 | * Killing Buffers:: Buffers exist until explicitly killed. |
| 29 | * Current Buffer:: Designating a buffer as current | 31 | * Indirect Buffers:: An indirect buffer shares text with some other buffer. |
| 30 | so primitives will access its contents. | ||
| 31 | @end menu | 32 | @end menu |
| 32 | 33 | ||
| 33 | @node Buffer Basics | 34 | @node Buffer Basics |
| @@ -75,6 +76,130 @@ This function returns @code{t} if @var{object} is a buffer, | |||
| 75 | @code{nil} otherwise. | 76 | @code{nil} otherwise. |
| 76 | @end defun | 77 | @end defun |
| 77 | 78 | ||
| 79 | @node Current Buffer | ||
| 80 | @section The Current Buffer | ||
| 81 | @cindex selecting a buffer | ||
| 82 | @cindex changing to another buffer | ||
| 83 | @cindex current buffer | ||
| 84 | |||
| 85 | There are, in general, many buffers in an Emacs session. At any time, | ||
| 86 | one of them is designated as the @dfn{current buffer}. This is the | ||
| 87 | buffer in which most editing takes place, because most of the primitives | ||
| 88 | for examining or changing text in a buffer operate implicitly on the | ||
| 89 | current buffer (@pxref{Text}). Normally the buffer that is displayed on | ||
| 90 | the screen in the selected window is the current buffer, but this is not | ||
| 91 | always so: a Lisp program can designate any buffer as current | ||
| 92 | temporarily in order to operate on its contents, without changing what | ||
| 93 | is displayed on the screen. | ||
| 94 | |||
| 95 | The way to designate a current buffer in a Lisp program is by calling | ||
| 96 | @code{set-buffer}. The specified buffer remains current until a new one | ||
| 97 | is designated. | ||
| 98 | |||
| 99 | When an editing command returns to the editor command loop, the | ||
| 100 | command loop designates the buffer displayed in the selected window as | ||
| 101 | current, to prevent confusion: the buffer that the cursor is in when | ||
| 102 | Emacs reads a command is the buffer that the command will apply to. | ||
| 103 | (@xref{Command Loop}.) Therefore, @code{set-buffer} is not the way to | ||
| 104 | switch visibly to a different buffer so that the user can edit it. For | ||
| 105 | this, you must use the functions described in @ref{Displaying Buffers}. | ||
| 106 | |||
| 107 | However, Lisp functions that change to a different current buffer | ||
| 108 | should not depend on the command loop to set it back afterwards. | ||
| 109 | Editing commands written in Emacs Lisp can be called from other programs | ||
| 110 | as well as from the command loop. It is convenient for the caller if | ||
| 111 | the subroutine does not change which buffer is current (unless, of | ||
| 112 | course, that is the subroutine's purpose). Therefore, you should | ||
| 113 | normally use @code{set-buffer} within a @code{save-excursion} that will | ||
| 114 | restore the current buffer when your function is done | ||
| 115 | (@pxref{Excursions}). Here is an example, the code for the command | ||
| 116 | @code{append-to-buffer} (with the documentation string abridged): | ||
| 117 | |||
| 118 | @example | ||
| 119 | @group | ||
| 120 | (defun append-to-buffer (buffer start end) | ||
| 121 | "Append to specified buffer the text of the region. | ||
| 122 | @dots{}" | ||
| 123 | (interactive "BAppend to buffer: \nr") | ||
| 124 | (let ((oldbuf (current-buffer))) | ||
| 125 | (save-excursion | ||
| 126 | (set-buffer (get-buffer-create buffer)) | ||
| 127 | (insert-buffer-substring oldbuf start end)))) | ||
| 128 | @end group | ||
| 129 | @end example | ||
| 130 | |||
| 131 | @noindent | ||
| 132 | This function binds a local variable to the current buffer, and then | ||
| 133 | @code{save-excursion} records the values of point, the mark, and the | ||
| 134 | original buffer. Next, @code{set-buffer} makes another buffer current. | ||
| 135 | Finally, @code{insert-buffer-substring} copies the string from the | ||
| 136 | original current buffer to the new current buffer. | ||
| 137 | |||
| 138 | If the buffer appended to happens to be displayed in some window, | ||
| 139 | the next redisplay will show how its text has changed. Otherwise, you | ||
| 140 | will not see the change immediately on the screen. The buffer becomes | ||
| 141 | current temporarily during the execution of the command, but this does | ||
| 142 | not cause it to be displayed. | ||
| 143 | |||
| 144 | If you make local bindings (with @code{let} or function arguments) for | ||
| 145 | a variable that may also have buffer-local bindings, make sure that the | ||
| 146 | same buffer is current at the beginning and at the end of the local | ||
| 147 | binding's scope. Otherwise you might bind it in one buffer and unbind | ||
| 148 | it in another! There are two ways to do this. In simple cases, you may | ||
| 149 | see that nothing ever changes the current buffer within the scope of the | ||
| 150 | binding. Otherwise, use @code{save-excursion} to make sure that the | ||
| 151 | buffer current at the beginning is current again whenever the variable | ||
| 152 | is unbound. | ||
| 153 | |||
| 154 | It is not reliable to change the current buffer back with | ||
| 155 | @code{set-buffer}, because that won't do the job if a quit happens while | ||
| 156 | the wrong buffer is current. Here is what @emph{not} to do: | ||
| 157 | |||
| 158 | @example | ||
| 159 | @group | ||
| 160 | (let (buffer-read-only | ||
| 161 | (obuf (current-buffer))) | ||
| 162 | (set-buffer @dots{}) | ||
| 163 | @dots{} | ||
| 164 | (set-buffer obuf)) | ||
| 165 | @end group | ||
| 166 | @end example | ||
| 167 | |||
| 168 | @noindent | ||
| 169 | Using @code{save-excursion}, as shown below, handles quitting, errors, | ||
| 170 | and @code{throw}, as well as ordinary evaluation. | ||
| 171 | |||
| 172 | @example | ||
| 173 | @group | ||
| 174 | (let (buffer-read-only) | ||
| 175 | (save-excursion | ||
| 176 | (set-buffer @dots{}) | ||
| 177 | @dots{})) | ||
| 178 | @end group | ||
| 179 | @end example | ||
| 180 | |||
| 181 | @defun current-buffer | ||
| 182 | This function returns the current buffer. | ||
| 183 | |||
| 184 | @example | ||
| 185 | @group | ||
| 186 | (current-buffer) | ||
| 187 | @result{} #<buffer buffers.texi> | ||
| 188 | @end group | ||
| 189 | @end example | ||
| 190 | @end defun | ||
| 191 | |||
| 192 | @defun set-buffer buffer-or-name | ||
| 193 | This function makes @var{buffer-or-name} the current buffer. It does | ||
| 194 | not display the buffer in the currently selected window or in any other | ||
| 195 | window, so the user cannot necessarily see the buffer. But Lisp | ||
| 196 | programs can in any case work on it. | ||
| 197 | |||
| 198 | This function returns the buffer identified by @var{buffer-or-name}. | ||
| 199 | An error is signaled if @var{buffer-or-name} does not identify an | ||
| 200 | existing buffer. | ||
| 201 | @end defun | ||
| 202 | |||
| 78 | @node Buffer Names | 203 | @node Buffer Names |
| 79 | @section Buffer Names | 204 | @section Buffer Names |
| 80 | @cindex buffer names | 205 | @cindex buffer names |
| @@ -533,6 +658,12 @@ If @var{buffer-or-name} is not supplied (or if it is not a buffer), | |||
| 533 | then @code{other-buffer} returns the first buffer on the buffer list | 658 | then @code{other-buffer} returns the first buffer on the buffer list |
| 534 | that is not visible in any window in a visible frame. | 659 | that is not visible in any window in a visible frame. |
| 535 | 660 | ||
| 661 | If the selected frame has a non-@code{nil} @code{buffer-predicate} | ||
| 662 | parameter, then @code{other-buffer} uses that predicate to decide which | ||
| 663 | buffers to consider. It calls the predicate once for each buffer, and | ||
| 664 | if the value is @code{nil}, that buffer is ignored. @xref{X Frame | ||
| 665 | Parameters}. | ||
| 666 | |||
| 536 | @c Emacs 19 feature | 667 | @c Emacs 19 feature |
| 537 | If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning | 668 | If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning |
| 538 | a buffer visible in any window on any visible frame, except as a last | 669 | a buffer visible in any window on any visible frame, except as a last |
| @@ -589,8 +720,9 @@ An error is signaled if @var{name} is not a string. | |||
| 589 | @end group | 720 | @end group |
| 590 | @end example | 721 | @end example |
| 591 | 722 | ||
| 592 | The major mode for the new buffer is set according to the variable | 723 | The major mode for the new buffer is set to Fundamental mode. The |
| 593 | @code{default-major-mode}. @xref{Auto Major Mode}. | 724 | variable @code{default-major-mode} is handled at a higher level. |
| 725 | @xref{Auto Major Mode}. | ||
| 594 | @end defun | 726 | @end defun |
| 595 | 727 | ||
| 596 | @defun generate-new-buffer name | 728 | @defun generate-new-buffer name |
| @@ -618,8 +750,9 @@ An error is signaled if @var{name} is not a string. | |||
| 618 | @end group | 750 | @end group |
| 619 | @end example | 751 | @end example |
| 620 | 752 | ||
| 621 | The major mode for the new buffer is set by the value of | 753 | The major mode for the new buffer is set to Fundamental mode. The |
| 622 | @code{default-major-mode}. @xref{Auto Major Mode}. | 754 | variable @code{default-major-mode} is handled at a higher level. |
| 755 | @xref{Auto Major Mode}. | ||
| 623 | 756 | ||
| 624 | See the related function @code{generate-new-buffer-name} in @ref{Buffer | 757 | See the related function @code{generate-new-buffer-name} in @ref{Buffer |
| 625 | Names}. | 758 | Names}. |
| @@ -713,126 +846,48 @@ variable @code{buffer-offer-save} automatically becomes buffer-local | |||
| 713 | when set for any reason. @xref{Buffer-Local Variables}. | 846 | when set for any reason. @xref{Buffer-Local Variables}. |
| 714 | @end defvar | 847 | @end defvar |
| 715 | 848 | ||
| 716 | @node Current Buffer | 849 | @node Indirect Buffers |
| 717 | @section The Current Buffer | 850 | @section Indirect Buffers |
| 718 | @cindex selecting a buffer | 851 | @cindex indirect buffers |
| 719 | @cindex changing to another buffer | 852 | @cindex base buffer |
| 720 | @cindex current buffer | 853 | |
| 721 | 854 | An @dfn{indirect buffer} shares the text of some other buffer, which | |
| 722 | There are, in general, many buffers in an Emacs session. At any time, | 855 | is called the @dfn{base buffer} of the indirect buffer. In some ways it |
| 723 | one of them is designated as the @dfn{current buffer}. This is the | 856 | is the equivalent, for buffers, of a symbolic link among files. The base |
| 724 | buffer in which most editing takes place, because most of the primitives | 857 | buffer may not itself be an indirect buffer. |
| 725 | for examining or changing text in a buffer operate implicitly on the | 858 | |
| 726 | current buffer (@pxref{Text}). Normally the buffer that is displayed on | 859 | The text of the indirect buffer is always identical to the text of its |
| 727 | the screen in the selected window is the current buffer, but this is not | 860 | base buffer; changes made by editing either one are visible immediately |
| 728 | always so: a Lisp program can designate any buffer as current | 861 | in the other. This includes the text properties as well as the characters |
| 729 | temporarily in order to operate on its contents, without changing what | 862 | themselves. |
| 730 | is displayed on the screen. | 863 | |
| 731 | 864 | But in all other respects, the indirect buffer and its base buffer are | |
| 732 | The way to designate a current buffer in a Lisp program is by calling | 865 | completely separate. They have different names, different values of |
| 733 | @code{set-buffer}. The specified buffer remains current until a new one | 866 | point, different narrowing, different markers and overlays (though |
| 734 | is designated. | 867 | inserting or deleting text in either buffer relocates the markers and |
| 735 | 868 | overlays for both), different major modes, and different local | |
| 736 | When an editing command returns to the editor command loop, the | 869 | variables. |
| 737 | command loop designates the buffer displayed in the selected window as | 870 | |
| 738 | current, to prevent confusion: the buffer that the cursor is in when | 871 | An indirect buffer cannot visit a file, but its base buffer can. If |
| 739 | Emacs reads a command is the buffer that the command will apply to. | 872 | you try to save the indirect buffer, that actually works by saving the |
| 740 | (@xref{Command Loop}.) Therefore, @code{set-buffer} is not the way to | 873 | base buffer. |
| 741 | switch visibly to a different buffer so that the user can edit it. For | 874 | |
| 742 | this, you must use the functions described in @ref{Displaying Buffers}. | 875 | Killing an indirect buffer has no effect on its base buffer. Killing |
| 743 | 876 | the base buffer effectively kills the indirect buffer in that it cannot | |
| 744 | However, Lisp functions that change to a different current buffer | 877 | ever again be the current buffer. |
| 745 | should not depend on the command loop to set it back afterwards. | 878 | |
| 746 | Editing commands written in Emacs Lisp can be called from other programs | 879 | @deffn Command make-indirect-buffer base-buffer name |
| 747 | as well as from the command loop. It is convenient for the caller if | 880 | This creates an indirect buffer named @var{name} whose base buffer |
| 748 | the subroutine does not change which buffer is current (unless, of | 881 | is @var{base-buffer}. The argument @var{base-buffer} may be a buffer |
| 749 | course, that is the subroutine's purpose). Therefore, you should | 882 | or a string. |
| 750 | normally use @code{set-buffer} within a @code{save-excursion} that will | 883 | |
| 751 | restore the current buffer when your function is done | 884 | If @var{base-buffer} is an indirect buffer, its base buffer is used as |
| 752 | (@pxref{Excursions}). Here is an example, the code for the command | 885 | the base for the new buffer. |
| 753 | @code{append-to-buffer} (with the documentation string abridged): | 886 | @end deffn |
| 754 | |||
| 755 | @example | ||
| 756 | @group | ||
| 757 | (defun append-to-buffer (buffer start end) | ||
| 758 | "Append to specified buffer the text of the region. | ||
| 759 | @dots{}" | ||
| 760 | (interactive "BAppend to buffer: \nr") | ||
| 761 | (let ((oldbuf (current-buffer))) | ||
| 762 | (save-excursion | ||
| 763 | (set-buffer (get-buffer-create buffer)) | ||
| 764 | (insert-buffer-substring oldbuf start end)))) | ||
| 765 | @end group | ||
| 766 | @end example | ||
| 767 | |||
| 768 | @noindent | ||
| 769 | This function binds a local variable to the current buffer, and then | ||
| 770 | @code{save-excursion} records the values of point, the mark, and the | ||
| 771 | original buffer. Next, @code{set-buffer} makes another buffer current. | ||
| 772 | Finally, @code{insert-buffer-substring} copies the string from the | ||
| 773 | original current buffer to the new current buffer. | ||
| 774 | |||
| 775 | If the buffer appended to happens to be displayed in some window, | ||
| 776 | the next redisplay will show how its text has changed. Otherwise, you | ||
| 777 | will not see the change immediately on the screen. The buffer becomes | ||
| 778 | current temporarily during the execution of the command, but this does | ||
| 779 | not cause it to be displayed. | ||
| 780 | |||
| 781 | If you make local bindings (with @code{let} or function arguments) for | ||
| 782 | a variable that may also have buffer-local bindings, make sure that the | ||
| 783 | same buffer is current at the beginning and at the end of the local | ||
| 784 | binding's scope. Otherwise you might bind it in one buffer and unbind | ||
| 785 | it in another! There are two ways to do this. In simple cases, you may | ||
| 786 | see that nothing ever changes the current buffer within the scope of the | ||
| 787 | binding. Otherwise, use @code{save-excursion} to make sure that the | ||
| 788 | buffer current at the beginning is current again whenever the variable | ||
| 789 | is unbound. | ||
| 790 | |||
| 791 | It is not reliable to change the current buffer back with | ||
| 792 | @code{set-buffer}, because that won't do the job if a quit happens while | ||
| 793 | the wrong buffer is current. Here is what @emph{not} to do: | ||
| 794 | |||
| 795 | @example | ||
| 796 | @group | ||
| 797 | (let (buffer-read-only | ||
| 798 | (obuf (current-buffer))) | ||
| 799 | (set-buffer @dots{}) | ||
| 800 | @dots{} | ||
| 801 | (set-buffer obuf)) | ||
| 802 | @end group | ||
| 803 | @end example | ||
| 804 | |||
| 805 | @noindent | ||
| 806 | Using @code{save-excursion}, as shown below, handles quitting, errors, | ||
| 807 | and @code{throw}, as well as ordinary evaluation. | ||
| 808 | |||
| 809 | @example | ||
| 810 | @group | ||
| 811 | (let (buffer-read-only) | ||
| 812 | (save-excursion | ||
| 813 | (set-buffer @dots{}) | ||
| 814 | @dots{})) | ||
| 815 | @end group | ||
| 816 | @end example | ||
| 817 | |||
| 818 | @defun current-buffer | ||
| 819 | This function returns the current buffer. | ||
| 820 | 887 | ||
| 821 | @example | 888 | @defun buffer-base-buffer buffer |
| 822 | @group | 889 | This function returns the base buffer of @var{buffer}. If @var{buffer} |
| 823 | (current-buffer) | 890 | is not indirect, the value is @code{nil}. Otherwise, the value is |
| 824 | @result{} #<buffer buffers.texi> | 891 | another buffer, which is never an indirect buffer. |
| 825 | @end group | ||
| 826 | @end example | ||
| 827 | @end defun | 892 | @end defun |
| 828 | 893 | ||
| 829 | @defun set-buffer buffer-or-name | ||
| 830 | This function makes @var{buffer-or-name} the current buffer. It does | ||
| 831 | not display the buffer in the currently selected window or in any other | ||
| 832 | window, so the user cannot necessarily see the buffer. But Lisp | ||
| 833 | programs can in any case work on it. | ||
| 834 | |||
| 835 | This function returns the buffer identified by @var{buffer-or-name}. | ||
| 836 | An error is signaled if @var{buffer-or-name} does not identify an | ||
| 837 | existing buffer. | ||
| 838 | @end defun | ||
diff --git a/lispref/calendar.texi b/lispref/calendar.texi index 5f49a5128e2..8e42a530f25 100644 --- a/lispref/calendar.texi +++ b/lispref/calendar.texi | |||
| @@ -66,7 +66,10 @@ asterisk (@samp{*}). | |||
| 66 | date as being a holiday. Its value may be a character to insert next to | 66 | date as being a holiday. Its value may be a character to insert next to |
| 67 | the date, or a face name to use for displaying the date. Likewise, the | 67 | the date, or a face name to use for displaying the date. Likewise, the |
| 68 | variable @code{diary-entry-marker} specifies how to mark a date that has | 68 | variable @code{diary-entry-marker} specifies how to mark a date that has |
| 69 | diary entries. | 69 | diary entries. The calendar creates faces named @code{holiday-face} and |
| 70 | @code{diary-face} for these purposes; those symbols are the default | ||
| 71 | values of these variables, when Emacs supports multiple faces on your | ||
| 72 | terminal. | ||
| 70 | 73 | ||
| 71 | @vindex calendar-load-hook | 74 | @vindex calendar-load-hook |
| 72 | The variable @code{calendar-load-hook} is a normal hook run when the | 75 | The variable @code{calendar-load-hook} is a normal hook run when the |
| @@ -104,7 +107,10 @@ changing its face or by adding an asterisk. Here's how to use it: | |||
| 104 | @vindex calendar-today-marker | 107 | @vindex calendar-today-marker |
| 105 | The variable @code{calendar-today-marker} specifies how to mark today's | 108 | The variable @code{calendar-today-marker} specifies how to mark today's |
| 106 | date. Its value should be a character to insert next to the date or a | 109 | date. Its value should be a character to insert next to the date or a |
| 107 | face name to use for displaying the date. | 110 | face name to use for displaying the date. A face named |
| 111 | @code{calendar-today-face} is provided for this purpose; that symbol is | ||
| 112 | the default for this variable when Emacs supports multiple faces on your | ||
| 113 | terminal. | ||
| 108 | 114 | ||
| 109 | @vindex today-invisible-calendar-hook | 115 | @vindex today-invisible-calendar-hook |
| 110 | @noindent | 116 | @noindent |
diff --git a/lispref/commands.texi b/lispref/commands.texi index e95b5599ad3..aa7ad7d2852 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -370,6 +370,12 @@ The cursor does not move into the echo area. Prompt. | |||
| 370 | This kind of input is used by commands such as @code{describe-key} and | 370 | This kind of input is used by commands such as @code{describe-key} and |
| 371 | @code{global-set-key}. | 371 | @code{global-set-key}. |
| 372 | 372 | ||
| 373 | @item K | ||
| 374 | A key sequence, whose definition you intend to change. This works like | ||
| 375 | @samp{k}, except that it suppresses, for the last input event in the key | ||
| 376 | sequence, the conversions that are normally used (when necessary) to | ||
| 377 | convert an undefined key into a defined one. | ||
| 378 | |||
| 373 | @item m | 379 | @item m |
| 374 | @cindex marker argument | 380 | @cindex marker argument |
| 375 | The position of the mark, as an integer. No I/O. | 381 | The position of the mark, as an integer. No I/O. |
| @@ -766,6 +772,7 @@ This function returns non-@code{nil} if @var{event} is an input event. | |||
| 766 | * Repeat Events:: Double and triple click (or drag, or down). | 772 | * Repeat Events:: Double and triple click (or drag, or down). |
| 767 | * Motion Events:: Just moving the mouse, not pushing a button. | 773 | * Motion Events:: Just moving the mouse, not pushing a button. |
| 768 | * Focus Events:: Moving the mouse between frames. | 774 | * Focus Events:: Moving the mouse between frames. |
| 775 | * Misc Events:: Other events window systems can generate. | ||
| 769 | * Event Examples:: Examples of the lists for mouse events. | 776 | * Event Examples:: Examples of the lists for mouse events. |
| 770 | * Classifying Events:: Finding the modifier keys in an event symbol. | 777 | * Classifying Events:: Finding the modifier keys in an event symbol. |
| 771 | Event types. | 778 | Event types. |
| @@ -1223,6 +1230,34 @@ sequence---that is, after a prefix key---then Emacs reorders the events | |||
| 1223 | so that the focus event comes either before or after the multi-event key | 1230 | so that the focus event comes either before or after the multi-event key |
| 1224 | sequence, and not within it. | 1231 | sequence, and not within it. |
| 1225 | 1232 | ||
| 1233 | @node Misc Events | ||
| 1234 | @subsection Miscellaneous Window System Events | ||
| 1235 | |||
| 1236 | A few other event types represent occurrences within the window system. | ||
| 1237 | |||
| 1238 | @table @code | ||
| 1239 | @cindex @code{delete-frame} event | ||
| 1240 | @item (delete-frame (@var{frame})) | ||
| 1241 | This kind of event indicates that the user gave the window manager | ||
| 1242 | a command to delete a particular window, which happens to be an Emacs frame. | ||
| 1243 | |||
| 1244 | The standard definition of the @code{delete-frame} event is to delete @var{frame}. | ||
| 1245 | |||
| 1246 | @cindex @code{iconify-frame} event | ||
| 1247 | @item (iconify-frame (@var{frame})) | ||
| 1248 | This kind of event indicates that the user iconified @var{frame} using | ||
| 1249 | the window manager. Its standard definition is @code{ignore}; since | ||
| 1250 | the frame has already been iconified, Emacs has no work to do. | ||
| 1251 | The purpose of this event type is so that you can keep track of such | ||
| 1252 | events if you want to. | ||
| 1253 | |||
| 1254 | @cindex @code{deiconify-frame} event | ||
| 1255 | @item (deiconify-frame (@var{frame})) | ||
| 1256 | This kind of event indicates that the user deiconified @var{frame} using | ||
| 1257 | the window manager. Its standard definition is @code{ignore}; since the | ||
| 1258 | frame has already been iconified, Emacs has no work to do. | ||
| 1259 | @end table | ||
| 1260 | |||
| 1226 | @node Event Examples | 1261 | @node Event Examples |
| 1227 | @subsection Event Examples | 1262 | @subsection Event Examples |
| 1228 | 1263 | ||
| @@ -1835,6 +1870,9 @@ If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not | |||
| 1835 | redisplay, but it still returns as soon as input is available (or when | 1870 | redisplay, but it still returns as soon as input is available (or when |
| 1836 | the timeout elapses). | 1871 | the timeout elapses). |
| 1837 | 1872 | ||
| 1873 | Iconifying or deiconifying a frame makes @code{sit-for} return, because | ||
| 1874 | that generates an event. @xref{Misc Events}. | ||
| 1875 | |||
| 1838 | The usual purpose of @code{sit-for} is to give the user time to read | 1876 | The usual purpose of @code{sit-for} is to give the user time to read |
| 1839 | text that you display. | 1877 | text that you display. |
| 1840 | @end defun | 1878 | @end defun |
| @@ -2339,6 +2377,9 @@ encounters an error or a failing search. | |||
| 2339 | @defvar last-kbd-macro | 2377 | @defvar last-kbd-macro |
| 2340 | This variable is the definition of the most recently defined keyboard | 2378 | This variable is the definition of the most recently defined keyboard |
| 2341 | macro. Its value is a string or vector, or @code{nil}. | 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}. | ||
| 2342 | @end defvar | 2383 | @end defvar |
| 2343 | 2384 | ||
| 2344 | @defvar executing-macro | 2385 | @defvar executing-macro |
| @@ -2354,5 +2395,8 @@ This variable indicates whether a keyboard macro is being defined. A | |||
| 2354 | command can test this variable to behave differently while a macro is | 2395 | command can test this variable to behave differently while a macro is |
| 2355 | being defined. The commands @code{start-kbd-macro} and | 2396 | being defined. The commands @code{start-kbd-macro} and |
| 2356 | @code{end-kbd-macro} set this variable---do not set it yourself. | 2397 | @code{end-kbd-macro} set this variable---do not set it yourself. |
| 2398 | |||
| 2399 | The variable is always local to the current X terminal and cannot be | ||
| 2400 | buffer-local. @xref{Multiple Displays}. | ||
| 2357 | @end defvar | 2401 | @end defvar |
| 2358 | 2402 | ||
diff --git a/lispref/compile.texi b/lispref/compile.texi index 69b328fd905..413adc085a3 100644 --- a/lispref/compile.texi +++ b/lispref/compile.texi | |||
| @@ -22,8 +22,8 @@ however, as fast as true compiled code. | |||
| 22 | 22 | ||
| 23 | In general, any version of Emacs can run byte-compiled code produced | 23 | In general, any version of Emacs can run byte-compiled code produced |
| 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 18, you can run the | 25 | particular, if you compile a program with Emacs 19.29, the compiled |
| 26 | compiled code in Emacs 19, but not vice versa. | 26 | code does not run in earlier versions. |
| 27 | 27 | ||
| 28 | @xref{Compilation Errors}, for how to investigate errors occurring in | 28 | @xref{Compilation Errors}, for how to investigate errors occurring in |
| 29 | byte compilation. | 29 | byte compilation. |
| @@ -31,6 +31,8 @@ byte compilation. | |||
| 31 | @menu | 31 | @menu |
| 32 | * Speed of Byte-Code:: An example of speedup from byte compilation. | 32 | * Speed of Byte-Code:: An example of speedup from byte compilation. |
| 33 | * Compilation Functions:: Byte compilation functions. | 33 | * Compilation Functions:: Byte compilation functions. |
| 34 | * Docs and Compilation:: Dynamic loading of documentation strings. | ||
| 35 | * Dynamic Loading:: Dynamic loading of individual functions. | ||
| 34 | * Eval During Compile:: Code to be evaluated when you compile. | 36 | * Eval During Compile:: Code to be evaluated when you compile. |
| 35 | * Byte-Code Objects:: The data type used for byte-compiled functions. | 37 | * Byte-Code Objects:: The data type used for byte-compiled functions. |
| 36 | * Disassembly:: Disassembling byte-code; how to read byte-code. | 38 | * Disassembly:: Disassembling byte-code; how to read byte-code. |
| @@ -109,7 +111,7 @@ i.e., the compiler does not follow indirection to another symbol. | |||
| 109 | @code{byte-compile} returns the new, compiled definition of | 111 | @code{byte-compile} returns the new, compiled definition of |
| 110 | @var{symbol}. | 112 | @var{symbol}. |
| 111 | 113 | ||
| 112 | If @var{symbol}'s definition is a byte-code function object, | 114 | If @var{symbol}'s definition is a byte-code function object, |
| 113 | @code{byte-compile} does nothing and returns @code{nil}. Lisp records | 115 | @code{byte-compile} does nothing and returns @code{nil}. Lisp records |
| 114 | only one function definition for any symbol, and if that is already | 116 | only one function definition for any symbol, and if that is already |
| 115 | compiled, non-compiled code is not available anywhere. So there is no | 117 | compiled, non-compiled code is not available anywhere. So there is no |
| @@ -221,10 +223,129 @@ part of a byte-code function object, and only rarely due to an explicit | |||
| 221 | call to @code{byte-code}. | 223 | call to @code{byte-code}. |
| 222 | @end defun | 224 | @end defun |
| 223 | 225 | ||
| 226 | @node Docs and Compilation | ||
| 227 | @section Documentation Strings and Compilation | ||
| 228 | @cindex dynamic loading of documentation | ||
| 229 | |||
| 230 | Functions and variables loaded from a byte-compiled file access their | ||
| 231 | documentation strings dynamically from the file whenever needed. This | ||
| 232 | saves space within Emacs, and make loading faster because the | ||
| 233 | documentation strings themselves need not be processed while loading the | ||
| 234 | file. Actual access to the documentation strings becomes slower as a | ||
| 235 | result, but this normally is not enough to bother users. | ||
| 236 | |||
| 237 | Dynamic access to documentation strings does have drawbacks: | ||
| 238 | |||
| 239 | @itemize @bullet | ||
| 240 | @item | ||
| 241 | If you delete or move the compiled file after loading it, Emacs can no | ||
| 242 | longer access the documentation strings for the functions and variables | ||
| 243 | in the file. | ||
| 244 | |||
| 245 | @item | ||
| 246 | If you alter the compiled file (such as by compiling a new version), | ||
| 247 | then further access to documentation strings in this file will give | ||
| 248 | nonsense results. | ||
| 249 | @end itemize | ||
| 250 | |||
| 251 | If your site installs Emacs following the usual procedures, these | ||
| 252 | problems will never normally occur. Installing a new version uses a new | ||
| 253 | directory with a different name; as long as the old version remains | ||
| 254 | installed, its files will remain unmodified in the places where they are | ||
| 255 | expected to be. | ||
| 256 | |||
| 257 | However, if you have build Emacs yourself and use it from the | ||
| 258 | directory where you built it, you will experience this problem | ||
| 259 | occasionally if you edit and recompile Lisp files. When it happens, you | ||
| 260 | can cure the problem by reloading the file after recompiling it. | ||
| 261 | |||
| 262 | Byte-compiled files made with Emacs 19.29 will not load into older | ||
| 263 | versions because the older versions don't support this feature. You can | ||
| 264 | 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 | ||
| 266 | 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 | ||
| 268 | way: | ||
| 269 | |||
| 270 | @example | ||
| 271 | -*-byte-compile-dynamic-docstrings: nil;-*- | ||
| 272 | @end example | ||
| 273 | |||
| 274 | @defvar byte-compile-dynamic-docstrings | ||
| 275 | If this is non-@code{nil}, the byte compiler generates compiled files | ||
| 276 | that are set up for dynamic loading of documentation strings. | ||
| 277 | @end defvar | ||
| 278 | |||
| 279 | @cindex @samp{#@@@var{count}} | ||
| 280 | @cindex @samp{#$} | ||
| 281 | The dynamic documentation string feature writes compiled files that | ||
| 282 | use a special Lisp reader construct, @samp{#@@@var{count}}. This | ||
| 283 | construct skips the next @var{count} characters. It also uses the | ||
| 284 | @samp{#$} construct, which stands for ``the name of this file, as a | ||
| 285 | string.'' It is best not to use these constructs in Lisp source files. | ||
| 286 | |||
| 287 | @node Dynamic Loading | ||
| 288 | @section Dynamic Loading of Individual Functions | ||
| 289 | |||
| 290 | @cindex dynamic loading of functions | ||
| 291 | @cindex lazy loading | ||
| 292 | When you compile a file, you can optionally enable the @dfn{dynamic | ||
| 293 | function loading} feature (also known as @dfn{lazy loading}). With | ||
| 294 | dynamic function loading, loading the file doesn't fully read the | ||
| 295 | function definitions in the file. Instead, each function definition | ||
| 296 | contains a place-holder which refers to the file. The first time each | ||
| 297 | function is called, it reads the full definition from the file, to | ||
| 298 | replace the place-holder. | ||
| 299 | |||
| 300 | The advantage of dynamic function loading is that loading the file | ||
| 301 | becomes much faster. This is a good thing for a file which contains | ||
| 302 | many separate commands, provided that using one of them does not imply | ||
| 303 | you will soon (or ever) use the rest. A specialized mode which provides | ||
| 304 | many keyboard commands often has that usage pattern: a user may invoke | ||
| 305 | the mode, but use only a few of the commands it provides. | ||
| 306 | |||
| 307 | The dynamic loading feature has certain disadvantages: | ||
| 308 | |||
| 309 | @itemize @bullet | ||
| 310 | @item | ||
| 311 | If you delete or move the compiled file after loading it, Emacs can no | ||
| 312 | longer load the remaining function definitions not already loaded. | ||
| 313 | |||
| 314 | @item | ||
| 315 | If you alter the compiled file (such as by compiling a new version), | ||
| 316 | then trying to load any function not already loaded will get nonsense | ||
| 317 | results. | ||
| 318 | @end itemize | ||
| 319 | |||
| 320 | If you compile a new version of the file, the best thing to do is | ||
| 321 | immediately load the new compiled file. That will prevent any future | ||
| 322 | problems. | ||
| 323 | |||
| 324 | The byte compiler uses the dynamic function loading feature if the | ||
| 325 | variable @code{byte-compile-dynamic} is non-@code{nil} at compilation | ||
| 326 | time. Do not set this variable globally, since dynamic loading is | ||
| 327 | desirable only for certain files. Instead, enable the feature for | ||
| 328 | specific source files with file-local variable bindings, like this: | ||
| 329 | |||
| 330 | @example | ||
| 331 | -*-byte-compile-dynamic: t;-*- | ||
| 332 | @end example | ||
| 333 | |||
| 334 | @defvar byte-compile-dynamic | ||
| 335 | If this is non-@code{nil}, the byte compiler generates compiled files | ||
| 336 | that are set up for dynamic function loading. | ||
| 337 | @end defvar | ||
| 338 | |||
| 339 | @defun fetch-bytecode function | ||
| 340 | This immediately finishes loading the definition of @var{function} from | ||
| 341 | its byte-compiled file, if it is not fully loaded already. The argument | ||
| 342 | @var{function} may be a byte-code function object or a function name. | ||
| 343 | @end defun | ||
| 344 | |||
| 224 | @node Eval During Compile | 345 | @node Eval During Compile |
| 225 | @section Evaluation During Compilation | 346 | @section Evaluation During Compilation |
| 226 | 347 | ||
| 227 | These features permit you to write code to be evaluated during | 348 | These features permit you to write code to be evaluated during |
| 228 | compilation of a program. | 349 | compilation of a program. |
| 229 | 350 | ||
| 230 | @defspec eval-and-compile body | 351 | @defspec eval-and-compile body |
diff --git a/lispref/debugging.texi b/lispref/debugging.texi index 1b765970278..3fa300d02f9 100644 --- a/lispref/debugging.texi +++ b/lispref/debugging.texi | |||
| @@ -89,6 +89,10 @@ The value can also be a list of error conditions that should call the | |||
| 89 | debugger. For example, if you set it to the list | 89 | debugger. For example, if you set it to the list |
| 90 | @code{(void-variable)}, then only errors about a variable that has no | 90 | @code{(void-variable)}, then only errors about a variable that has no |
| 91 | value invoke the debugger. | 91 | value invoke the debugger. |
| 92 | |||
| 93 | When this variable is non-@code{nil}, Emacs does not catch errors that | ||
| 94 | happen in process filter functions and sentinels. Therefore, these | ||
| 95 | errors also can invoke the debugger. @xref{Processes}. | ||
| 92 | @end defopt | 96 | @end defopt |
| 93 | 97 | ||
| 94 | To debug an error that happens during loading of the @file{.emacs} | 98 | To debug an error that happens during loading of the @file{.emacs} |
diff --git a/lispref/display.texi b/lispref/display.texi index 2fc7340e035..146dee69531 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -14,7 +14,8 @@ that Emacs presents to the user. | |||
| 14 | * Screen Size:: How big is the Emacs screen. | 14 | * Screen Size:: How big is the Emacs screen. |
| 15 | * Truncation:: Folding or wrapping long text lines. | 15 | * Truncation:: Folding or wrapping long text lines. |
| 16 | * The Echo Area:: Where messages are displayed. | 16 | * The Echo Area:: Where messages are displayed. |
| 17 | * Selective Display:: Hiding part of the buffer text. | 17 | * Invisible Text:: Hiding part of the buffer text. |
| 18 | * Selective Display:: Hiding part of the buffer text (the old way). | ||
| 18 | * Overlay Arrow:: Display of an arrow to indicate position. | 19 | * Overlay Arrow:: Display of an arrow to indicate position. |
| 19 | * Temporary Displays:: Displays that go away automatically. | 20 | * Temporary Displays:: Displays that go away automatically. |
| 20 | * Overlays:: Use overlays to highlight parts of the buffer. | 21 | * Overlays:: Use overlays to highlight parts of the buffer. |
| @@ -168,12 +169,27 @@ If it is non-@code{nil}, these lines are truncated; otherwise, | |||
| 168 | You can override the images that indicate continuation or truncation | 169 | You can override the images that indicate continuation or truncation |
| 169 | with the display table; see @ref{Display Tables}. | 170 | with the display table; see @ref{Display Tables}. |
| 170 | 171 | ||
| 172 | If your buffer contains @strong{very} long lines, and you use | ||
| 173 | continuation to display them, just thinking about them can make Emacs | ||
| 174 | redisplay slow. | ||
| 175 | |||
| 176 | @defvar cache-long-line-scans | ||
| 177 | If this variable is non-@code{nil}, various indentation and motion | ||
| 178 | functions, and Emacs redisplay, cache the results of their scans for | ||
| 179 | newlines, and consult the cache to avoid rescanning regions of the | ||
| 180 | buffer unless they are modified. | ||
| 181 | |||
| 182 | Turning on the newline cache slows down processing of short lines. | ||
| 183 | |||
| 184 | This variable is automatically local in every buffer. | ||
| 185 | @end defvar | ||
| 186 | |||
| 171 | @node The Echo Area | 187 | @node The Echo Area |
| 172 | @section The Echo Area | 188 | @section The Echo Area |
| 173 | @cindex error display | 189 | @cindex error display |
| 174 | @cindex echo area | 190 | @cindex echo area |
| 175 | 191 | ||
| 176 | The @dfn{echo area} is used for displaying messages made with the | 192 | The @dfn{echo area} is used for displaying messages made with the |
| 177 | @code{message} primitive, and for echoing keystrokes. It is not the | 193 | @code{message} primitive, and for echoing keystrokes. It is not the |
| 178 | same as the minibuffer, despite the fact that the minibuffer appears | 194 | same as the minibuffer, despite the fact that the minibuffer appears |
| 179 | (when active) in the same place on the screen as the echo area. The | 195 | (when active) in the same place on the screen as the echo area. The |
| @@ -187,7 +203,7 @@ functions with @code{t} as the stream (@pxref{Output Functions}), or as | |||
| 187 | follows: | 203 | follows: |
| 188 | 204 | ||
| 189 | @defun message string &rest arguments | 205 | @defun message string &rest arguments |
| 190 | This function prints a one-line message in the echo area. The | 206 | This function displays a one-line message in the echo area. The |
| 191 | argument @var{string} is similar to a C language @code{printf} control | 207 | argument @var{string} is similar to a C language @code{printf} control |
| 192 | string. See @code{format} in @ref{String Conversion}, for the details | 208 | string. See @code{format} in @ref{String Conversion}, for the details |
| 193 | on the conversion specifications. @code{message} returns the | 209 | on the conversion specifications. @code{message} returns the |
| @@ -217,6 +233,21 @@ Minibuffer depth is 0. | |||
| 217 | @end example | 233 | @end example |
| 218 | @end defun | 234 | @end defun |
| 219 | 235 | ||
| 236 | Almost all the messages displayed in the echo area are also recorded | ||
| 237 | in the @samp{*Messages*} buffer. | ||
| 238 | |||
| 239 | @defopt message-log-max | ||
| 240 | This variable specifies how many lines to keep in the @samp{*Messages*} | ||
| 241 | buffer. The value @code{t} means there is no limit on how many lines to | ||
| 242 | keep. The value @code{nil} disables message logging entirely. Here's | ||
| 243 | how to display a message and prevent it from being logged: | ||
| 244 | |||
| 245 | @example | ||
| 246 | (let (message-log-max) | ||
| 247 | (message @dots{})) | ||
| 248 | @end example | ||
| 249 | @end defopt | ||
| 250 | |||
| 220 | @defvar cursor-in-echo-area | 251 | @defvar cursor-in-echo-area |
| 221 | This variable controls where the cursor appears when a message is | 252 | This variable controls where the cursor appears when a message is |
| 222 | displayed in the echo area. If it is non-@code{nil}, then the cursor | 253 | displayed in the echo area. If it is non-@code{nil}, then the cursor |
| @@ -227,6 +258,62 @@ The value is normally @code{nil}; Lisp programs bind it to @code{t} | |||
| 227 | for brief periods of time. | 258 | for brief periods of time. |
| 228 | @end defvar | 259 | @end defvar |
| 229 | 260 | ||
| 261 | @node Invisible Text | ||
| 262 | @section Invisible Text | ||
| 263 | |||
| 264 | @cindex invisible text | ||
| 265 | You can make characters @dfn{invisible}, so that they do not appear on | ||
| 266 | the screen, with the @code{invisible} property. This can be either a | ||
| 267 | text property or a property of an overlay. | ||
| 268 | |||
| 269 | In the simplest case, any non-@code{nil} @code{invisible} property makes | ||
| 270 | a character invisible. This is the default case---if you don't alter | ||
| 271 | the default value of @code{buffer-invisibility-spec}, this is how the | ||
| 272 | @code{invisibility} property works. This feature is much like selective | ||
| 273 | display (@pxref{Selective Display}), but more general and cleaner. | ||
| 274 | |||
| 275 | More generally, you can use the variable @code{buffer-invisibility-spec} | ||
| 276 | to control which values of the @code{invisible} property make text | ||
| 277 | invisible. This permits you to classify the text into different subsets | ||
| 278 | in advance, by giving them different @code{invisible} values, and | ||
| 279 | subsequently make various subsets visible or invisible by changing the | ||
| 280 | value of @code{buffer-invisibility-spec}. | ||
| 281 | |||
| 282 | Controlling visibility with @code{buffer-invisibility-spec} is | ||
| 283 | 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 | ||
| 285 | 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 | ||
| 287 | looking for things to change. | ||
| 288 | |||
| 289 | @defvar buffer-invisibility-spec | ||
| 290 | This variable specifies which kinds of @code{invisible} properties | ||
| 291 | actually make a character invisible. | ||
| 292 | |||
| 293 | @table @asis | ||
| 294 | @item @code{t} | ||
| 295 | A character is invisible if its @code{invisible} property is | ||
| 296 | non-@code{nil}. This is the default. | ||
| 297 | |||
| 298 | @item a list | ||
| 299 | Each element of the list makes certain characters invisible. | ||
| 300 | Ultimately, a character is invisible if any of the elements of this list | ||
| 301 | applies to it. The list can have two kinds of elements: | ||
| 302 | |||
| 303 | @table @code | ||
| 304 | @item @var{atom} | ||
| 305 | A character is invisible if its @code{invisible} propery value | ||
| 306 | is @var{atom} or if it is a list with @var{atom} as a member. | ||
| 307 | |||
| 308 | @item (@var{atom} . t) | ||
| 309 | A character is invisible if its @code{invisible} propery value | ||
| 310 | is @var{atom} or if it is a list with @var{atom} as a member. | ||
| 311 | Moreover, if this character is at the end of a line and is followed | ||
| 312 | by a visible newline, it displays an ellipsis. | ||
| 313 | @end table | ||
| 314 | @end table | ||
| 315 | @end defvar | ||
| 316 | |||
| 230 | @node Selective Display | 317 | @node Selective Display |
| 231 | @section Selective Display | 318 | @section Selective Display |
| 232 | @cindex selective display | 319 | @cindex selective display |
| @@ -237,9 +324,13 @@ lines do not appear. | |||
| 237 | 324 | ||
| 238 | The first variant, explicit selective display, is designed for use in | 325 | The first variant, explicit selective display, is designed for use in |
| 239 | a Lisp program. The program controls which lines are hidden by altering | 326 | a Lisp program. The program controls which lines are hidden by altering |
| 240 | the text. Outline mode uses this variant. In the second variant, the | 327 | the text. Outline mode has traditionally used this variant. It has |
| 241 | choice of lines to hide is made automatically based on indentation. | 328 | been partially replaced by the invisible text feature (@pxref{Invisible |
| 242 | This variant is designed as a user-level feature. | 329 | Text}); there is a new version of Outline mode which uses that instead. |
| 330 | |||
| 331 | In the second variant, the choice of lines to hide is made | ||
| 332 | automatically based on indentation. This variant is designed as a | ||
| 333 | user-level feature. | ||
| 243 | 334 | ||
| 244 | The way you control explicit selective display is by replacing a | 335 | The way you control explicit selective display is by replacing a |
| 245 | newline (control-j) with a carriage return (control-m). The text that | 336 | newline (control-j) with a carriage return (control-m). The text that |
| @@ -370,12 +461,17 @@ given time. | |||
| 370 | @c now. Is it? | 461 | @c now. Is it? |
| 371 | @end defvar | 462 | @end defvar |
| 372 | 463 | ||
| 464 | You can do the same job by creating an overlay with a | ||
| 465 | @code{before-string} property. @xref{Overlay Properties}. | ||
| 466 | |||
| 373 | @node Temporary Displays | 467 | @node Temporary Displays |
| 374 | @section Temporary Displays | 468 | @section Temporary Displays |
| 375 | 469 | ||
| 376 | Temporary displays are used by commands to put output into a buffer | 470 | Temporary displays are used by commands to put output into a buffer |
| 377 | and then present it to the user for perusal rather than for editing. | 471 | and then present it to the user for perusal rather than for editing. |
| 378 | Many of the help commands use this feature. | 472 | Many of the help commands use this feature. Nowadays you can do the |
| 473 | same job by creating an overlay with a @code{before-string} property. | ||
| 474 | @xref{Overlay Properties}. | ||
| 379 | 475 | ||
| 380 | @defspec with-output-to-temp-buffer buffer-name forms@dots{} | 476 | @defspec with-output-to-temp-buffer buffer-name forms@dots{} |
| 381 | This function executes @var{forms} while arranging to insert any | 477 | This function executes @var{forms} while arranging to insert any |
| @@ -527,11 +623,18 @@ what they should mean. | |||
| 527 | If the @code{window} property is non-@code{nil}, then the overlay | 623 | If the @code{window} property is non-@code{nil}, then the overlay |
| 528 | applies only on that window. | 624 | applies only on that window. |
| 529 | 625 | ||
| 626 | @item category | ||
| 627 | @kindex category @r{(overlay property)} | ||
| 628 | 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 | ||
| 630 | of the symbol serve as defaults for the properties of the overlay. | ||
| 631 | |||
| 530 | @item face | 632 | @item face |
| 531 | @kindex face @r{(overlay property)} | 633 | @kindex face @r{(overlay property)} |
| 532 | This property controls the font and color of text. @xref{Faces}, for | 634 | This property controls the font and color of text. Its value is a face |
| 533 | more information. This feature is temporary; in the future, we may | 635 | name or a list of face names. @xref{Faces}, for more information. This |
| 534 | replace it with other ways of specifying how to display text. | 636 | feature may be temporary; in the future, we may replace it with other |
| 637 | ways of specifying how to display text. | ||
| 535 | 638 | ||
| 536 | @item mouse-face | 639 | @item mouse-face |
| 537 | @kindex mouse-face @r{(overlay property)} | 640 | @kindex mouse-face @r{(overlay property)} |
| @@ -543,39 +646,67 @@ the range of the overlay. This feature may be temporary, like | |||
| 543 | @kindex modification-hooks @r{(overlay property)} | 646 | @kindex modification-hooks @r{(overlay property)} |
| 544 | This property's value is a list of functions to be called if any | 647 | This property's value is a list of functions to be called if any |
| 545 | character within the overlay is changed or if text is inserted strictly | 648 | character within the overlay is changed or if text is inserted strictly |
| 546 | within the overlay. Each function receives three arguments: the | 649 | within the overlay. |
| 547 | overlay, and the beginning and end of the part of the buffer being | 650 | |
| 651 | The hook functions are called both before and after each change. | ||
| 652 | If the functions save the information they receive, and compare notes | ||
| 653 | between calls, they can determine exactly what change has been made | ||
| 654 | in the buffer text. | ||
| 655 | |||
| 656 | When called before a change, each function receives four arguments: the | ||
| 657 | overlay, @code{nil}, and the beginning and end of the text range to be | ||
| 548 | modified. | 658 | modified. |
| 549 | 659 | ||
| 660 | When called after a change, each function receives five arguments: the | ||
| 661 | 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. | ||
| 663 | (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 | ||
| 665 | beginning and end are at the same place.) | ||
| 666 | |||
| 550 | @item insert-in-front-hooks | 667 | @item insert-in-front-hooks |
| 551 | @kindex insert-in-front-hooks @r{(overlay property)} | 668 | @kindex insert-in-front-hooks @r{(overlay property)} |
| 552 | This property's value is a list of functions to be called | 669 | This property's value is a list of functions to be called before and |
| 553 | if text is inserted right at the beginning of the overlay. | 670 | after inserting text right at the beginning of the overlay. The calling |
| 671 | conventions are the same as for the @code{modification-hooks} functions. | ||
| 554 | 672 | ||
| 555 | @item insert-behind-hooks | 673 | @item insert-behind-hooks |
| 556 | @kindex insert-behind-hooks @r{(overlay property)} | 674 | @kindex insert-behind-hooks @r{(overlay property)} |
| 557 | This property's value is a list of functions to be called if text is | 675 | This property's value is a list of functions to be called before and |
| 558 | inserted right at the end of the overlay. | 676 | after inserting text right at the end of the overlay. The calling |
| 677 | conventions are the same as for the @code{modification-hooks} functions. | ||
| 559 | 678 | ||
| 560 | @item invisible | 679 | @item invisible |
| 561 | @kindex invisible @r{(overlay property)} | 680 | @kindex invisible @r{(overlay property)} |
| 562 | A non-@code{nil} @code{invisible} property means that the text in the | 681 | The @code{invisible} property can make the text in the overlay |
| 563 | overlay does not appear on the screen. This works much like selective | 682 | invisible, which means that it does not appear on the screen. |
| 564 | display. Details of this feature are likely to change in future | 683 | @xref{Invisible Text}, for details. |
| 565 | versions, so check the @file{etc/NEWS} file in the version you are | 684 | |
| 566 | using. | 685 | @item intangible |
| 686 | @kindex intangible @r{(overlay property)} | ||
| 687 | The @code{intangible} property on an overlay works just like the | ||
| 688 | @code{intangible} text propert. @xref{Special Properties}, for details. | ||
| 567 | 689 | ||
| 568 | @item before-string | 690 | @item before-string |
| 569 | @kindex before-string @r{(overlay property)} | 691 | @kindex before-string @r{(overlay property)} |
| 570 | This property's value is a string to add to the display at the beginning | 692 | This property's value is a string to add to the display at the beginning |
| 571 | of the overlay. The string does not appear in the buffer in any | 693 | of the overlay. The string does not appear in the buffer in any |
| 572 | sense---only on the screen. This is not yet implemented, but will be. | 694 | sense---only on the screen. The string should contain only characters |
| 695 | that display as a single column---control characters, including tabs or | ||
| 696 | newlines, will give strange results. | ||
| 573 | 697 | ||
| 574 | @item after-string | 698 | @item after-string |
| 575 | @kindex after-string @r{(overlay property)} | 699 | @kindex after-string @r{(overlay property)} |
| 576 | This property's value is a string to add to the display at the end of | 700 | This property's value is a string to add to the display at the end of |
| 577 | the overlay. The string does not appear in the buffer in any | 701 | the overlay. The string does not appear in the buffer in any |
| 578 | sense---only on the screen. This is not yet implemented, but will be. | 702 | sense---only on the screen. The string should contain only characters |
| 703 | that display as a single column---control characters, including tabs or | ||
| 704 | newlines, will give strange results. | ||
| 705 | |||
| 706 | @item evaporate | ||
| 707 | @kindex evaporate @r{(overlay property)} | ||
| 708 | If this property is non-@code{nil}, the overlay is deleted automatically | ||
| 709 | if it ever becomes empty (i.e., if it spans no characters). | ||
| 579 | @end table | 710 | @end table |
| 580 | 711 | ||
| 581 | These are the functions for reading and writing the properties of an | 712 | These are the functions for reading and writing the properties of an |
| @@ -583,8 +714,10 @@ overlay. | |||
| 583 | 714 | ||
| 584 | @defun overlay-get overlay prop | 715 | @defun overlay-get overlay prop |
| 585 | This function returns the value of property @var{prop} recorded in | 716 | This function returns the value of property @var{prop} recorded in |
| 586 | @var{overlay}. If @var{overlay} does not record any value for that | 717 | @var{overlay}, if any. If @var{overlay} does not record any value for |
| 587 | property, then the value is @code{nil}. | 718 | that property, but it does have a @code{category} property which is a |
| 719 | symbol, that symbol's @var{prop} property is used. Otherwise, the value | ||
| 720 | is @code{nil}. | ||
| 588 | @end defun | 721 | @end defun |
| 589 | 722 | ||
| 590 | @defun overlay-put overlay prop value | 723 | @defun overlay-put overlay prop value |
| @@ -654,6 +787,11 @@ This function returns the buffer position of the next beginning or end | |||
| 654 | of an overlay, after @var{pos}. | 787 | of an overlay, after @var{pos}. |
| 655 | @end defun | 788 | @end defun |
| 656 | 789 | ||
| 790 | @defun previous-overlay-change pos | ||
| 791 | This function returns the buffer position of the previous beginning or | ||
| 792 | end of an overlay, before @var{pos}. | ||
| 793 | @end defun | ||
| 794 | |||
| 657 | @node Faces | 795 | @node Faces |
| 658 | @section Faces | 796 | @section Faces |
| 659 | @cindex face | 797 | @cindex face |
| @@ -667,6 +805,12 @@ Each face has its own @dfn{face id number} which distinguishes faces at | |||
| 667 | low levels within Emacs. However, for most purposes, you can refer to | 805 | low levels within Emacs. However, for most purposes, you can refer to |
| 668 | faces in Lisp programs by their names. | 806 | faces in Lisp programs by their names. |
| 669 | 807 | ||
| 808 | @defun facep object | ||
| 809 | This function returns @code{t} if @var{object} is a face name symbol (or | ||
| 810 | if it is a vector of the kind used internally to record face data). It | ||
| 811 | returns @code{nil} otherwise. | ||
| 812 | @end defun | ||
| 813 | |||
| 670 | Each face name is meaningful for all frames, and by default it has the | 814 | Each face name is meaningful for all frames, and by default it has the |
| 671 | same meaning in all frames. But you can arrange to give a particular | 815 | same meaning in all frames. But you can arrange to give a particular |
| 672 | face name a special meaning in one frame if you wish. | 816 | face name a special meaning in one frame if you wish. |
| @@ -1051,9 +1195,10 @@ This creates and returns a display table. The table initially has | |||
| 1051 | element says how to display the character code @var{n}. The value | 1195 | element says how to display the character code @var{n}. The value |
| 1052 | should be @code{nil} or a vector of glyph values (@pxref{Glyphs}). If | 1196 | should be @code{nil} or a vector of glyph values (@pxref{Glyphs}). If |
| 1053 | an element is @code{nil}, it says to display that character according to | 1197 | an element is @code{nil}, it says to display that character according to |
| 1054 | the usual display conventions (@pxref{Usual Display}). Note that the | 1198 | the usual display conventions (@pxref{Usual Display}). |
| 1055 | display table has no effect on the tab and newline characters; they are | 1199 | |
| 1056 | always displayed as whitespace in their usual special fashion. | 1200 | If you use the display table to change the display of newline |
| 1201 | characters, the whole buffer will be displayed as one long ``line.'' | ||
| 1057 | 1202 | ||
| 1058 | The remaining six elements of a display table serve special purposes, | 1203 | The remaining six elements of a display table serve special purposes, |
| 1059 | and @code{nil} means use the default stated below. | 1204 | and @code{nil} means use the default stated below. |
diff --git a/lispref/elisp.texi b/lispref/elisp.texi index ce4b7d542c2..e1e21b9417c 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | @c %**end of header | 6 | @c %**end of header |
| 7 | 7 | ||
| 8 | @ifinfo | 8 | @ifinfo |
| 9 | This version is the edition 2.3 of the GNU Emacs Lisp | 9 | This version is the edition 2.4 of the GNU Emacs Lisp |
| 10 | Reference Manual. It corresponds to Emacs Version 19.25. | 10 | Reference Manual. It corresponds to Emacs Version 19.29. |
| 11 | @c Please REMEMBER to update edition number in *four* places in this file | 11 | @c Please REMEMBER to update edition number in *four* places in this file |
| 12 | @c and also in *one* place in intro.texi | 12 | @c and also in *one* place in intro.texi |
| 13 | 13 | ||
| @@ -15,7 +15,7 @@ Published by the Free Software Foundation | |||
| 15 | 675 Massachusetts Avenue | 15 | 675 Massachusetts Avenue |
| 16 | Cambridge, MA 02139 USA | 16 | Cambridge, MA 02139 USA |
| 17 | 17 | ||
| 18 | Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | 18 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
| 19 | 19 | ||
| 20 | Permission is granted to make and distribute verbatim copies of this | 20 | Permission is granted to make and distribute verbatim copies of this |
| 21 | manual provided the copyright notice and this permission notice are | 21 | manual provided the copyright notice and this permission notice are |
| @@ -68,21 +68,20 @@ instead of in the original English. | |||
| 68 | @subtitle for Unix Users | 68 | @subtitle for Unix Users |
| 69 | @c The edition number appears in several places in this file | 69 | @c The edition number appears in several places in this file |
| 70 | @c and also in the file intro.texi. | 70 | @c and also in the file intro.texi. |
| 71 | @subtitle Second Edition, June 1993 | 71 | @subtitle Revision 2.4, June 1995 |
| 72 | @subtitle Revision 2.3, June 1994 | ||
| 73 | 72 | ||
| 74 | @author by Bil Lewis, Dan LaLiberte, Richard Stallman | 73 | @author by Bil Lewis, Dan LaLiberte, Richard Stallman |
| 75 | @author and the GNU Manual Group | 74 | @author and the GNU Manual Group |
| 76 | @page | 75 | @page |
| 77 | @vskip 0pt plus 1filll | 76 | @vskip 0pt plus 1filll |
| 78 | Copyright @copyright{} 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | 77 | Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
| 79 | 78 | ||
| 80 | @sp 2 | 79 | @sp 2 |
| 81 | Edition 2.3 @* | 80 | Edition 2.4 @* |
| 82 | Revised for Emacs Version 19.25,@* | 81 | Revised for Emacs Version 19.29,@* |
| 83 | June, 1994.@* | 82 | June, 1995.@* |
| 84 | @sp 2 | 83 | @sp 2 |
| 85 | ISBN 1-882114-40-X | 84 | ISBN 1-882114-71-X |
| 86 | 85 | ||
| 87 | @sp 2 | 86 | @sp 2 |
| 88 | Published by the Free Software Foundation @* | 87 | Published by the Free Software Foundation @* |
| @@ -113,8 +112,8 @@ Cover art by Etienne Suvasa. | |||
| 113 | @node Top, Copying, (dir), (dir) | 112 | @node Top, Copying, (dir), (dir) |
| 114 | 113 | ||
| 115 | @ifinfo | 114 | @ifinfo |
| 116 | This Info file contains edition 2.3 of the GNU Emacs Lisp | 115 | This Info file contains edition 2.4 of the GNU Emacs Lisp |
| 117 | Reference Manual, corresponding to GNU Emacs version 19.25. | 116 | Reference Manual, corresponding to GNU Emacs version 19.29. |
| 118 | @end ifinfo | 117 | @end ifinfo |
| 119 | 118 | ||
| 120 | @menu | 119 | @menu |
| @@ -268,7 +267,7 @@ Numbers | |||
| 268 | * Arithmetic Operations:: How to add, subtract, multiply and divide. | 267 | * Arithmetic Operations:: How to add, subtract, multiply and divide. |
| 269 | * Bitwise Operations:: Logical and, or, not, shifting. | 268 | * Bitwise Operations:: Logical and, or, not, shifting. |
| 270 | * Numeric Conversions:: Converting float to integer and vice versa. | 269 | * Numeric Conversions:: Converting float to integer and vice versa. |
| 271 | * Transcendental Functions:: Trig, exponential and logarithmic functions. | 270 | * Math Functions:: Trig, exponential and logarithmic functions. |
| 272 | * Random Numbers:: Obtaining random integers, predictable or not. | 271 | * Random Numbers:: Obtaining random integers, predictable or not. |
| 273 | 272 | ||
| 274 | Strings and Characters | 273 | Strings and Characters |
| @@ -707,7 +706,7 @@ The Kill Ring | |||
| 707 | * Kill Ring Concepts:: What text looks like in the kill ring. | 706 | * Kill Ring Concepts:: What text looks like in the kill ring. |
| 708 | * Kill Functions:: Functions that kill text. | 707 | * Kill Functions:: Functions that kill text. |
| 709 | * Yank Commands:: Commands that access the kill ring. | 708 | * Yank Commands:: Commands that access the kill ring. |
| 710 | * Low Level Kill Ring:: Functions and variables for kill ring access. | 709 | * Low-Level Kill Ring:: Functions and variables for kill ring access. |
| 711 | * Internals of Kill Ring:: Variables that hold kill-ring data. | 710 | * Internals of Kill Ring:: Variables that hold kill-ring data. |
| 712 | 711 | ||
| 713 | Indentation | 712 | Indentation |
diff --git a/lispref/eval.texi b/lispref/eval.texi index 999f3b4b1c4..1bbd672f5fc 100644 --- a/lispref/eval.texi +++ b/lispref/eval.texi | |||
| @@ -165,6 +165,10 @@ reached, or until an error is signaled and not handled. | |||
| 165 | If @var{stream} is supplied, @code{standard-output} is bound to it | 165 | If @var{stream} is supplied, @code{standard-output} is bound to it |
| 166 | during the evaluation. | 166 | during the evaluation. |
| 167 | 167 | ||
| 168 | You can use the variable @code{load-read-function} to specify a function | ||
| 169 | for @code{eval-region} to use instead of @code{read} for reading | ||
| 170 | expressions. @xref{How Programs Do Loading}. | ||
| 171 | |||
| 168 | @code{eval-region} always returns @code{nil}. | 172 | @code{eval-region} always returns @code{nil}. |
| 169 | @end deffn | 173 | @end deffn |
| 170 | 174 | ||
diff --git a/lispref/files.texi b/lispref/files.texi index 7c7f20c2884..cfcab286d7b 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -34,6 +34,7 @@ substitutions such as @samp{$HOME}. @xref{File Name Expansion}. | |||
| 34 | * Create/Delete Dirs:: Creating and Deleting Directories. | 34 | * Create/Delete Dirs:: Creating and Deleting Directories. |
| 35 | * Magic File Names:: Defining "magic" special handling | 35 | * Magic File Names:: Defining "magic" special handling |
| 36 | for certain file names. | 36 | for certain file names. |
| 37 | * Format Conversion:: Conversion to and from various file formats. | ||
| 37 | * Files and MS-DOS:: Distinguishing text and binary files on MS-DOS. | 38 | * Files and MS-DOS:: Distinguishing text and binary files on MS-DOS. |
| 38 | @end menu | 39 | @end menu |
| 39 | 40 | ||
| @@ -426,6 +427,10 @@ contents of the buffer (actually, just the accessible portion) with the | |||
| 426 | contents of the file. This is better than simply deleting the buffer | 427 | contents of the file. This is better than simply deleting the buffer |
| 427 | contents and inserting the whole file, because (1) it preserves some | 428 | contents and inserting the whole file, because (1) it preserves some |
| 428 | marker positions and (2) it puts less data in the undo list. | 429 | 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}. | ||
| 429 | @end defun | 434 | @end defun |
| 430 | 435 | ||
| 431 | If you want to pass a file name to another process so that another | 436 | If you want to pass a file name to another process so that another |
| @@ -488,6 +493,10 @@ Normally, @code{write-region} displays a message @samp{Wrote file | |||
| 488 | nor @code{nil} nor a string, then this message is inhibited. This | 493 | nor @code{nil} nor a string, then this message is inhibited. This |
| 489 | feature is useful for programs that use files for internal purposes, | 494 | feature is useful for programs that use files for internal purposes, |
| 490 | files that the user does not need to know about. | 495 | 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}. | ||
| 491 | @end deffn | 500 | @end deffn |
| 492 | 501 | ||
| 493 | @node File Locks | 502 | @node File Locks |
| @@ -684,6 +693,11 @@ we can deduce that any attempt to read a file in @file{/foo/} will | |||
| 684 | give an error. | 693 | give an error. |
| 685 | @end defun | 694 | @end defun |
| 686 | 695 | ||
| 696 | @defun file-ownership-preserved-p filename | ||
| 697 | This function returns @code{t} if deleting the file @var{filename} and | ||
| 698 | then creating it anew would keep the file's owner unchanged. | ||
| 699 | @end defun | ||
| 700 | |||
| 687 | @defun file-newer-than-file-p filename1 filename2 | 701 | @defun file-newer-than-file-p filename1 filename2 |
| 688 | @cindex file age | 702 | @cindex file age |
| 689 | @cindex file modification time | 703 | @cindex file modification time |
| @@ -787,6 +801,12 @@ existing directory, @code{nil} otherwise. | |||
| 787 | @end example | 801 | @end example |
| 788 | @end defun | 802 | @end defun |
| 789 | 803 | ||
| 804 | @defun file-regular-p filename | ||
| 805 | This function returns @code{t} if the file @var{filename} exists and is | ||
| 806 | a regular file (not a directory, symbolic link, named pipe, terminal, or | ||
| 807 | other I/O device). | ||
| 808 | @end defun | ||
| 809 | |||
| 790 | @node Truenames | 810 | @node Truenames |
| 791 | @subsection Truenames | 811 | @subsection Truenames |
| 792 | @cindex truename (of file) | 812 | @cindex truename (of file) |
| @@ -1309,6 +1329,12 @@ backup version numbers, or trailing tildes. | |||
| 1309 | @end example | 1329 | @end example |
| 1310 | @end defun | 1330 | @end defun |
| 1311 | 1331 | ||
| 1332 | @defun file-name-sans-extension filename | ||
| 1333 | This function returns @var{filename} sans its final ``extension'', if | ||
| 1334 | any. The extension, in a file name, is the part that follows the last | ||
| 1335 | @samp{.}. | ||
| 1336 | @end defun | ||
| 1337 | |||
| 1312 | @node Directory Names | 1338 | @node Directory Names |
| 1313 | @comment node-name, next, previous, up | 1339 | @comment node-name, next, previous, up |
| 1314 | @subsection Directory Names | 1340 | @subsection Directory Names |
| @@ -1944,6 +1970,124 @@ non-magic directory to serve as its current directory, and this function | |||
| 1944 | is a good way to come up with one. | 1970 | is a good way to come up with one. |
| 1945 | @end defun | 1971 | @end defun |
| 1946 | 1972 | ||
| 1973 | @node Format Conversion | ||
| 1974 | @section File Format Conversion | ||
| 1975 | |||
| 1976 | @cindex file format conversion | ||
| 1977 | @cindex encoding file formats | ||
| 1978 | @cindex decoding file formats | ||
| 1979 | The variable @code{format-alist} defines a list of @dfn{file formats}, | ||
| 1980 | which are textual representations used in files for the data (text, | ||
| 1981 | text-properties, and possibly other information) in an Emacs buffer. | ||
| 1982 | Emacs performs format conversion when reading and writing files. | ||
| 1983 | |||
| 1984 | @defvar format-alist | ||
| 1985 | This list contains one format definition for each defined file format. | ||
| 1986 | @end defvar | ||
| 1987 | |||
| 1988 | @cindex format definition | ||
| 1989 | Each format definition is a list of this form: | ||
| 1990 | |||
| 1991 | @example | ||
| 1992 | (@var{name} @var{doc-string} @var{regexp} @var{from-fn} @var{to-fn} @var{modify} @var{mode-fn}) | ||
| 1993 | @end example | ||
| 1994 | |||
| 1995 | Here is what the elements in a format definition mean: | ||
| 1996 | |||
| 1997 | @table @var | ||
| 1998 | @item name | ||
| 1999 | The name of this format. | ||
| 2000 | |||
| 2001 | @item doc-string | ||
| 2002 | A documentation string for the format. | ||
| 2003 | |||
| 2004 | @item regexp | ||
| 2005 | A regular expression which is used to recognize files represented in | ||
| 2006 | this format. | ||
| 2007 | |||
| 2008 | @item from-fn | ||
| 2009 | A function to call to decode data in this format (to convert file data into | ||
| 2010 | the usual Emacs data representation). | ||
| 2011 | |||
| 2012 | The @var{from-fn} is called with two args, @var{begin} and @var{end}, | ||
| 2013 | 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 | ||
| 2015 | text, @var{from-fn} should return the modified end position. | ||
| 2016 | |||
| 2017 | One responsibility of @var{from-fm} is to make sure that the beginning | ||
| 2018 | of the file no longer matches @var{regexp}. Otherwise it is likely to | ||
| 2019 | get called again. | ||
| 2020 | |||
| 2021 | @item to-fn | ||
| 2022 | A function to call to encode data in this format (to convert | ||
| 2023 | the usual Emacs data representation into this format). | ||
| 2024 | |||
| 2025 | The @var{to-fn} is called with two args, @var{begin} and @var{end}, | ||
| 2026 | which specify the part of the buffer it should convert. There are | ||
| 2027 | two ways it can do the conversion: | ||
| 2028 | |||
| 2029 | @itemize @bullet | ||
| 2030 | @item | ||
| 2031 | By editing the buffer in place. In this case, @var{to-fn} should | ||
| 2032 | return the end-position of the range of text, as modified. | ||
| 2033 | |||
| 2034 | @item | ||
| 2035 | By returning a list of annotations. This is a list of elements of the | ||
| 2036 | form @code{(@var{position} . @var{string})}, where @var{position} is an | ||
| 2037 | integer specifying the relative position in the text to be written, and | ||
| 2038 | @var{string} is the annotation to add there. The list must be sorted in | ||
| 2039 | order of position when @var{to-fn} returns it. | ||
| 2040 | |||
| 2041 | When @code{write-region} actually writes the text from the buffer to the | ||
| 2042 | file, it intermixes the specified annotations at the corresponding | ||
| 2043 | positions. All this takes place without modifying the buffer. | ||
| 2044 | @end itemize | ||
| 2045 | |||
| 2046 | @item modify | ||
| 2047 | A flag, @code{t} if the encoding function modifies the buffer, and | ||
| 2048 | @code{nil} if it works by returning a list of annotations. | ||
| 2049 | |||
| 2050 | @item mode | ||
| 2051 | A mode function to call after visiting a file converted from this | ||
| 2052 | format. | ||
| 2053 | @end table | ||
| 2054 | |||
| 2055 | The function @code{insert-file-contents} automatically recognizes file | ||
| 2056 | formats when it reads the specified file. It checks the text of the | ||
| 2057 | beginning of the file against the regular expressions of the format | ||
| 2058 | definitions, and if it finds a match, it calls the decoding function for | ||
| 2059 | that format. Then it checks all the known formats over again. | ||
| 2060 | It keeps checking them until none of them is applicable. | ||
| 2061 | |||
| 2062 | Visiting a file, with @code{find-file-noselect} or the commands that use | ||
| 2063 | it, performs conversion likewise (because it calls | ||
| 2064 | @code{insert-file-contents}); but it also calls the mode function for | ||
| 2065 | each format that it decodes. It stores a list of the format names | ||
| 2066 | in the buffer-local variable @code{buffer-file-format}. | ||
| 2067 | |||
| 2068 | @defvar buffer-file-format | ||
| 2069 | This variable holds a list of the file formats that were decoded in the | ||
| 2070 | course of visiting the current buffer's file. It is always local in all | ||
| 2071 | buffers. | ||
| 2072 | @end defvar | ||
| 2073 | |||
| 2074 | 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}. | ||
| 2076 | |||
| 2077 | @defun format-write-file file format | ||
| 2078 | 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 | ||
| 2080 | saves of the buffer. | ||
| 2081 | @end defun | ||
| 2082 | |||
| 2083 | @defvar auto-save-file-format | ||
| 2084 | This variable specifies the format to use for auto-saving. Its value is | ||
| 2085 | a list of format names, just like the value of | ||
| 2086 | @code{buffer-file-format}; but it is used instead of | ||
| 2087 | @code{buffer-file-format} for writing auto-save files. This variable | ||
| 2088 | is always local in all buffers. | ||
| 2089 | @end defvar | ||
| 2090 | |||
| 1947 | @node Files and MS-DOS | 2091 | @node Files and MS-DOS |
| 1948 | @section Files and MS-DOS | 2092 | @section Files and MS-DOS |
| 1949 | @cindex MS-DOS file types | 2093 | @cindex MS-DOS file types |
diff --git a/lispref/frames.texi b/lispref/frames.texi index edcff7ea6fa..97d8e3e940a 100644 --- a/lispref/frames.texi +++ b/lispref/frames.texi | |||
| @@ -14,11 +14,13 @@ horizontally into smaller windows. | |||
| 14 | 14 | ||
| 15 | @cindex terminal frame | 15 | @cindex terminal frame |
| 16 | @cindex X window frame | 16 | @cindex X window frame |
| 17 | When Emacs runs on a text-only terminal, it has just one frame, a | 17 | When Emacs runs on a text-only terminal, it starts with one |
| 18 | @dfn{terminal frame}. There is no way to create another terminal frame | 18 | @dfn{terminal frames}. If you create additional ones, Emacs displays |
| 19 | after startup. If Emacs has an X display, it does not have a terminal | 19 | one and only one at any given time---on the terminal screen, of course. |
| 20 | frame; instead, it starts with a single @dfn{X window frame}. You can | 20 | |
| 21 | create more; see @ref{Creating Frames}. | 21 | When Emacs uses X for display, it does not have a terminal frame; |
| 22 | instead, it starts with a single @dfn{X window frame}. It can display | ||
| 23 | multiple X window frames at the same time, each in its own X window. | ||
| 22 | 24 | ||
| 23 | @defun framep object | 25 | @defun framep object |
| 24 | This predicate returns @code{t} if @var{object} is a frame, and | 26 | This predicate returns @code{t} if @var{object} is a frame, and |
| @@ -26,8 +28,10 @@ This predicate returns @code{t} if @var{object} is a frame, and | |||
| 26 | @end defun | 28 | @end defun |
| 27 | 29 | ||
| 28 | @menu | 30 | @menu |
| 29 | * Creating Frames:: Creating additional X Window frames. | 31 | * Creating Frames:: Creating additional frames. |
| 32 | * Multiple Displays:: Creating frames on other X displays. | ||
| 30 | * Frame Parameters:: Controlling frame size, position, font, etc. | 33 | * Frame Parameters:: Controlling frame size, position, font, etc. |
| 34 | * Frame Titles:: Automatic updating of frame titles. | ||
| 31 | * Deleting Frames:: Frames last until explicitly deleted. | 35 | * Deleting Frames:: Frames last until explicitly deleted. |
| 32 | * Finding All Frames:: How to examine all existing frames. | 36 | * Finding All Frames:: How to examine all existing frames. |
| 33 | * Frames and Windows:: A frame contains windows; | 37 | * Frames and Windows:: A frame contains windows; |
| @@ -57,8 +61,8 @@ This predicate returns @code{t} if @var{object} is a frame, and | |||
| 57 | To create a new frame, call the function @code{make-frame}. | 61 | To create a new frame, call the function @code{make-frame}. |
| 58 | 62 | ||
| 59 | @defun make-frame alist | 63 | @defun make-frame alist |
| 60 | This function creates a new frame, if the display mechanism permits | 64 | This function creates a new frame. If you are using X, it makes |
| 61 | creation of frames. (An X server does; an ordinary terminal does not.) | 65 | an X window frame; otherwise, it makes a terminal frame. |
| 62 | 66 | ||
| 63 | The argument is an alist specifying frame parameters. Any parameters | 67 | The argument is an alist specifying frame parameters. Any parameters |
| 64 | not mentioned in @var{alist} default according to the value of the | 68 | not mentioned in @var{alist} default according to the value of the |
| @@ -67,8 +71,7 @@ either default from the standard X defaults file and X resources. | |||
| 67 | 71 | ||
| 68 | The set of possible parameters depends in principle on what kind of | 72 | The set of possible parameters depends in principle on what kind of |
| 69 | window system Emacs uses to display its frames. @xref{X Frame | 73 | window system Emacs uses to display its frames. @xref{X Frame |
| 70 | Parameters}, for documentation of individual parameters you can specify | 74 | Parameters}, for documentation of individual parameters you can specify. |
| 71 | when creating an X window frame. | ||
| 72 | @end defun | 75 | @end defun |
| 73 | 76 | ||
| 74 | @defvar before-make-frame-hook | 77 | @defvar before-make-frame-hook |
| @@ -80,6 +83,62 @@ frame. | |||
| 80 | A normal hook run by @code{make-frame} after it creates the frame. | 83 | A normal hook run by @code{make-frame} after it creates the frame. |
| 81 | @end defvar | 84 | @end defvar |
| 82 | 85 | ||
| 86 | @node Multiple Displays | ||
| 87 | @section Multiple Displays | ||
| 88 | @cindex multiple displays | ||
| 89 | @cindex multiple X terminals | ||
| 90 | @cindex displays, multiple | ||
| 91 | |||
| 92 | A single Emacs can talk to more than one X Windows display. | ||
| 93 | Initially, Emacs uses just one display---the one chosen with the | ||
| 94 | @code{DISPLAY} environment variable or with the @samp{--display} option | ||
| 95 | (@pxref{Initial Options,,, emacs, The GNU Emacs Manual}). To connect to | ||
| 96 | another display, use the command @code{make-frame-on-display} or specify | ||
| 97 | the @code{display} frame parameter when you create the frame. | ||
| 98 | |||
| 99 | Emacs treats each X server as a separate terminal, giving each one its | ||
| 100 | own selected frame and its own minibuffer windows. A few Lisp variables | ||
| 101 | have values local to the current terminal (that is, the terminal | ||
| 102 | corresponding to the currently selected frame): these are | ||
| 103 | @code{default-minibuffer-frame}, @code{defining-kbd-macro}, | ||
| 104 | @code{last-kbd-macro}, @code{multiple-frames} and | ||
| 105 | @code{system-key-alist}. These variables are always terminal-local and | ||
| 106 | can never be buffer-local. | ||
| 107 | |||
| 108 | A single X server can handle more than one screen. A display name | ||
| 109 | @samp{@var{host}.@var{server}.@var{screen}} has three parts; the last | ||
| 110 | part specifies the screen number for a given server. When you use two | ||
| 111 | screens belonging to one server, Emacs knows by the similarity in their | ||
| 112 | names that they share a single keyboard, and it treats them as a single | ||
| 113 | terminal. | ||
| 114 | |||
| 115 | @deffn Command make-frame-on-display display &optional parameters | ||
| 116 | This creates a new frame on display @var{display}, taking the other | ||
| 117 | frame parameters from @var{parameters}. Aside from the @var{display} | ||
| 118 | argument, it is like @code{make-frame} (@pxref{Creating Frames}). | ||
| 119 | @end deffn | ||
| 120 | |||
| 121 | @defun x-display-list | ||
| 122 | 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 | @end defun | ||
| 125 | |||
| 126 | @defun x-open-connection display &optional xrm-string | ||
| 127 | 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 | ||
| 129 | that communication can be established with that display. | ||
| 130 | |||
| 131 | The optional second argument @var{xrm-string} should be a string of | ||
| 132 | resources in xrdb format, or @code{nil}. The resources, if specified, | ||
| 133 | apply to all Emacs frames created on this display. | ||
| 134 | @end defun | ||
| 135 | |||
| 136 | @defun x-close-connection display | ||
| 137 | This function closes the connection to display @var{display}. Before | ||
| 138 | you can do this, you must first delete all the frames that were open on | ||
| 139 | that display (@pxref{Deleting Frames}). | ||
| 140 | @end defun | ||
| 141 | |||
| 83 | @node Frame Parameters | 142 | @node Frame Parameters |
| 84 | @section Frame Parameters | 143 | @section Frame Parameters |
| 85 | 144 | ||
| @@ -95,7 +154,7 @@ and width. | |||
| 95 | @menu | 154 | @menu |
| 96 | * Parameter Access:: How to change a frame's parameters. | 155 | * Parameter Access:: How to change a frame's parameters. |
| 97 | * Initial Parameters:: Specifying frame parameters when you make a frame. | 156 | * Initial Parameters:: Specifying frame parameters when you make a frame. |
| 98 | * X Frame Parameters:: Individual parameters documented. | 157 | * X Frame Parameters:: List of frame parameters. |
| 99 | * Size and Position:: Changing the size and position of a frame. | 158 | * Size and Position:: Changing the size and position of a frame. |
| 100 | @end menu | 159 | @end menu |
| 101 | 160 | ||
| @@ -180,7 +239,9 @@ instead. @xref{Command Arguments,,, emacs, The GNU Emacs Manual}. | |||
| 180 | @subsection X Window Frame Parameters | 239 | @subsection X Window Frame Parameters |
| 181 | 240 | ||
| 182 | Just what parameters a frame has depends on what display mechanism it | 241 | Just what parameters a frame has depends on what display mechanism it |
| 183 | uses. Here is a table of the parameters of an X window frame: | 242 | uses. Here is a table of the parameters of an X window frame; of these, |
| 243 | @code{name}, @code{height}, @code{width}, and @code{buffer-predicate} | ||
| 244 | provide meaningful information in non-X frames. | ||
| 184 | 245 | ||
| 185 | @table @code | 246 | @table @code |
| 186 | @item name | 247 | @item name |
| @@ -193,15 +254,32 @@ If you specify the frame name explicitly when you create the frame, the | |||
| 193 | name is also used (instead of the name of the Emacs executable) when | 254 | name is also used (instead of the name of the Emacs executable) when |
| 194 | looking up X resources for the frame. | 255 | looking up X resources for the frame. |
| 195 | 256 | ||
| 257 | @item display | ||
| 258 | The display on which to open this frame. It should be a string of the | ||
| 259 | form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the | ||
| 260 | @code{DISPLAY} environment variable. | ||
| 261 | |||
| 196 | @item left | 262 | @item left |
| 197 | The screen position of the left edge, in pixels. The value may be | 263 | The screen position of the left edge, in pixels, with respect to the |
| 198 | @code{-} instead of a number; that represents @samp{-0} in a geometry | 264 | left edge of the screen. The value may be a positive number @var{pos}, |
| 199 | specification. | 265 | or a list of the form @code{(+ @var{pos})} which permits specifying a |
| 266 | negative @var{pos} value. | ||
| 267 | |||
| 268 | 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 | ||
| 270 | window with respect to the right edge of the screen, counting toward the | ||
| 271 | left. | ||
| 200 | 272 | ||
| 201 | @item top | 273 | @item top |
| 202 | The screen position of the top edge, in pixels. The value may be | 274 | The screen position of the top edge, in pixels, with respect to the |
| 203 | @code{-} instead of a number; that represents @samp{-0} in a geometry | 275 | top edge of the screen. The value may be a positive number @var{pos}, |
| 204 | specification. | 276 | or a list of the form @code{(+ @var{pos})} which permits specifying a |
| 277 | negative @var{pos} value. | ||
| 278 | |||
| 279 | 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 | ||
| 281 | window with respect to the bottom edge of the screen, counting toward the | ||
| 282 | top. | ||
| 205 | 283 | ||
| 206 | @item icon-left | 284 | @item icon-left |
| 207 | The screen position of the left edge @emph{of the frame's icon}, in | 285 | The screen position of the left edge @emph{of the frame's icon}, in |
| @@ -237,6 +315,14 @@ yes, @code{nil} means no, @code{only} means this frame is just a | |||
| 237 | minibuffer, a minibuffer window (in some other frame) means the new | 315 | minibuffer, a minibuffer window (in some other frame) means the new |
| 238 | frame uses that minibuffer. | 316 | frame uses that minibuffer. |
| 239 | 317 | ||
| 318 | @item buffer-predicate | ||
| 319 | The buffer-predicate function for this frame. The function | ||
| 320 | @code{other-buffer} uses this predicate (from the selected frame) to | ||
| 321 | decide which buffers it should consider, if the predicate is not | ||
| 322 | @code{nil}. It calls the predicate with one arg, a buffer, once for | ||
| 323 | each buffer; if the predicate returns a non-@code{nil} value, it | ||
| 324 | considers that buffer. | ||
| 325 | |||
| 240 | @item font | 326 | @item font |
| 241 | The name of the font for displaying text in the frame. This is a | 327 | The name of the font for displaying text in the frame. This is a |
| 242 | string. | 328 | string. |
| @@ -256,6 +342,9 @@ Whether the frame has scroll bars for horizontal scrolling | |||
| 256 | (non-@code{nil} means yes). (Horizontal scroll bars are not currently | 342 | (non-@code{nil} means yes). (Horizontal scroll bars are not currently |
| 257 | implemented.) | 343 | implemented.) |
| 258 | 344 | ||
| 345 | @item scroll-bar-width | ||
| 346 | The width of the vertical scroll bar, in pixels. | ||
| 347 | |||
| 259 | @item icon-type | 348 | @item icon-type |
| 260 | The type of icon to use for this frame when it is iconified. If the | 349 | The type of icon to use for this frame when it is iconified. If the |
| 261 | value is a string, that specifies a file containing a bitmap to use. | 350 | value is a string, that specifies a file containing a bitmap to use. |
| @@ -279,11 +368,12 @@ The color for the cursor that shows point. | |||
| 279 | The color for the border of the frame. | 368 | The color for the border of the frame. |
| 280 | 369 | ||
| 281 | @item cursor-type | 370 | @item cursor-type |
| 282 | The way to display the cursor. There are two legitimate values: | 371 | The way to display the cursor. The legitimate values are @code{bar}, |
| 283 | @code{bar} and @code{box}. The symbol @code{bar} specifies a vertical | 372 | @code{box}, and @code{(bar . @var{width})}. The symbol @code{box} |
| 284 | bar between characters as the cursor. The symbol @code{box} specifies | 373 | specifies an ordinary black box overlaying the character after point; |
| 285 | an ordinary black box overlaying the character after point; that is the | 374 | that is the default. The symbol @code{bar} specifies a vertical bar |
| 286 | default. | 375 | between characters as the cursor. @code{(bar . @var{width})} specifies |
| 376 | a bar @var{width} pixels wide. | ||
| 287 | 377 | ||
| 288 | @item border-width | 378 | @item border-width |
| 289 | The width in pixels of the window border. | 379 | The width in pixels of the window border. |
| @@ -376,9 +466,37 @@ gives the values specified for them. Each element looks like | |||
| 376 | @code{(@var{parameter} . @var{value})}. The possible @var{parameter} | 466 | @code{(@var{parameter} . @var{value})}. The possible @var{parameter} |
| 377 | values are @code{left}, @code{top}, @code{width}, and @code{height}. | 467 | values are @code{left}, @code{top}, @code{width}, and @code{height}. |
| 378 | 468 | ||
| 469 | For the size parameters, the value must be an integer. The position | ||
| 470 | parameter names @code{left} and @code{top} are not totally accurate, | ||
| 471 | because some values indicate the position of the right or bottom edges | ||
| 472 | instead. These are the @var{value} possibilities for the position | ||
| 473 | parameters: | ||
| 474 | |||
| 475 | @table @asis | ||
| 476 | @item an integer | ||
| 477 | A positive integer relates the left edge or top edge of the window to | ||
| 478 | 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 | ||
| 480 | screen. | ||
| 481 | |||
| 482 | @item (+ @var{position}) | ||
| 483 | 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 | ||
| 485 | @var{position} may be positive or negative; a negative value specifies a | ||
| 486 | position outside the screen. | ||
| 487 | |||
| 488 | @item (- @var{position}) | ||
| 489 | 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 | ||
| 491 | @var{position} may be positive or negative; a negative value specifies a | ||
| 492 | position outside the screen. | ||
| 493 | @end table | ||
| 494 | |||
| 495 | Here is an example: | ||
| 496 | |||
| 379 | @smallexample | 497 | @smallexample |
| 380 | (x-parse-geometry "35x70+0-0") | 498 | (x-parse-geometry "35x70+0-0") |
| 381 | @result{} ((width . 35) (height . 70) (left . 0) (top . -1)) | 499 | @result{} ((width . 35) (height . 70) (left . 0) (top - 0)) |
| 382 | @end smallexample | 500 | @end smallexample |
| 383 | @end defun | 501 | @end defun |
| 384 | 502 | ||
| @@ -388,6 +506,42 @@ size of a specified frame. The frame is the first argument; the size is | |||
| 388 | the second. | 506 | the second. |
| 389 | @end ignore | 507 | @end ignore |
| 390 | 508 | ||
| 509 | @node Frame Titles | ||
| 510 | @section Frame Titles | ||
| 511 | |||
| 512 | Every frame has a title; most window managers display the frame title at | ||
| 513 | the top of the frame. You can specify an explicit title with the | ||
| 514 | @code{name} frame property. But normally you don't specify this | ||
| 515 | explicitly, and Emacs computes the title automatically. | ||
| 516 | |||
| 517 | Emacs computes the frame title based on a template stored in the | ||
| 518 | variable @code{frame-title-format}. | ||
| 519 | |||
| 520 | @defvar frame-title-format | ||
| 521 | This variable specifies how to compute a title for a frame | ||
| 522 | when you have not explicitly specified one. | ||
| 523 | |||
| 524 | The variable's value is actually a mode line construct, just like | ||
| 525 | @code{mode-line-format}. @xref{Mode Line Data}. | ||
| 526 | @end defvar | ||
| 527 | |||
| 528 | @defvar icon-title-format | ||
| 529 | This variable specifies how to compute the title for an iconified frame, | ||
| 530 | when you have not explicitly specified the frame title. This title | ||
| 531 | appears in the icon itself. | ||
| 532 | @end defvar | ||
| 533 | |||
| 534 | @defvar multiple-frames | ||
| 535 | This variable is set automatically by Emacs. Its value is @code{t} when | ||
| 536 | there are two or more frames (not counting minibuffer-only frames or | ||
| 537 | 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 | ||
| 539 | only when there is more than one frame. | ||
| 540 | |||
| 541 | The variable is always local to the current X terminal and cannot be | ||
| 542 | buffer-local. @xref{Multiple Displays}. | ||
| 543 | @end defvar | ||
| 544 | |||
| 391 | @node Deleting Frames | 545 | @node Deleting Frames |
| 392 | @section Deleting Frames | 546 | @section Deleting Frames |
| 393 | @cindex deletion of frames | 547 | @cindex deletion of frames |
| @@ -409,6 +563,12 @@ The function @code{frame-live-p} returns non-@code{nil} if the frame | |||
| 409 | @var{frame} has not been deleted. | 563 | @var{frame} has not been deleted. |
| 410 | @end defun | 564 | @end defun |
| 411 | 565 | ||
| 566 | Some window managers provide a command to delete a window. These work | ||
| 567 | by sending a special message to the program than operates the window. | ||
| 568 | When Emacs gets one of these commands, it generates a | ||
| 569 | @code{delete-frame} event, whose normal definition is a command that | ||
| 570 | calls the function @code{delete-frame}. @xref{Misc Events}. | ||
| 571 | |||
| 412 | @node Finding All Frames | 572 | @node Finding All Frames |
| 413 | @section Finding All Frames | 573 | @section Finding All Frames |
| 414 | 574 | ||
| @@ -421,7 +581,8 @@ doesn't have any effect on the internals of Emacs. | |||
| 421 | 581 | ||
| 422 | @defun visible-frame-list | 582 | @defun visible-frame-list |
| 423 | This function returns a list of just the currently visible frames. | 583 | This function returns a list of just the currently visible frames. |
| 424 | @xref{Visibility of Frames}. | 584 | @xref{Visibility of Frames}. (Terminal frames always count as |
| 585 | ``visible'', even though only the selected one is actually displayed.) | ||
| 425 | @end defun | 586 | @end defun |
| 426 | 587 | ||
| 427 | @defun next-frame &optional frame minibuf | 588 | @defun next-frame &optional frame minibuf |
| @@ -502,6 +663,12 @@ If you use a minibuffer-only frame, you might want that frame to raise | |||
| 502 | when you enter the minibuffer. If so, set the variable | 663 | when you enter the minibuffer. If so, set the variable |
| 503 | @code{minibuffer-auto-raise} to @code{t}. @xref{Raising and Lowering}. | 664 | @code{minibuffer-auto-raise} to @code{t}. @xref{Raising and Lowering}. |
| 504 | 665 | ||
| 666 | @defvar default-minibuffer-frame | ||
| 667 | 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 | ||
| 669 | buffer-local. @xref{Multiple Displays}. | ||
| 670 | @end defvar | ||
| 671 | |||
| 505 | @node Input Focus | 672 | @node Input Focus |
| 506 | @section Input Focus | 673 | @section Input Focus |
| 507 | @cindex input focus | 674 | @cindex input focus |
| @@ -524,12 +691,20 @@ the function @code{select-frame}. This does not override the window | |||
| 524 | manager; rather, it escapes from the window manager's control until | 691 | manager; rather, it escapes from the window manager's control until |
| 525 | that control is somehow reasserted. | 692 | that control is somehow reasserted. |
| 526 | 693 | ||
| 694 | When using a text-only terminal, there is no window manager; therefore, | ||
| 695 | @code{switch-frame} is the only way to switch frames, and the effect | ||
| 696 | lasts until overridden by a subsequent call to @code{switch-frame}. | ||
| 697 | 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 | ||
| 699 | number of the selected frame appears in the mode line after the word | ||
| 700 | @samp{Emacs}. | ||
| 701 | |||
| 527 | @c ??? This is not yet implemented properly. | 702 | @c ??? This is not yet implemented properly. |
| 528 | @defun select-frame frame | 703 | @defun select-frame frame |
| 529 | This function selects frame @var{frame}, temporarily disregarding the | 704 | This function selects frame @var{frame}, temporarily disregarding the |
| 530 | focus of the X server. The selection of @var{frame} lasts until the | 705 | focus of the X server if any. The selection of @var{frame} lasts until |
| 531 | next time the user does something to select a different frame, or until | 706 | the next time the user does something to select a different frame, or |
| 532 | the next time this function is called. | 707 | until the next time this function is called. |
| 533 | @end defun | 708 | @end defun |
| 534 | 709 | ||
| 535 | Emacs cooperates with the X server and the window managers by arranging | 710 | Emacs cooperates with the X server and the window managers by arranging |
| @@ -583,10 +758,14 @@ change it. | |||
| 583 | @cindex iconified frame | 758 | @cindex iconified frame |
| 584 | @cindex frame visibility | 759 | @cindex frame visibility |
| 585 | 760 | ||
| 586 | A frame may be @dfn{visible}, @dfn{invisible}, or @dfn{iconified}. If | 761 | An X windo frame may be @dfn{visible}, @dfn{invisible}, or |
| 587 | it is visible, you can see its contents. If it is iconified, the | 762 | @dfn{iconified}. If it is visible, you can see its contents. If it is |
| 588 | frame's contents do not appear on the screen, but an icon does. If the | 763 | iconified, the frame's contents do not appear on the screen, but an icon |
| 589 | frame is invisible, it doesn't show on the screen, not even as an icon. | 764 | does. If the frame is invisible, it doesn't show on the screen, not |
| 765 | even as an icon. | ||
| 766 | |||
| 767 | Visibility is meaningless for terminal frames, since only the selected | ||
| 768 | one is actually displayed in any case. | ||
| 590 | 769 | ||
| 591 | @deffn Command make-frame-visible &optional frame | 770 | @deffn Command make-frame-visible &optional frame |
| 592 | This function makes frame @var{frame} visible. If you omit @var{frame}, | 771 | This function makes frame @var{frame} visible. If you omit @var{frame}, |
| @@ -613,6 +792,11 @@ This returns the visibility status of frame @var{frame}. The value is | |||
| 613 | parameter. You can read or change it as such. @xref{X Frame | 792 | parameter. You can read or change it as such. @xref{X Frame |
| 614 | Parameters}. | 793 | Parameters}. |
| 615 | 794 | ||
| 795 | The user can iconify and deiconify frames with the window manager. | ||
| 796 | This happens below the level at which Emacs can exert any control, but | ||
| 797 | Emacs does provide events that you can use to keep track of such | ||
| 798 | changes. @xref{Misc Events}. | ||
| 799 | |||
| 616 | @node Raising and Lowering | 800 | @node Raising and Lowering |
| 617 | @section Raising and Lowering Frames | 801 | @section Raising and Lowering Frames |
| 618 | 802 | ||
| @@ -634,13 +818,13 @@ screen. | |||
| 634 | 818 | ||
| 635 | You can raise and lower Emacs's X windows with these functions: | 819 | You can raise and lower Emacs's X windows with these functions: |
| 636 | 820 | ||
| 637 | @defun raise-frame frame | 821 | @deffn Command raise-frame frame |
| 638 | This function raises frame @var{frame}. | 822 | This function raises frame @var{frame}. |
| 639 | @end defun | 823 | @end deffn |
| 640 | 824 | ||
| 641 | @defun lower-frame frame | 825 | @deffn Command lower-frame frame |
| 642 | This function lowers frame @var{frame}. | 826 | This function lowers frame @var{frame}. |
| 643 | @end defun | 827 | @end deffn |
| 644 | 828 | ||
| 645 | @defopt minibuffer-auto-raise | 829 | @defopt minibuffer-auto-raise |
| 646 | If this is non-@code{nil}, activation of the minibuffer raises the frame | 830 | If this is non-@code{nil}, activation of the minibuffer raises the frame |
| @@ -771,6 +955,9 @@ characters. These coordinates are not required to be within the frame. | |||
| 771 | @node Pop-Up Menus | 955 | @node Pop-Up Menus |
| 772 | @section Pop-Up Menus | 956 | @section Pop-Up Menus |
| 773 | 957 | ||
| 958 | When using X windows, a Lisp program can pop up a menu which the | ||
| 959 | user can choose from with the mouse. | ||
| 960 | |||
| 774 | @defun x-popup-menu position menu | 961 | @defun x-popup-menu position menu |
| 775 | This function displays a pop-up menu and returns an indication of | 962 | This function displays a pop-up menu and returns an indication of |
| 776 | what selection the user makes. | 963 | what selection the user makes. |
| @@ -873,8 +1060,8 @@ pop-up menu in the center of the frame. | |||
| 873 | @cindex pointer shape | 1060 | @cindex pointer shape |
| 874 | @cindex mouse pointer shape | 1061 | @cindex mouse pointer shape |
| 875 | 1062 | ||
| 876 | These variables specify which mouse pointer shape to use in various | 1063 | These variables specify which shape to use for the mouse pointer in |
| 877 | situations: | 1064 | various situations: |
| 878 | 1065 | ||
| 879 | @table @code | 1066 | @table @code |
| 880 | @item x-pointer-shape | 1067 | @item x-pointer-shape |
| @@ -1072,68 +1259,74 @@ If you specify them, the key is | |||
| 1072 | @section Data about the X Server | 1259 | @section Data about the X Server |
| 1073 | 1260 | ||
| 1074 | This section describes functions and a variable that you can use to | 1261 | This section describes functions and a variable that you can use to |
| 1075 | get information about the capabilities and origin of the X server that | 1262 | get information about the capabilities and origin of an X display that |
| 1076 | Emacs is displaying its frames on. | 1263 | Emacs is using. Each of these functions lets you specify the display |
| 1077 | 1264 | you are interested in: the @var{display} argument can be either a | |
| 1078 | @defun x-display-screens | 1265 | display name, or a frame (meaning use the display that frame is on). If |
| 1079 | This function returns the number of screens associated with the current | 1266 | you omit the @var{display} argument, that means to use the selected |
| 1080 | display. | 1267 | frame's display. |
| 1268 | |||
| 1269 | @defun x-display-screens &optional display | ||
| 1270 | This function returns the number of screens associated with the display. | ||
| 1081 | @end defun | 1271 | @end defun |
| 1082 | 1272 | ||
| 1083 | @defun x-server-version | 1273 | @defun x-server-version &optional display |
| 1084 | This function returns the list of version numbers of the X server in | 1274 | This function returns the list of version numbers of the X server |
| 1085 | use. | 1275 | running the display. |
| 1086 | @end defun | 1276 | @end defun |
| 1087 | 1277 | ||
| 1088 | @defun x-server-vendor | 1278 | @defun x-server-vendor &optional display |
| 1089 | This function returns the vendor supporting the X server in use. | 1279 | This function returns the vendor that provided the X server software. |
| 1090 | @end defun | 1280 | @end defun |
| 1091 | 1281 | ||
| 1092 | @defun x-display-pixel-height | 1282 | @defun x-display-pixel-height &optional display |
| 1093 | This function returns the height of this X screen in pixels. | 1283 | This function returns the height of the screen in pixels. |
| 1094 | @end defun | 1284 | @end defun |
| 1095 | 1285 | ||
| 1096 | @defun x-display-mm-height | 1286 | @defun x-display-mm-height &optional display |
| 1097 | This function returns the height of this X screen in millimeters. | 1287 | This function returns the height of the screen in millimeters. |
| 1098 | @end defun | 1288 | @end defun |
| 1099 | 1289 | ||
| 1100 | @defun x-display-pixel-width | 1290 | @defun x-display-pixel-width &optional display |
| 1101 | This function returns the width of this X screen in pixels. | 1291 | This function returns the width of the screen in pixels. |
| 1102 | @end defun | 1292 | @end defun |
| 1103 | 1293 | ||
| 1104 | @defun x-display-mm-width | 1294 | @defun x-display-mm-width &optional display |
| 1105 | This function returns the width of this X screen in millimeters. | 1295 | This function returns the width of the screen in millimeters. |
| 1106 | @end defun | 1296 | @end defun |
| 1107 | 1297 | ||
| 1108 | @defun x-display-backing-store | 1298 | @defun x-display-backing-store &optional display |
| 1109 | This function returns the backing store capability of this screen. | 1299 | This function returns the backing store capability of the screen. |
| 1110 | Values can be the symbols @code{always}, @code{when-mapped}, or | 1300 | Values can be the symbols @code{always}, @code{when-mapped}, or |
| 1111 | @code{not-useful}. | 1301 | @code{not-useful}. |
| 1112 | @end defun | 1302 | @end defun |
| 1113 | 1303 | ||
| 1114 | @defun x-display-save-under | 1304 | @defun x-display-save-under &optional display |
| 1115 | This function returns non-@code{nil} if this X screen supports the | 1305 | This function returns non-@code{nil} if the display supports the |
| 1116 | SaveUnder feature. | 1306 | SaveUnder feature. |
| 1117 | @end defun | 1307 | @end defun |
| 1118 | 1308 | ||
| 1119 | @defun x-display-planes | 1309 | @defun x-display-planes &optional display |
| 1120 | This function returns the number of planes this display supports. | 1310 | This function returns the number of planes the display supports. |
| 1121 | @end defun | 1311 | @end defun |
| 1122 | 1312 | ||
| 1123 | @defun x-display-visual-class | 1313 | @defun x-display-visual-class &optional display |
| 1124 | This function returns the visual class for this X screen. The value is | 1314 | This function returns the visual class for the screen. The value is one |
| 1125 | one of the symbols @code{static-gray}, @code{gray-scale}, | 1315 | of the symbols @code{static-gray}, @code{gray-scale}, |
| 1126 | @code{static-color}, @code{pseudo-color}, @code{true-color}, and | 1316 | @code{static-color}, @code{pseudo-color}, @code{true-color}, and |
| 1127 | @code{direct-color}. | 1317 | @code{direct-color}. |
| 1128 | @end defun | 1318 | @end defun |
| 1129 | 1319 | ||
| 1130 | @defun x-display-color-p | 1320 | @defun x-display-grayscale-p &optional display |
| 1131 | This function returns @code{t} if the X screen in use is a color | 1321 | This function returns @code{t} if the screen can display shades of gray. |
| 1132 | screen. | 1322 | @end defun |
| 1323 | |||
| 1324 | @defun x-display-color-p &optional display | ||
| 1325 | This function returns @code{t} if the screen is a color screen. | ||
| 1133 | @end defun | 1326 | @end defun |
| 1134 | 1327 | ||
| 1135 | @defun x-display-color-cells | 1328 | @defun x-display-color-cells &optional display |
| 1136 | This function returns the number of color cells this X screen supports. | 1329 | This function returns the number of color cells the screen supports. |
| 1137 | @end defun | 1330 | @end defun |
| 1138 | 1331 | ||
| 1139 | @ignore | 1332 | @ignore |
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 7cce7ea7a2b..8e09e3e4dfc 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi | |||
| @@ -582,6 +582,21 @@ keymap, if any, overrides all other maps that would have been active, | |||
| 582 | except for the current global map. | 582 | except for the current global map. |
| 583 | @end defvar | 583 | @end defvar |
| 584 | 584 | ||
| 585 | @defvar overriding-local-map-menu-flag | ||
| 586 | If this variable is non-@code{nil}, the value of | ||
| 587 | @code{overriding-local-map} can affect the display of the menu bar. The | ||
| 588 | default value is @code{nil}, so @code{overriding-local-map} has no | ||
| 589 | effect on the menu bar. | ||
| 590 | |||
| 591 | Note that @code{overriding-local-map} does affect the execution of key | ||
| 592 | sequences entered using the menu bar, even if it does not affect the | ||
| 593 | 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 | ||
| 595 | key sequence. Modes that use @code{overriding-local-map} would | ||
| 596 | typically do this anyway; normally they respond to events that they do | ||
| 597 | not handle by ``unreading'' them and and exiting. | ||
| 598 | @end defvar | ||
| 599 | |||
| 585 | @node Key Lookup | 600 | @node Key Lookup |
| 586 | @section Key Lookup | 601 | @section Key Lookup |
| 587 | @cindex key lookup | 602 | @cindex key lookup |
| @@ -913,6 +928,13 @@ containing a single @kbd{C-M-x}. You can also use this escape syntax in | |||
| 913 | vectors, as well as others that aren't allowed in strings; one example | 928 | vectors, as well as others that aren't allowed in strings; one example |
| 914 | is @samp{[?\C-\H-x home]}. @xref{Character Type}. | 929 | is @samp{[?\C-\H-x home]}. @xref{Character Type}. |
| 915 | 930 | ||
| 931 | The key definition and lookup functions accept an alternate syntax for | ||
| 932 | event types in a key sequence that is a vector: you can use a list | ||
| 933 | containing modifier names plus one base event (a character or function | ||
| 934 | key name). For example, @code{(control ?a)} is equivalent to | ||
| 935 | @code{?\C-a} and @code{(hyper control left)} is equivalent to | ||
| 936 | @code{C-H-left}. | ||
| 937 | |||
| 916 | For the functions below, an error is signaled if @var{keymap} is not a | 938 | For the functions below, an error is signaled if @var{keymap} is not a |
| 917 | keymap or if @var{key} is not a string or vector representing a key | 939 | keymap or if @var{key} is not a string or vector representing a key |
| 918 | sequence. You can use event types (symbols) as shorthand for events | 940 | sequence. You can use event types (symbols) as shorthand for events |
| @@ -1585,6 +1607,11 @@ that menu bar item, it brings up a single, combined submenu containing | |||
| 1585 | all the subcommands of that item---the global subcommands, the local | 1607 | all the subcommands of that item---the global subcommands, the local |
| 1586 | subcommands, and the minor mode subcommands, all together. | 1608 | subcommands, and the minor mode subcommands, all together. |
| 1587 | 1609 | ||
| 1610 | The variable @code{overriding-local-map} is normally ignored when | ||
| 1611 | determining the menu bar contents. That is, the menu bar is computed | ||
| 1612 | from the keymaps that would be active if @code{overriding-local-map} | ||
| 1613 | were @code{nil}. @xref{Active Keymaps}. | ||
| 1614 | |||
| 1588 | In order for a frame to display a menu bar, its @code{menu-bar-lines} | 1615 | In order for a frame to display a menu bar, its @code{menu-bar-lines} |
| 1589 | parameter must be greater than zero. Emacs uses just one line for the | 1616 | parameter must be greater than zero. Emacs uses just one line for the |
| 1590 | menu bar itself; if you specify more than one line, the other lines | 1617 | menu bar itself; if you specify more than one line, the other lines |
diff --git a/lispref/lists.texi b/lispref/lists.texi index dcb3b8af9d5..55ce93c9547 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi | |||
| @@ -554,34 +554,14 @@ not a list, the sequence's elements do not become elements of the | |||
| 554 | resulting list. Instead, the sequence becomes the final @sc{cdr}, like | 554 | resulting list. Instead, the sequence becomes the final @sc{cdr}, like |
| 555 | any other non-list final argument. | 555 | any other non-list final argument. |
| 556 | 556 | ||
| 557 | Integers are also allowed as arguments to @code{append}. They are | 557 | The @code{append} function also allows integers as arguments. It |
| 558 | converted to strings of digits making up the decimal print | 558 | converts them to strings of digits, making up the decimal print |
| 559 | representation of the integer, and these strings are then appended. | 559 | representation of the integer, and then uses the strings instead of the |
| 560 | Here's what happens: | 560 | original integers. @strong{Don't use this feature; we plan to eliminate |
| 561 | 561 | it. If you already use this feature, change your programs now!} The | |
| 562 | @example | 562 | proper way to convert an integer to a decimal number in this way is with |
| 563 | @group | 563 | @code{format} (@pxref{Formatting Strings}) or @code{number-to-string} |
| 564 | (setq trees '(pine oak)) | 564 | (@pxref{String Conversion}). |
| 565 | @result{} (pine oak) | ||
| 566 | @end group | ||
| 567 | @group | ||
| 568 | (char-to-string 54) | ||
| 569 | @result{} "6" | ||
| 570 | @end group | ||
| 571 | @group | ||
| 572 | (setq longer-list (append trees 6 '(spruce))) | ||
| 573 | @result{} (pine oak 54 spruce) | ||
| 574 | @end group | ||
| 575 | @group | ||
| 576 | (setq x-list (append trees 6 6)) | ||
| 577 | @result{} (pine oak 54 . 6) | ||
| 578 | @end group | ||
| 579 | @end example | ||
| 580 | |||
| 581 | This special case exists for compatibility with Mocklisp, and we don't | ||
| 582 | recommend you take advantage of it. If you want to convert an integer | ||
| 583 | in this way, use @code{format} (@pxref{Formatting Strings}) or | ||
| 584 | @code{number-to-string} (@pxref{String Conversion}). | ||
| 585 | @end defun | 565 | @end defun |
| 586 | 566 | ||
| 587 | @defun reverse list | 567 | @defun reverse list |
| @@ -1303,6 +1283,16 @@ Here is another example, in which the keys and values are not symbols: | |||
| 1303 | @end smallexample | 1283 | @end smallexample |
| 1304 | @end defun | 1284 | @end defun |
| 1305 | 1285 | ||
| 1286 | @defun rassoc value alist | ||
| 1287 | This function returns the first association with value @var{value} in | ||
| 1288 | @var{alist}. It returns @code{nil} if no association in @var{alist} has | ||
| 1289 | a @sc{cdr} @code{equal} to @var{value}. | ||
| 1290 | |||
| 1291 | @code{rassoc} is like @code{assoc} except that it compares the @sc{cdr} of | ||
| 1292 | each @var{alist} association instead of the @sc{car}. You can think of | ||
| 1293 | this as ``reverse @code{assoc}'', finding the key for a given value. | ||
| 1294 | @end defun | ||
| 1295 | |||
| 1306 | @defun assq key alist | 1296 | @defun assq key alist |
| 1307 | This function is like @code{assoc} in that it returns the first | 1297 | This function is like @code{assoc} in that it returns the first |
| 1308 | association for @var{key} in @var{alist}, but it makes the comparison | 1298 | association for @var{key} in @var{alist}, but it makes the comparison |
diff --git a/lispref/loading.texi b/lispref/loading.texi index 8254107e710..645ada83976 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -101,6 +101,10 @@ error @code{file-error} (with @samp{Cannot open load file | |||
| 101 | @var{filename}}). But if @var{missing-ok} is non-@code{nil}, then | 101 | @var{filename}}). But if @var{missing-ok} is non-@code{nil}, then |
| 102 | @code{load} just returns @code{nil}. | 102 | @code{load} just returns @code{nil}. |
| 103 | 103 | ||
| 104 | You can use the variable @code{load-read-function} to specify a function | ||
| 105 | for @code{load} to use instead of @code{read} for reading expressions. | ||
| 106 | See below. | ||
| 107 | |||
| 104 | @code{load} returns @code{t} if the file loads successfully. | 108 | @code{load} returns @code{t} if the file loads successfully. |
| 105 | @end defun | 109 | @end defun |
| 106 | 110 | ||
| @@ -193,6 +197,15 @@ file, and it is @code{nil} otherwise. This is how @code{defun} and | |||
| 193 | effect can be undone if the load fails. | 197 | effect can be undone if the load fails. |
| 194 | @end defvar | 198 | @end defvar |
| 195 | 199 | ||
| 200 | @defvar load-read-function | ||
| 201 | This variable specifies an alternate expression-reading function for | ||
| 202 | @code{load} and @code{eval-region} to use instead of @code{read}. | ||
| 203 | The function should accept one argument, just as @code{read} does. | ||
| 204 | |||
| 205 | Normally, the variable's value is @code{nil}, which means those | ||
| 206 | functions should use @code{read}. | ||
| 207 | @end defvar | ||
| 208 | |||
| 196 | To learn how @code{load} is used to build Emacs, see @ref{Building Emacs}. | 209 | To learn how @code{load} is used to build Emacs, see @ref{Building Emacs}. |
| 197 | 210 | ||
| 198 | @node Autoload | 211 | @node Autoload |
| @@ -326,7 +339,6 @@ convention used only in the preloaded Lisp files such as | |||
| 326 | documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. | 339 | documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. |
| 327 | 340 | ||
| 328 | @node Repeated Loading | 341 | @node Repeated Loading |
| 329 | @comment node-name, next, previous, up | ||
| 330 | @section Repeated Loading | 342 | @section Repeated Loading |
| 331 | @cindex repeated loading | 343 | @cindex repeated loading |
| 332 | 344 | ||
diff --git a/lispref/macros.texi b/lispref/macros.texi index 71dc82f9e54..c5cf625c8c7 100644 --- a/lispref/macros.texi +++ b/lispref/macros.texi | |||
| @@ -203,6 +203,7 @@ called interactively. | |||
| 203 | @section Backquote | 203 | @section Backquote |
| 204 | @cindex backquote (list substitution) | 204 | @cindex backquote (list substitution) |
| 205 | @cindex ` (list substitution) | 205 | @cindex ` (list substitution) |
| 206 | @findex ` | ||
| 206 | 207 | ||
| 207 | Macros often need to construct large list structures from a mixture of | 208 | Macros often need to construct large list structures from a mixture of |
| 208 | constants and nonconstant parts. To make this easier, use the macro | 209 | constants and nonconstant parts. To make this easier, use the macro |
| @@ -215,11 +216,11 @@ two forms yield identical results: | |||
| 215 | 216 | ||
| 216 | @example | 217 | @example |
| 217 | @group | 218 | @group |
| 218 | (` (a list of (+ 2 3) elements)) | 219 | `(a list of (+ 2 3) elements) |
| 219 | @result{} (a list of (+ 2 3) elements) | 220 | @result{} (a list of (+ 2 3) elements) |
| 220 | @end group | 221 | @end group |
| 221 | @group | 222 | @group |
| 222 | (quote (a list of (+ 2 3) elements)) | 223 | '(a list of (+ 2 3) elements) |
| 223 | @result{} (a list of (+ 2 3) elements) | 224 | @result{} (a list of (+ 2 3) elements) |
| 224 | @end group | 225 | @end group |
| 225 | @end example | 226 | @end example |
| @@ -235,7 +236,7 @@ argument of @code{,} and puts the value in the list structure: | |||
| 235 | @result{} (a list of 5 elements) | 236 | @result{} (a list of 5 elements) |
| 236 | @end group | 237 | @end group |
| 237 | @group | 238 | @group |
| 238 | (` (a list of (, (+ 2 3)) elements)) | 239 | `(a list of ,(+ 2 3) elements) |
| 239 | @result{} (a list of 5 elements) | 240 | @result{} (a list of 5 elements) |
| 240 | @end group | 241 | @end group |
| 241 | @end example | 242 | @end example |
| @@ -258,7 +259,7 @@ Here are some examples: | |||
| 258 | @result{} (1 2 3 4 2 3) | 259 | @result{} (1 2 3 4 2 3) |
| 259 | @end group | 260 | @end group |
| 260 | @group | 261 | @group |
| 261 | (` (1 (,@@ some-list) 4 (,@@ some-list))) | 262 | `(1 ,@@some-list 4 ,@@some-list) |
| 262 | @result{} (1 2 3 4 2 3) | 263 | @result{} (1 2 3 4 2 3) |
| 263 | @end group | 264 | @end group |
| 264 | 265 | ||
| @@ -273,57 +274,22 @@ Here are some examples: | |||
| 273 | @result{} (use the words foo bar as elements) | 274 | @result{} (use the words foo bar as elements) |
| 274 | @end group | 275 | @end group |
| 275 | @group | 276 | @group |
| 276 | (` (use the words (,@@ (cdr list)) as elements)) | 277 | `(use the words ,@@(cdr list) as elements) |
| 277 | @result{} (use the words foo bar as elements) | 278 | @result{} (use the words foo bar as elements) |
| 278 | @end group | 279 | @end group |
| 279 | @end example | 280 | @end example |
| 280 | 281 | ||
| 281 | Emacs 18 had a bug that made the previous example fail. The bug | ||
| 282 | affected @code{,@@} followed only by constant elements. If you are | ||
| 283 | concerned with Emacs 18 compatibility, you can work around the bug like | ||
| 284 | this: | ||
| 285 | |||
| 286 | @example | ||
| 287 | (` (use the words (,@@ (cdr list)) as elements @code{(,@@ nil)})) | ||
| 288 | @end example | ||
| 289 | |||
| 290 | @noindent | ||
| 291 | @code{(,@@ nil)} avoids the problem by being a nonconstant element that | ||
| 292 | does not affect the result. | ||
| 293 | |||
| 294 | @defmac ` list | ||
| 295 | This macro quotes @var{list} except for any sublists of the form | ||
| 296 | @code{(, @var{subexp})} or @code{(,@@ @var{listexp})}. Backquote | ||
| 297 | replaces these sublists with the value of @var{subexp} (as a single | ||
| 298 | element) or @var{listexp} (by splicing). Backquote copies the structure | ||
| 299 | of @var{list} down to the places where variable parts are substituted. | ||
| 300 | |||
| 301 | @ignore @c these work now! | ||
| 302 | There are certain contexts in which @samp{,} would not be recognized and | ||
| 303 | should not be used: | ||
| 304 | |||
| 305 | @smallexample | ||
| 306 | @group | ||
| 307 | ;; @r{Use of a @samp{,} expression as the @sc{cdr} of a list.} | ||
| 308 | (` (a . (, 1))) ; @r{Not @code{(a . 1)}} | ||
| 309 | @result{} (a \, 1) | ||
| 310 | @end group | ||
| 311 | |||
| 312 | @group | ||
| 313 | ;; @r{Use of @samp{,} in a vector.} | ||
| 314 | (` [a (, 1) c]) ; @r{Not @code{[a 1 c]}} | ||
| 315 | @error{} Wrong type argument | ||
| 316 | @end group | ||
| 317 | @end smallexample | ||
| 318 | @end ignore | ||
| 319 | @end defmac | ||
| 320 | |||
| 321 | @cindex CL note---@samp{,}, @samp{,@@} as functions | ||
| 322 | @quotation | 282 | @quotation |
| 323 | @b{Common Lisp note:} In Common Lisp, @samp{,} and @samp{,@@} are | 283 | Before Emacs version 19.29, @code{`} used a different syntax which |
| 324 | implemented as reader macros, so they do not require parentheses. In | 284 | required an extra level of parentheses around the entire backquote |
| 325 | Emacs Lisp they use function call syntax because reader macros are not | 285 | construct. Likewise, each @code{,} or @code{,@@} substition required an |
| 326 | supported (for simplicity's sake). | 286 | extra level of parentheses surrounding both the @code{,} or @code{,@@} |
| 287 | and the following expression. The old syntax required whitespace | ||
| 288 | between the @code{`}, @code{,} or @code{,@@} and the following | ||
| 289 | expression. | ||
| 290 | |||
| 291 | This syntax is still accepted, but no longer recommended except for | ||
| 292 | compatibility with old Emacs versions. | ||
| 327 | @end quotation | 293 | @end quotation |
| 328 | 294 | ||
| 329 | @node Problems with Macros | 295 | @node Problems with Macros |
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index fa78ec1f8bd..10dc146535e 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi | |||
| @@ -554,7 +554,7 @@ too short). Both of those begin with the string @samp{foobar}. | |||
| 554 | @end smallexample | 554 | @end smallexample |
| 555 | @end defun | 555 | @end defun |
| 556 | 556 | ||
| 557 | @defun all-completions string collection &optional predicate | 557 | @defun all-completions string collection &optional predicate nospace |
| 558 | This function returns a list of all possible completions of | 558 | This function returns a list of all possible completions of |
| 559 | @var{string}. The parameters to this function are the same as to | 559 | @var{string}. The parameters to this function are the same as to |
| 560 | @code{try-completion}. | 560 | @code{try-completion}. |
| @@ -563,6 +563,9 @@ If @var{collection} is a function, it is called with three arguments: | |||
| 563 | @var{string}, @var{predicate} and @code{t}; then @code{all-completions} | 563 | @var{string}, @var{predicate} and @code{t}; then @code{all-completions} |
| 564 | returns whatever the function returns. @xref{Programmed Completion}. | 564 | returns whatever the function returns. @xref{Programmed Completion}. |
| 565 | 565 | ||
| 566 | If @var{nospace} is non-@code{nil}, completions that start with a space | ||
| 567 | are ignored unless @var{string} also starts with a space. | ||
| 568 | |||
| 566 | Here is an example, using the function @code{test} shown in the | 569 | Here is an example, using the function @code{test} shown in the |
| 567 | example for @code{try-completion}: | 570 | example for @code{try-completion}: |
| 568 | 571 | ||
| @@ -1369,12 +1372,17 @@ The current value of this variable is used to rebind @code{help-form} | |||
| 1369 | locally inside the minibuffer (@pxref{Help Functions}). | 1372 | locally inside the minibuffer (@pxref{Help Functions}). |
| 1370 | @end defvar | 1373 | @end defvar |
| 1371 | 1374 | ||
| 1375 | @defun active-minibuffer-window | ||
| 1376 | This function returns the currently active minibuffer window, or | ||
| 1377 | @code{nil} if none is currently active. | ||
| 1378 | @end defun | ||
| 1379 | |||
| 1372 | @defun minibuffer-window &optional frame | 1380 | @defun minibuffer-window &optional frame |
| 1373 | This function returns the window that is used for the minibuffer. In | 1381 | This function returns the minibuffer window used for frame @var{frame}. |
| 1374 | Emacs 18, there is one and only one minibuffer window; this window | 1382 | If @var{frame} is @code{nil}, that stands for the current frame. Note |
| 1375 | always exists and cannot be deleted. In Emacs 19, each frame can have | 1383 | that the minibuffer window used by a frame need not be part of that |
| 1376 | its own minibuffer, and this function returns the minibuffer window used | 1384 | frame---a frame that has no minibuffer of its own necessarily uses some |
| 1377 | for frame @var{frame} (which defaults to the currently selected frame). | 1385 | other frame's minibuffer window. |
| 1378 | @end defun | 1386 | @end defun |
| 1379 | 1387 | ||
| 1380 | @c Emacs 19 feature | 1388 | @c Emacs 19 feature |
diff --git a/lispref/modes.texi b/lispref/modes.texi index b0b8263200a..1927797080b 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -547,6 +547,16 @@ those such as Dired and Rmail that are useful only with text that has | |||
| 547 | been specially prepared. | 547 | been specially prepared. |
| 548 | @end defopt | 548 | @end defopt |
| 549 | 549 | ||
| 550 | @defun set-buffer-major-mode buffer | ||
| 551 | This function sets the major mode of @var{buffer} to the value of | ||
| 552 | @code{default-major-mode}. If that variable is @code{nil}, it uses | ||
| 553 | the current buffer's major mode (if that is suitable). | ||
| 554 | |||
| 555 | 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 | ||
| 557 | whenever they create buffers. | ||
| 558 | @end defun | ||
| 559 | |||
| 550 | @defvar initial-major-mode | 560 | @defvar initial-major-mode |
| 551 | @cindex @samp{*scratch*} | 561 | @cindex @samp{*scratch*} |
| 552 | The value of this variable determines the major mode of the initial | 562 | The value of this variable determines the major mode of the initial |
| @@ -929,7 +939,8 @@ Force redisplay of the current buffer's mode line. | |||
| 929 | strings, symbols, and numbers kept in the buffer-local variable | 939 | strings, symbols, and numbers kept in the buffer-local variable |
| 930 | @code{mode-line-format}. The data structure is called a @dfn{mode line | 940 | @code{mode-line-format}. The data structure is called a @dfn{mode line |
| 931 | construct}, and it is built in recursive fashion out of simpler mode line | 941 | construct}, and it is built in recursive fashion out of simpler mode line |
| 932 | constructs. | 942 | constructs. The same data structure is used for constructing |
| 943 | frame titles (pxref{Frame Titles}). | ||
| 933 | 944 | ||
| 934 | @defvar mode-line-format | 945 | @defvar mode-line-format |
| 935 | The value of this variable is a mode line construct with overall | 946 | The value of this variable is a mode line construct with overall |
| @@ -1177,20 +1188,39 @@ The current buffer name, obtained with the @code{buffer-name} function. | |||
| 1177 | The visited file name, obtained with the @code{buffer-file-name} | 1188 | The visited file name, obtained with the @code{buffer-file-name} |
| 1178 | function. @xref{Buffer File Name}. | 1189 | function. @xref{Buffer File Name}. |
| 1179 | 1190 | ||
| 1191 | @item %F | ||
| 1192 | The name of the selected frame. | ||
| 1193 | |||
| 1194 | @item %c | ||
| 1195 | The current column number of point. | ||
| 1196 | |||
| 1197 | @item %l | ||
| 1198 | The current line number of point. | ||
| 1199 | |||
| 1180 | @item %* | 1200 | @item %* |
| 1181 | @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* | 1201 | @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* |
| 1182 | @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* | 1202 | @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* |
| 1183 | @samp{-} otherwise. @xref{Buffer Modification}. | 1203 | @samp{-} otherwise. @xref{Buffer Modification}. |
| 1184 | 1204 | ||
| 1185 | @item %+ | 1205 | @item %+ |
| 1206 | @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* | ||
| 1207 | @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* | ||
| 1208 | @samp{-} otherwise. This differs from @samp{%*} only for a modified | ||
| 1209 | read-only buffer. @xref{Buffer Modification}. | ||
| 1210 | |||
| 1211 | @item %& | ||
| 1186 | @samp{*} if the buffer is modified, and @samp{-} otherwise. | 1212 | @samp{*} if the buffer is modified, and @samp{-} otherwise. |
| 1187 | 1213 | ||
| 1188 | @item %s | 1214 | @item %s |
| 1189 | The status of the subprocess belonging to the current buffer, obtained with | 1215 | The status of the subprocess belonging to the current buffer, obtained with |
| 1190 | @code{process-status}. @xref{Process Information}. | 1216 | @code{process-status}. @xref{Process Information}. |
| 1191 | 1217 | ||
| 1218 | @item %t | ||
| 1219 | Whether the visited file is a text file or a binary file. (This is a | ||
| 1220 | meaningful distinction only on certain operating systems.) | ||
| 1221 | |||
| 1192 | @item %p | 1222 | @item %p |
| 1193 | The percent of the buffer above the @strong{top} of window, or | 1223 | The percentage of the buffer text above the @strong{top} of window, or |
| 1194 | @samp{Top}, @samp{Bottom} or @samp{All}. | 1224 | @samp{Top}, @samp{Bottom} or @samp{All}. |
| 1195 | 1225 | ||
| 1196 | @item %P | 1226 | @item %P |
| @@ -1353,7 +1383,7 @@ For example, here's how @code{emacs-lisp-hooks} runs its mode hook: | |||
| 1353 | @end example | 1383 | @end example |
| 1354 | @end defun | 1384 | @end defun |
| 1355 | 1385 | ||
| 1356 | @defun add-hook hook function &optional append | 1386 | @defun add-hook hook function &optional append local |
| 1357 | This function is the handy way to add function @var{function} to hook | 1387 | This function is the handy way to add function @var{function} to hook |
| 1358 | variable @var{hook}. The argument @var{function} may be any valid Lisp | 1388 | variable @var{hook}. The argument @var{function} may be any valid Lisp |
| 1359 | function with the proper number of arguments. For example, | 1389 | function with the proper number of arguments. For example, |
| @@ -1376,27 +1406,29 @@ executed first (barring another @code{add-hook} call). | |||
| 1376 | 1406 | ||
| 1377 | If the optional argument @var{append} is non-@code{nil}, the new hook | 1407 | If the optional argument @var{append} is non-@code{nil}, the new hook |
| 1378 | function goes at the end of the hook list and will be executed last. | 1408 | function goes at the end of the hook list and will be executed last. |
| 1409 | |||
| 1410 | If @var{local} is non-@code{nil}, that says to make the new hook | ||
| 1411 | function local to the current buffer. Before you can do this, you must | ||
| 1412 | make the hook itself buffer-local by calling @code{make-local-hook} | ||
| 1413 | (@strong{not} @code{make-local-variable}). If the hook itself is not | ||
| 1414 | buffer-local, then the value of @var{local} makes no difference---the | ||
| 1415 | hook function is always global. | ||
| 1379 | @end defun | 1416 | @end defun |
| 1380 | 1417 | ||
| 1381 | @defun remove-hook hook function | 1418 | @defun remove-hook hook function &optional local |
| 1382 | This function removes @var{function} from the hook variable @var{hook}. | 1419 | This function removes @var{function} from the hook variable @var{hook}. |
| 1383 | @end defun | ||
| 1384 | 1420 | ||
| 1385 | @ignore @c Should no longer be necessary | 1421 | If @var{local} is non-@code{nil}, that says to remove @var{function} |
| 1386 | If you make a hook variable buffer-local, copy its value before you use | 1422 | from the local hook list instead of from the global hook list. If the |
| 1387 | @code{add-hook} or @code{remove-hook} to change it. For example, | 1423 | hook itself is not buffer-local, then the value of @var{local} makes no |
| 1424 | difference. | ||
| 1425 | @end defun | ||
| 1388 | 1426 | ||
| 1389 | @example | 1427 | @defun make-local-hook hook |
| 1390 | (defun my-major-mode () | 1428 | This function makes the hook variable @code{hook} local to the current |
| 1391 | @dots{} | 1429 | buffer. When a hook variable is local, it can have local and global |
| 1392 | (make-local-variable 'foo-hook) | 1430 | hook functions, and @code{run-hooks} runs all of them. |
| 1393 | (if (boundp 'foo-hook) | ||
| 1394 | (setq foo-hook (copy-sequence foo-hook))) | ||
| 1395 | (add-hook 'foo-hook 'my-foo-function)" | ||
| 1396 | @dots{} | ||
| 1397 | ) | ||
| 1398 | @end example | ||
| 1399 | 1431 | ||
| 1400 | Otherwise you may accidentally alter the list structure that forms part | 1432 | Do not use @code{make-local-variable} directly for hook variables; it is |
| 1401 | of the global value of the hook variable. | 1433 | not sufficient. |
| 1402 | @end ignore | 1434 | @end defun |
diff --git a/lispref/numbers.texi b/lispref/numbers.texi index b3226c0f1cd..0c331545e1d 100644 --- a/lispref/numbers.texi +++ b/lispref/numbers.texi | |||
| @@ -372,8 +372,8 @@ commonly used. | |||
| 372 | if any argument is floating. | 372 | if any argument is floating. |
| 373 | 373 | ||
| 374 | It is important to note that in GNU Emacs Lisp, arithmetic functions | 374 | It is important to note that in GNU Emacs Lisp, arithmetic functions |
| 375 | do not check for overflow. Thus @code{(1+ 8388607)} may evaluate to | 375 | do not check for overflow. Thus @code{(1+ 134217727)} may evaluate to |
| 376 | @minus{}8388608, depending on your hardware. | 376 | @minus{}134217728, depending on your hardware. |
| 377 | 377 | ||
| 378 | @defun 1+ number-or-marker | 378 | @defun 1+ number-or-marker |
| 379 | This function returns @var{number-or-marker} plus 1. | 379 | This function returns @var{number-or-marker} plus 1. |
| @@ -642,11 +642,11 @@ number. | |||
| 642 | 642 | ||
| 643 | The function @code{lsh}, like all Emacs Lisp arithmetic functions, does | 643 | The function @code{lsh}, like all Emacs Lisp arithmetic functions, does |
| 644 | not check for overflow, so shifting left can discard significant bits | 644 | not check for overflow, so shifting left can discard significant bits |
| 645 | and change the sign of the number. For example, left shifting 8,388,607 | 645 | and change the sign of the number. For example, left shifting |
| 646 | produces @minus{}2 on a 24-bit machine: | 646 | 134,217,727 produces @minus{}2 on a 28-bit machine: |
| 647 | 647 | ||
| 648 | @example | 648 | @example |
| 649 | (lsh 8388607 1) ; @r{left shift} | 649 | (lsh 134217727 1) ; @r{left shift} |
| 650 | @result{} -2 | 650 | @result{} -2 |
| 651 | @end example | 651 | @end example |
| 652 | 652 | ||
| @@ -1009,8 +1009,17 @@ This function returns a pseudo-random integer. Repeated calls return a | |||
| 1009 | series of pseudo-random integers. | 1009 | series of pseudo-random integers. |
| 1010 | 1010 | ||
| 1011 | If @var{limit} is @code{nil}, then the value may in principle be any | 1011 | If @var{limit} is @code{nil}, then the value may in principle be any |
| 1012 | integer. If @var{limit} is a positive integer, the value is chosen to | 1012 | integer. However, on machines where integers have more than 32 bits, |
| 1013 | be nonnegative and less than @var{limit} (only in Emacs 19). | 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 | ||
| 1022 | nonnegative and less than @var{limit} (only in Emacs 19). | ||
| 1014 | 1023 | ||
| 1015 | If @var{limit} is @code{t}, it means to choose a new seed based on the | 1024 | If @var{limit} is @code{t}, it means to choose a new seed based on the |
| 1016 | current time of day and on Emacs's process @sc{id} number. | 1025 | current time of day and on Emacs's process @sc{id} number. |
diff --git a/lispref/objects.texi b/lispref/objects.texi index 5d9762ee268..fc06466112c 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi | |||
| @@ -1229,11 +1229,34 @@ pass an argument to @code{+} that it cannot handle: | |||
| 1229 | 1229 | ||
| 1230 | @cindex type predicates | 1230 | @cindex type predicates |
| 1231 | @cindex testing types | 1231 | @cindex testing types |
| 1232 | Lisp provides functions, called @dfn{type predicates}, to test whether | 1232 | If you want your program to handle different types differently, you |
| 1233 | an object is a member of a given type. (Following a convention of long | 1233 | must do explicit type checking. The most common way to check the type |
| 1234 | standing, the names of most Emacs Lisp predicates end in @samp{p}.) | 1234 | of an object is to call a @dfn{type predicate} function. Emacs has a |
| 1235 | type predicate for each type, as well as some predicates for | ||
| 1236 | combinations of types. | ||
| 1235 | 1237 | ||
| 1236 | Here is a table of predefined type predicates, in alphabetical order, | 1238 | A type predicate function takes one argument; it returns @code{t} if |
| 1239 | the argument belongs to the appropriate type, and @code{nil} otherwise. | ||
| 1240 | Following a general Lisp convention for predicate functions, most type | ||
| 1241 | predicates' names end with @samp{p}. | ||
| 1242 | |||
| 1243 | Here is an example which uses the predicates @code{listp} to check for | ||
| 1244 | a list and @code{symbolp} to check for a symbol. | ||
| 1245 | |||
| 1246 | @example | ||
| 1247 | (defun add-on (x) | ||
| 1248 | (cond ((symbolp x) | ||
| 1249 | ;; If X is a symbol, put it on LIST. | ||
| 1250 | (setq list (cons x list))) | ||
| 1251 | ((listp x) | ||
| 1252 | ;; If X is a list, add its elements to LIST. | ||
| 1253 | (setq list (append x list))) | ||
| 1254 | (t | ||
| 1255 | ;; We only handle symbols and lists. | ||
| 1256 | (error "Invalid argument %s in add-on" x)))) | ||
| 1257 | @end example | ||
| 1258 | |||
| 1259 | Here is a table of predefined type predicates, in alphabetical order, | ||
| 1237 | with references to further information. | 1260 | with references to further information. |
| 1238 | 1261 | ||
| 1239 | @table @code | 1262 | @table @code |
| @@ -1334,6 +1357,33 @@ with references to further information. | |||
| 1334 | @xref{Basic Windows, windowp}. | 1357 | @xref{Basic Windows, windowp}. |
| 1335 | @end table | 1358 | @end table |
| 1336 | 1359 | ||
| 1360 | The most general way to check the type of an object is to call the | ||
| 1361 | function @code{type-of}. Recall that each object belongs to one and | ||
| 1362 | only one primitive type; @code{type-of} tells you which one (@pxref{Lisp | ||
| 1363 | Data Types}). But @code{type-of} knows nothing about non-primitive | ||
| 1364 | types. In most cases, it is more convenient to use type predicates than | ||
| 1365 | @code{type-of}. | ||
| 1366 | |||
| 1367 | @defun type-of object | ||
| 1368 | This function returns a symbol naming the primitive type of | ||
| 1369 | @var{object}. The value is one of @code{symbol}, @code{integer}, | ||
| 1370 | @code{float}, @code{string}, @code{cons}, @code{vector}, @code{marker}, | ||
| 1371 | @code{overlay}, @code{window}, @code{buffer}, @code{subr}, | ||
| 1372 | @code{compiled-function}, @code{window-configuration}, or | ||
| 1373 | @code{process}. | ||
| 1374 | |||
| 1375 | @example | ||
| 1376 | (type-of 1) | ||
| 1377 | @result{} integer | ||
| 1378 | (type-of 'nil) | ||
| 1379 | @result{} symbol | ||
| 1380 | (type-of '()) ; @r{@code{()} is @code{nil}.} | ||
| 1381 | @result{} symbol | ||
| 1382 | (type-of '(x)) | ||
| 1383 | @result{} cons | ||
| 1384 | @end example | ||
| 1385 | @end defun | ||
| 1386 | |||
| 1337 | @node Equality Predicates | 1387 | @node Equality Predicates |
| 1338 | @section Equality Predicates | 1388 | @section Equality Predicates |
| 1339 | @cindex equality | 1389 | @cindex equality |
| @@ -1460,7 +1510,10 @@ arguments to see if their elements are the same. So, if two objects are | |||
| 1460 | @end group | 1510 | @end group |
| 1461 | @end example | 1511 | @end example |
| 1462 | 1512 | ||
| 1463 | Comparison of strings uses @code{string=}, and is case-sensitive. | 1513 | Comparison of strings is case-sensitive and takes account of text |
| 1514 | properties as well as the characters in the strings. To compare | ||
| 1515 | two strings' characters without comparing their text properties, | ||
| 1516 | use @code{string=} (@pxref{Text Comparison}). | ||
| 1464 | 1517 | ||
| 1465 | @example | 1518 | @example |
| 1466 | @group | 1519 | @group |
diff --git a/lispref/os.texi b/lispref/os.texi index e7b7b076e08..e39c6ca752c 100644 --- a/lispref/os.texi +++ b/lispref/os.texi | |||
| @@ -20,6 +20,8 @@ pertaining to the terminal and the screen. | |||
| 20 | * System Environment:: Distinguish the name and kind of system. | 20 | * System Environment:: Distinguish the name and kind of system. |
| 21 | * User Identification:: Finding the name and user id of the user. | 21 | * User Identification:: Finding the name and user id of the user. |
| 22 | * Time of Day:: Getting the current time. | 22 | * Time of Day:: Getting the current time. |
| 23 | * Time Conversion:: Converting a time from numeric form to a string, or | ||
| 24 | to calendrical data (or vice versa). | ||
| 23 | * Timers:: Setting a timer to call a function at a certain time. | 25 | * Timers:: Setting a timer to call a function at a certain time. |
| 24 | * Terminal Input:: Recording terminal input for debugging. | 26 | * Terminal Input:: Recording terminal input for debugging. |
| 25 | * Terminal Output:: Recording terminal output for debugging. | 27 | * Terminal Output:: Recording terminal output for debugging. |
| @@ -598,6 +600,23 @@ This function returns the name of the machine you are running on. | |||
| 598 | @end example | 600 | @end example |
| 599 | @end defun | 601 | @end defun |
| 600 | 602 | ||
| 603 | @vindex system-name | ||
| 604 | The symbol @code{system-name} is a variable as well as a function. In | ||
| 605 | fact, the function returns whatever value the variable | ||
| 606 | @code{system-name} currently holds. Thus, you can set the variable | ||
| 607 | @code{system-name} in case Emacs is confused about the name of your | ||
| 608 | system. The variable is also useful for constructing frame titles | ||
| 609 | (@pxref{Frame Titles}). | ||
| 610 | |||
| 611 | @defvar mail-host-address | ||
| 612 | If this variable is non-@code{nil}, it is used instead of | ||
| 613 | @code{system-name} for purposes of generating email addresses. For | ||
| 614 | example, it is used when constructing the default value of | ||
| 615 | @code{user-mail-address}. @xref{User Identification}. (Since this is | ||
| 616 | done when Emacs starts up, the value actually used is the one saved when | ||
| 617 | Emacs was dumped. @xref{Building Emacs}.) | ||
| 618 | @end defvar | ||
| 619 | |||
| 601 | @defun getenv var | 620 | @defun getenv var |
| 602 | @cindex environment variable access | 621 | @cindex environment variable access |
| 603 | This function returns the value of the environment variable @var{var}, | 622 | This function returns the value of the environment variable @var{var}, |
| @@ -631,6 +650,13 @@ function works by modifying @code{process-environment}; binding that | |||
| 631 | variable with @code{let} is also reasonable practice. | 650 | variable with @code{let} is also reasonable practice. |
| 632 | @end deffn | 651 | @end deffn |
| 633 | 652 | ||
| 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 | |||
| 634 | @defvar process-environment | 660 | @defvar process-environment |
| 635 | This variable is a list of strings, each describing one environment | 661 | This variable is a list of strings, each describing one environment |
| 636 | variable. The functions @code{getenv} and @code{setenv} work by means | 662 | variable. The functions @code{getenv} and @code{setenv} work by means |
| @@ -708,12 +734,21 @@ indicating whether the privilege is currently enabled. | |||
| 708 | @node User Identification | 734 | @node User Identification |
| 709 | @section User Identification | 735 | @section User Identification |
| 710 | 736 | ||
| 711 | @defun user-login-name | 737 | @defvar user-mail-address |
| 712 | This function returns the name under which the user is logged in. If | 738 | This holds the nominal email address of the user who is using Emacs. |
| 713 | the environment variable @code{LOGNAME} is set, that value is used. | 739 | When Emacs starts up, it computes a default value that is usually right, |
| 714 | Otherwise, if the environment variable @code{USER} is set, that value is | 740 | but users often set this themselves when the default value is not right. |
| 715 | used. Otherwise, the value is based on the effective @sc{uid}, not the | 741 | @end defvar |
| 716 | real @sc{uid}. | 742 | |
| 743 | @defun user-login-name &optional uid | ||
| 744 | If you don't specify @var{uid}, this function returns the name under | ||
| 745 | which the user is logged in. If the environment variable @code{LOGNAME} | ||
| 746 | is set, that value is used. Otherwise, if the environment variable | ||
| 747 | @code{USER} is set, that value is used. Otherwise, the value is based | ||
| 748 | on the effective @sc{uid}, not the real @sc{uid}. | ||
| 749 | |||
| 750 | If you specify @var{uid}, the value is the user name that corresponds | ||
| 751 | to @var{uid} (which should be an integer). | ||
| 717 | 752 | ||
| 718 | @example | 753 | @example |
| 719 | @group | 754 | @group |
| @@ -740,6 +775,28 @@ This function returns the full name of the user. | |||
| 740 | @end example | 775 | @end example |
| 741 | @end defun | 776 | @end defun |
| 742 | 777 | ||
| 778 | @vindex user-full-name | ||
| 779 | @vindex user-real-login-name | ||
| 780 | @vindex user-login-name | ||
| 781 | The symbols @code{user-login-name}, @code{user-real-login-name} and | ||
| 782 | @code{user-full-name} are variables as well as functions. The functions | ||
| 783 | return the same values that the variables hold. These variables allow | ||
| 784 | you to ``fake out'' Emacs by telling the functions what to return. The | ||
| 785 | variables are also useful for constructing frame titles (@pxref{Frame | ||
| 786 | Titles}). | ||
| 787 | |||
| 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 | |||
| 743 | @defun user-real-uid | 800 | @defun user-real-uid |
| 744 | This function returns the real @sc{uid} of the user. | 801 | This function returns the real @sc{uid} of the user. |
| 745 | 802 | ||
| @@ -825,7 +882,149 @@ The argument @var{time-value}, if given, specifies a time to analyze | |||
| 825 | instead of the current time. The argument should be a cons cell | 882 | instead of the current time. The argument should be a cons cell |
| 826 | containing two integers, or a list whose first two elements are | 883 | containing two integers, or a list whose first two elements are |
| 827 | integers. Thus, you can use times obtained from @code{current-time} | 884 | integers. Thus, you can use times obtained from @code{current-time} |
| 828 | (see below) and from @code{file-attributes} (@pxref{File Attributes}). | 885 | (see above) and from @code{file-attributes} (@pxref{File Attributes}). |
| 886 | @end defun | ||
| 887 | |||
| 888 | @node Time Conversion | ||
| 889 | @section Time Conversion | ||
| 890 | |||
| 891 | These functions convert time values (lists of two or three integers) | ||
| 892 | to strings or to calendrical information. There is also a function to | ||
| 893 | convert calendrical information to a time value. You can get time | ||
| 894 | values from the functions @code{current-time} (@pxref{Time of Day}) and | ||
| 895 | @code{file-attributes} (@pxref{File Attributes}). | ||
| 896 | |||
| 897 | @defun format-time-string format-string time | ||
| 898 | This function converts @var{time} to a string according to | ||
| 899 | @var{format-string}. The argument @var{format-string} may contain | ||
| 900 | @samp{%}-sequences which say to substitute parts of the time. Here is a | ||
| 901 | table of what the @samp{%}-sequences mean: | ||
| 902 | |||
| 903 | @table @samp | ||
| 904 | @item %a | ||
| 905 | This stands for the abbreviated name of the day of week. | ||
| 906 | @item %A | ||
| 907 | This stands for the full name of the day of week. | ||
| 908 | @item %b | ||
| 909 | This stands for the abbreviated name of the month. | ||
| 910 | @item %B | ||
| 911 | This stands for the full name of the month. | ||
| 912 | @item %c | ||
| 913 | This is a synonym for @samp{%x %X}. | ||
| 914 | @item %C | ||
| 915 | This has a locale-specific meaning. In the C locale, it is equivalent | ||
| 916 | to @samp{%A, %B %e, %Y}. | ||
| 917 | @item %d | ||
| 918 | This stands for the day of month, zero-padded. | ||
| 919 | @item %D | ||
| 920 | This is a synonym for @samp{%m/%d/%y}. | ||
| 921 | @item %e | ||
| 922 | This stands for the day of month, blank-padded. | ||
| 923 | @item %h | ||
| 924 | This is a synonym for @samp{%b}. | ||
| 925 | @item %H | ||
| 926 | This stands for the hour (00-23). | ||
| 927 | @item %I | ||
| 928 | This stands for the hour (00-12). | ||
| 929 | @item %j | ||
| 930 | This stands for the day of the year (001-366). | ||
| 931 | @item %k | ||
| 932 | This stands for the hour (0-23), blank padded. | ||
| 933 | @item %l | ||
| 934 | This stands for the hour (1-12), blank padded. | ||
| 935 | @item %m | ||
| 936 | This stands for the month (01-12). | ||
| 937 | @item %M | ||
| 938 | This stands for the minute (00-59). | ||
| 939 | @item %n | ||
| 940 | This stands for a newline. | ||
| 941 | @item %p | ||
| 942 | This stands for @samp{AM} or @samp{PM}, as appropriate. | ||
| 943 | @item %r | ||
| 944 | This is a synonym for @samp{%I:%M:%S %p}. | ||
| 945 | @item %R | ||
| 946 | This is a synonym for @samp{%H:%M}. | ||
| 947 | @item %S | ||
| 948 | This stands for the seconds (00-60). | ||
| 949 | @item %t | ||
| 950 | This stands for a tab character. | ||
| 951 | @item %T | ||
| 952 | This is a synonym for @samp{%H:%M:%S}. | ||
| 953 | @item %U | ||
| 954 | This stands for the week of the year (01-52), assuming that weeks | ||
| 955 | start on Sunday. | ||
| 956 | @item %w | ||
| 957 | This stands for the numeric day of week (0-6). Sunday is day 0. | ||
| 958 | @item %W | ||
| 959 | This stands for the week of the year (01-52), assuming that weeks | ||
| 960 | start on Monday. | ||
| 961 | @item %x | ||
| 962 | This has a locale-specific meaning. In the C locale, it is equivalent | ||
| 963 | to @samp{%D}. | ||
| 964 | @item %X | ||
| 965 | This has a locale-specific meaning. In the C locale, it is equivalent | ||
| 966 | to @samp{%T}. | ||
| 967 | @item %y | ||
| 968 | This stands for the year without century (00-99). | ||
| 969 | @item %Y | ||
| 970 | This stands for the year with century. | ||
| 971 | @item %Z | ||
| 972 | This stands for the time zone abbreviation. | ||
| 973 | @end table | ||
| 974 | @end defun | ||
| 975 | |||
| 976 | @defun decode-time time | ||
| 977 | This function converts a time value into calendrical form. The return | ||
| 978 | value is a list of nine elements, as follows: | ||
| 979 | |||
| 980 | @example | ||
| 981 | (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{zone}) | ||
| 982 | @end example | ||
| 983 | |||
| 984 | Here is what the elements mean: | ||
| 985 | |||
| 986 | @table @var | ||
| 987 | @item sec | ||
| 988 | The number of seconds past the minute, as an integer between 0 and 59. | ||
| 989 | @item minute | ||
| 990 | The number of minutes past the hour, as an integer between 0 and 59. | ||
| 991 | @item hour | ||
| 992 | The hour of the day, as an integer between 0 and 23. | ||
| 993 | @item day | ||
| 994 | The day of the month, as an integer between 1 and 31. | ||
| 995 | @item month | ||
| 996 | The month of the year, as an integer between 1 and 12. | ||
| 997 | @item year | ||
| 998 | The year, an integer typically greater than 1900. | ||
| 999 | @item dow | ||
| 1000 | The day of week, as an integer between 0 and 6, where 0 stands for | ||
| 1001 | Sunday. | ||
| 1002 | @item dst | ||
| 1003 | @code{t} if daylight savings time is effect, otherwise @code{nil}. | ||
| 1004 | @item zone | ||
| 1005 | An integer indicating the number of seconds east of Greenwich. | ||
| 1006 | @end table | ||
| 1007 | |||
| 1008 | Note that Common Lisp has different meanings for @var{dow} and | ||
| 1009 | @var{zone}. | ||
| 1010 | @end defun | ||
| 1011 | |||
| 1012 | @defun encode-time seconds minutes hour day month year &optional zone | ||
| 1013 | This function is the inverse of @code{decode-time}. It converts seven | ||
| 1014 | items of calendrical data into a time value. | ||
| 1015 | |||
| 1016 | For the meanings of the arguments, see the table above under | ||
| 1017 | @code{decode-time}. | ||
| 1018 | |||
| 1019 | 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 | ||
| 1021 | before you call @code{encode-time}. | ||
| 1022 | |||
| 1023 | The optional argument @var{zone} defaults to the current time zone and | ||
| 1024 | its daylight savings time rules. If specified, it can be either a list | ||
| 1025 | (as you would get from @code{current-time-zone}) or an integer (as you | ||
| 1026 | would get from @code{decode-time}). The specified zone is used without | ||
| 1027 | any further alteration for daylight savings time. | ||
| 829 | @end defun | 1028 | @end defun |
| 830 | 1029 | ||
| 831 | @node Timers | 1030 | @node Timers |
| @@ -1271,6 +1470,9 @@ by HP X servers whose numeric code is (1 << 28) + 168. | |||
| 1271 | It is not a problem if the alist defines keysyms for other X servers, as | 1470 | It is not a problem if the alist defines keysyms for other X servers, as |
| 1272 | long as they don't conflict with the ones used by the X server actually | 1471 | long as they don't conflict with the ones used by the X server actually |
| 1273 | in use. | 1472 | in use. |
| 1473 | |||
| 1474 | The variable is always local to the current X terminal and cannot be | ||
| 1475 | buffer-local. @xref{Multiple Displays}. | ||
| 1274 | @end defvar | 1476 | @end defvar |
| 1275 | 1477 | ||
| 1276 | @node Flow Control | 1478 | @node Flow Control |
diff --git a/lispref/processes.texi b/lispref/processes.texi index e71d7efeaaf..a089ba0994d 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -148,23 +148,52 @@ user types another @kbd{C-g}, that kills the subprocess instantly with | |||
| 148 | 18. In version 19, they return an indication of how the process | 148 | 18. In version 19, they return an indication of how the process |
| 149 | terminated. | 149 | terminated. |
| 150 | 150 | ||
| 151 | @defun call-process program &optional infile buffer-or-name display &rest args | 151 | @defun call-process program &optional infile destination display &rest args |
| 152 | This function calls @var{program} in a separate process and waits for | 152 | This function calls @var{program} in a separate process and waits for |
| 153 | it to finish. | 153 | it to finish. |
| 154 | 154 | ||
| 155 | The standard input for the process comes from file @var{infile} if | 155 | The standard input for the process comes from file @var{infile} if |
| 156 | @var{infile} is not @code{nil} and from @file{/dev/null} otherwise. The | 156 | @var{infile} is not @code{nil} and from @file{/dev/null} otherwise. |
| 157 | process output gets inserted in buffer @var{buffer-or-name} before point, | 157 | The argument @var{destination} says where to put the process output. |
| 158 | if that argument names a buffer. If @var{buffer-or-name} is @code{t}, | 158 | Here are the possibilities: |
| 159 | output is sent to the current buffer; if @var{buffer-or-name} is | 159 | |
| 160 | @code{nil}, output is discarded. | 160 | @table @asis |
| 161 | 161 | @item a buffer | |
| 162 | If @var{buffer-or-name} is the integer 0, @code{call-process} returns | 162 | Insert the output in that buffer, before point. This includes both the |
| 163 | @code{nil} immediately and discards any output. In this case, the | 163 | standard output stream and the standard error stream of the process. |
| 164 | process is not truly synchronous, since it can run in parallel with | 164 | |
| 165 | Emacs; but you can think of it as synchronous in that Emacs is | 165 | @item a string |
| 166 | essentially finished with the subprocess as soon as this function | 166 | Find or create a buffer with that name, then insert |
| 167 | returns. | 167 | the output in that buffer, before point. |
| 168 | |||
| 169 | @item @code{t} | ||
| 170 | Insert the output in the current buffer, before point. | ||
| 171 | |||
| 172 | @item @code{nil} | ||
| 173 | Discard the output. | ||
| 174 | |||
| 175 | @item 0 | ||
| 176 | Discard the output, and return immediately without waiting | ||
| 177 | for the subprocess to finish. | ||
| 178 | |||
| 179 | In this case, the process is not truly synchronous, since it can run in | ||
| 180 | parallel with Emacs; but you can think of it as synchronous in that | ||
| 181 | Emacs is essentially finished with the subprocess as soon as this | ||
| 182 | function returns. | ||
| 183 | |||
| 184 | @item (@var{real-destination} @var{error-destination}) | ||
| 185 | Keep the standard output stream separate from the standard error stream; | ||
| 186 | deal with the ordinary output as specified by @var{real-destination}, | ||
| 187 | and dispose of the error output according to @var{error-destination}. | ||
| 188 | The value @code{nil} means discard it, @code{t} means mix it with the | ||
| 189 | ordinary output, and a string specifies a file name to redirect error | ||
| 190 | output into. | ||
| 191 | |||
| 192 | You can't directly specify a buffer to put the error output in; that is | ||
| 193 | too difficult to implement. But you can achieve this result by sending | ||
| 194 | the error output to a temporary file and then inserting the file into a | ||
| 195 | buffer. | ||
| 196 | @end table | ||
| 168 | 197 | ||
| 169 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays | 198 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays |
| 170 | the buffer as output is inserted. Otherwise the function does no | 199 | the buffer as output is inserted. Otherwise the function does no |
| @@ -216,16 +245,16 @@ of @code{call-process}: | |||
| 216 | @end smallexample | 245 | @end smallexample |
| 217 | @end defun | 246 | @end defun |
| 218 | 247 | ||
| 219 | @defun call-process-region start end program &optional delete buffer-or-name display &rest args | 248 | @defun call-process-region start end program &optional delete destination display &rest args |
| 220 | This function sends the text between @var{start} to @var{end} as | 249 | This function sends the text between @var{start} to @var{end} as |
| 221 | standard input to a process running @var{program}. It deletes the text | 250 | standard input to a process running @var{program}. It deletes the text |
| 222 | sent if @var{delete} is non-@code{nil}; this is useful when @var{buffer} | 251 | sent if @var{delete} is non-@code{nil}; this is useful when @var{buffer} |
| 223 | is @code{t}, to insert the output in the current buffer. | 252 | is @code{t}, to insert the output in the current buffer. |
| 224 | 253 | ||
| 225 | The arguments @var{buffer-or-name} and @var{display} control what to do | 254 | The arguments @var{destination} and @var{display} control what to do |
| 226 | with the output from the subprocess, and whether to update the display | 255 | with the output from the subprocess, and whether to update the display |
| 227 | as it comes in. For details, see the description of | 256 | as it comes in. For details, see the description of |
| 228 | @code{call-process}, above. If @var{buffer-or-name} is the integer 0, | 257 | @code{call-process}, above. If @var{destination} is the integer 0, |
| 229 | @code{call-process-region} discards the output and returns @code{nil} | 258 | @code{call-process-region} discards the output and returns @code{nil} |
| 230 | immediately, without waiting for the subprocess to finish. | 259 | immediately, without waiting for the subprocess to finish. |
| 231 | 260 | ||
| @@ -241,7 +270,7 @@ In the following example, we use @code{call-process-region} to run the | |||
| 241 | @code{cat} utility, with standard input being the first five characters | 270 | @code{cat} utility, with standard input being the first five characters |
| 242 | in buffer @samp{foo} (the word @samp{input}). @code{cat} copies its | 271 | in buffer @samp{foo} (the word @samp{input}). @code{cat} copies its |
| 243 | standard input into its standard output. Since the argument | 272 | standard input into its standard output. Since the argument |
| 244 | @var{buffer-or-name} is @code{t}, this output is inserted in the current | 273 | @var{destination} is @code{t}, this output is inserted in the current |
| 245 | buffer. | 274 | buffer. |
| 246 | 275 | ||
| 247 | @smallexample | 276 | @smallexample |
| @@ -390,6 +419,10 @@ with one subprocess by binding the variable around the call to | |||
| 390 | (start-process @dots{})) | 419 | (start-process @dots{})) |
| 391 | @end group | 420 | @end group |
| 392 | @end smallexample | 421 | @end smallexample |
| 422 | |||
| 423 | To determine whether a given subprocess actually got a pipe or a | ||
| 424 | @sc{pty}, use the function @code{process-tty-name} (@pxref{Process | ||
| 425 | Information}). | ||
| 393 | @end defvar | 426 | @end defvar |
| 394 | 427 | ||
| 395 | @node Deleting Processes | 428 | @node Deleting Processes |
| @@ -560,6 +593,13 @@ determine which of those it is.) If @var{process} has not yet | |||
| 560 | terminated, the value is 0. | 593 | terminated, the value is 0. |
| 561 | @end defun | 594 | @end defun |
| 562 | 595 | ||
| 596 | @defun process-tty-name process | ||
| 597 | This function returns the terminal name that @var{process} is using for | ||
| 598 | its communication with Emacs---or @code{nil} if it is using pipes | ||
| 599 | instead of a terminal (see @code{process-connection-type} in | ||
| 600 | @ref{Asynchronous Processes}). | ||
| 601 | @end defun | ||
| 602 | |||
| 563 | @node Input to Processes | 603 | @node Input to Processes |
| 564 | @section Sending Input to Processes | 604 | @section Sending Input to Processes |
| 565 | @cindex process input | 605 | @cindex process input |
| @@ -846,6 +886,13 @@ command would be unpredictable. If you want to permit quitting inside a | |||
| 846 | filter function, bind @code{inhibit-quit} to @code{nil}. | 886 | filter function, bind @code{inhibit-quit} to @code{nil}. |
| 847 | @xref{Quitting}. | 887 | @xref{Quitting}. |
| 848 | 888 | ||
| 889 | If an error happens during execution of a filter function, it is | ||
| 890 | caught automatically, so that it doesn't stop the execution of whatever | ||
| 891 | programs was running when the filter function was started. However, if | ||
| 892 | @code{debug-on-error} is non-@code{nil}, the error-catching is turned | ||
| 893 | off. This makes it possible to use the Lisp debugger to debug the | ||
| 894 | filter function. @xref{Debugger}. | ||
| 895 | |||
| 849 | Many filter functions sometimes or always insert the text in the | 896 | Many filter functions sometimes or always insert the text in the |
| 850 | process's buffer, mimicking the actions of Emacs when there is no | 897 | process's buffer, mimicking the actions of Emacs when there is no |
| 851 | filter. Such filter functions need to use @code{set-buffer} in order to | 898 | filter. Such filter functions need to use @code{set-buffer} in order to |
| @@ -1057,6 +1104,13 @@ matching had to explicitly save and restore the match data. Now Emacs | |||
| 1057 | does this automatically; sentinels never need to do it explicitly. | 1104 | does this automatically; sentinels never need to do it explicitly. |
| 1058 | @xref{Match Data}. | 1105 | @xref{Match Data}. |
| 1059 | 1106 | ||
| 1107 | 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 | programs was running when the sentinel was started. However, if | ||
| 1110 | @code{debug-on-error} is non-@code{nil}, the error-catching is turned | ||
| 1111 | off. This makes it possible to use the Lisp debugger to debug the | ||
| 1112 | sentinel. @xref{Debugger}. | ||
| 1113 | |||
| 1060 | @defun set-process-sentinel process sentinel | 1114 | @defun set-process-sentinel process sentinel |
| 1061 | This function associates @var{sentinel} with @var{process}. If | 1115 | This function associates @var{sentinel} with @var{process}. If |
| 1062 | @var{sentinel} is @code{nil}, then the process will have no sentinel. | 1116 | @var{sentinel} is @code{nil}, then the process will have no sentinel. |
diff --git a/lispref/searching.texi b/lispref/searching.texi index ec082152aad..7919804d35c 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi | |||
| @@ -17,6 +17,7 @@ portions of it. | |||
| 17 | * String Search:: Search for an exact match. | 17 | * String Search:: Search for an exact match. |
| 18 | * Regular Expressions:: Describing classes of strings. | 18 | * Regular Expressions:: Describing classes of strings. |
| 19 | * Regexp Search:: Searching for a match for a regexp. | 19 | * Regexp Search:: Searching for a match for a regexp. |
| 20 | * POSIX Regexps:: Searching POSIX-style for the longest match. | ||
| 20 | * Search and Replace:: Internals of @code{query-replace}. | 21 | * Search and Replace:: Internals of @code{query-replace}. |
| 21 | * Match Data:: Finding out which part of the text matched | 22 | * Match Data:: Finding out which part of the text matched |
| 22 | various parts of a regexp, after regexp search. | 23 | various parts of a regexp, after regexp search. |
| @@ -226,12 +227,12 @@ The next alternative is for @samp{a*} to match only two @samp{a}s. | |||
| 226 | With this choice, the rest of the regexp matches successfully.@refill | 227 | With this choice, the rest of the regexp matches successfully.@refill |
| 227 | 228 | ||
| 228 | Nested repetition operators can be extremely slow if they specify | 229 | Nested repetition operators can be extremely slow if they specify |
| 229 | backtracking loops. For example, @samp{\(x+y*\)*a} could take hours to | 230 | backtracking loops. For example, it could take hours for the regular |
| 230 | match the sequence @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}. The | 231 | expression @samp{\(x+y*\)*a} to match the sequence |
| 231 | slowness is because Emacs must try each imaginable way of grouping the | 232 | @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}. The slowness is because |
| 232 | 35 @samp{x}'s before concluding that none of them can work. To make | 233 | Emacs must try each imaginable way of grouping the 35 @samp{x}'s before |
| 233 | sure your regular expressions run fast, check nested repetitions | 234 | concluding that none of them can work. To make sure your regular |
| 234 | carefully. | 235 | expressions run fast, check nested repetitions carefully. |
| 235 | 236 | ||
| 236 | @item + | 237 | @item + |
| 237 | @cindex @samp{+} in regexp | 238 | @cindex @samp{+} in regexp |
| @@ -715,6 +716,48 @@ comes back" twice. | |||
| 715 | @end example | 716 | @end example |
| 716 | @end defun | 717 | @end defun |
| 717 | 718 | ||
| 719 | @node POSIX Regexps | ||
| 720 | @section POSIX Regular Expression Searching | ||
| 721 | |||
| 722 | The usual regular expression functions do backtracking when necessary | ||
| 723 | to handle the @samp{\|} and repetition constructs, but they continue | ||
| 724 | this only until they find @emph{some} match. Then they succeed and | ||
| 725 | report the first match found. | ||
| 726 | |||
| 727 | This section describes alternative search functions which perform the | ||
| 728 | full backtracking specified by the POSIX standard for regular expression | ||
| 729 | matching. They continue backtracking until they have tried all | ||
| 730 | possibilities and found all matches, so they can report the longest | ||
| 731 | match, as required by POSIX. This is much slower, so use these | ||
| 732 | functions only when you really need the longest match. | ||
| 733 | |||
| 734 | In Emacs versions prior to 19.29, these functions did not exist, and | ||
| 735 | the functions described above implemented full POSIX backtracking. | ||
| 736 | |||
| 737 | @defun posix-search-forward regexp &optional limit noerror repeat | ||
| 738 | This is like @code{re-search-forward} except that it performs the full | ||
| 739 | backtracking specified by the POSIX standard for regular expression | ||
| 740 | matching. | ||
| 741 | @end defun | ||
| 742 | |||
| 743 | @defun posix-search-backward regexp &optional limit noerror repeat | ||
| 744 | This is like @code{re-search-backward} except that it performs the full | ||
| 745 | backtracking specified by the POSIX standard for regular expression | ||
| 746 | matching. | ||
| 747 | @end defun | ||
| 748 | |||
| 749 | @defun posix-looking-at regexp | ||
| 750 | This is like @code{looking-at} except that it performs the full | ||
| 751 | backtracking specified by the POSIX standard for regular expression | ||
| 752 | matching. | ||
| 753 | @end defun | ||
| 754 | |||
| 755 | @defun posix-string-match regexp string &optional start | ||
| 756 | This is like @code{string-match} except that it performs the full | ||
| 757 | backtracking specified by the POSIX standard for regular expression | ||
| 758 | matching. | ||
| 759 | @end defun | ||
| 760 | |||
| 718 | @ignore | 761 | @ignore |
| 719 | @deffn Command delete-matching-lines regexp | 762 | @deffn Command delete-matching-lines regexp |
| 720 | This function is identical to @code{delete-non-matching-lines}, save | 763 | This function is identical to @code{delete-non-matching-lines}, save |
| @@ -909,34 +952,56 @@ match data around it, to prevent it from being overwritten. | |||
| 909 | @node Simple Match Data | 952 | @node Simple Match Data |
| 910 | @subsection Simple Match Data Access | 953 | @subsection Simple Match Data Access |
| 911 | 954 | ||
| 912 | This section explains how to use the match data to find the starting | 955 | This section explains how to use the match data to find out what was |
| 913 | point or ending point of the text that was matched by a particular | 956 | matched by the last search or match operation. |
| 914 | search, or by a particular parenthetical subexpression of a regular | 957 | |
| 915 | expression. | 958 | You can ask about the entire matching text, or about a particular |
| 959 | parenthetical subexpression of a regular expression. The @var{count} | ||
| 960 | argument in the functions below specifies which. If @var{count} is | ||
| 961 | zero, you are asking about the entire match. If @var{count} is | ||
| 962 | positive, it specifies which subexpression you want. | ||
| 963 | |||
| 964 | Recall that the subexpressions of a regular expression are those | ||
| 965 | expressions grouped with escaped parentheses, @samp{\(@dots{}\)}. The | ||
| 966 | @var{count}th subexpression is found by counting occurrences of | ||
| 967 | @samp{\(} from the beginning of the whole regular expression. The first | ||
| 968 | subexpression is numbered 1, the second 2, and so on. Only regular | ||
| 969 | expressions can have subexpressions---after a simple string search, the | ||
| 970 | only information available is about the entire match. | ||
| 971 | |||
| 972 | @defun match-string count &optional in-string | ||
| 973 | 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, | ||
| 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 | ||
| 977 | range, the value is @code{nil}. | ||
| 978 | |||
| 979 | 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 | argument @var{in-string}. Otherwise, after a buffer search or match, | ||
| 982 | you should omit @var{in-string} or pass @code{nil} for it; but you | ||
| 983 | should make sure that the current buffer when you call | ||
| 984 | @code{match-string} is the one in which you did the searching or | ||
| 985 | matching. | ||
| 986 | @end defun | ||
| 916 | 987 | ||
| 917 | @defun match-beginning count | 988 | @defun match-beginning count |
| 918 | This function returns the position of the start of text matched by the | 989 | This function returns the position of the start of text matched by the |
| 919 | last regular expression searched for, or a subexpression of it. | 990 | last regular expression searched for, or a subexpression of it. |
| 920 | 991 | ||
| 921 | If @var{count} is zero, then the value is the position of the start of | 992 | If @var{count} is zero, then the value is the position of the start of |
| 922 | the text matched by the whole regexp. Otherwise, @var{count}, specifies | 993 | the entire match. Otherwise, @var{count}, specifies a subexpression in |
| 923 | a subexpression in the regular expresion. The value of the function is | 994 | the regular expresion, and the value of the function is the starting |
| 924 | the starting position of the match for that subexpression. | 995 | position of the match for that subexpression. |
| 925 | 996 | ||
| 926 | Subexpressions of a regular expression are those expressions grouped | 997 | The value is @code{nil} for a subexpression inside a @samp{\|} |
| 927 | with escaped parentheses, @samp{\(@dots{}\)}. The @var{count}th | 998 | alternative that wasn't used in the match. |
| 928 | subexpression is found by counting occurrences of @samp{\(} from the | ||
| 929 | beginning of the whole regular expression. The first subexpression is | ||
| 930 | numbered 1, the second 2, and so on. | ||
| 931 | |||
| 932 | The value is @code{nil} for a subexpression inside a | ||
| 933 | @samp{\|} alternative that wasn't used in the match. | ||
| 934 | @end defun | 999 | @end defun |
| 935 | 1000 | ||
| 936 | @defun match-end count | 1001 | @defun match-end count |
| 937 | This function returns the position of the end of the text that matched | 1002 | This function is like @code{match-beginning} except that it returns the |
| 938 | the last regular expression searched for, or a subexpression of it. | 1003 | position of the end of the match, rather than the position of the |
| 939 | This function is otherwise similar to @code{match-beginning}. | 1004 | beginning. |
| 940 | @end defun | 1005 | @end defun |
| 941 | 1006 | ||
| 942 | Here is an example of using the match data, with a comment showing the | 1007 | Here is an example of using the match data, with a comment showing the |
| @@ -951,6 +1016,15 @@ positions within the text: | |||
| 951 | @end group | 1016 | @end group |
| 952 | 1017 | ||
| 953 | @group | 1018 | @group |
| 1019 | (match-string 0 "The quick fox jumped quickly.") | ||
| 1020 | @result{} "quick" | ||
| 1021 | (match-string 1 "The quick fox jumped quickly.") | ||
| 1022 | @result{} "qu" | ||
| 1023 | (match-string 2 "The quick fox jumped quickly.") | ||
| 1024 | @result{} "ick" | ||
| 1025 | @end group | ||
| 1026 | |||
| 1027 | @group | ||
| 954 | (match-beginning 1) ; @r{The beginning of the match} | 1028 | (match-beginning 1) ; @r{The beginning of the match} |
| 955 | @result{} 4 ; @r{with @samp{qu} is at index 4.} | 1029 | @result{} 4 ; @r{with @samp{qu} is at index 4.} |
| 956 | @end group | 1030 | @end group |
| @@ -1004,11 +1078,15 @@ character of the buffer counts as 1.) | |||
| 1004 | @var{replacement}. | 1078 | @var{replacement}. |
| 1005 | 1079 | ||
| 1006 | @cindex case in replacements | 1080 | @cindex case in replacements |
| 1007 | @defun replace-match replacement &optional fixedcase literal | 1081 | @defun replace-match replacement &optional fixedcase literal string |
| 1008 | This function replaces the buffer text matched by the last search, with | 1082 | This function replaces the text in the buffer (or in @var{string}) that |
| 1009 | @var{replacement}. It applies only to buffers; you can't use | 1083 | was matched by the last search. It replaces that text with |
| 1010 | @code{replace-match} to replace a substring found with | 1084 | @var{replacement}. |
| 1011 | @code{string-match}. | 1085 | |
| 1086 | If @var{string} is @code{nil}, @code{replace-match} does the replacement | ||
| 1087 | by editing the buffer; it leaves point at the end of the replacement | ||
| 1088 | text, and returns @code{t}. If @var{string} is a string, it does the | ||
| 1089 | replacement by constructing and returning a new string. | ||
| 1012 | 1090 | ||
| 1013 | If @var{fixedcase} is non-@code{nil}, then the case of the replacement | 1091 | If @var{fixedcase} is non-@code{nil}, then the case of the replacement |
| 1014 | text is not changed; otherwise, the replacement text is converted to a | 1092 | text is not changed; otherwise, the replacement text is converted to a |
| @@ -1044,9 +1122,6 @@ Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. | |||
| 1044 | @cindex @samp{\} in replacement | 1122 | @cindex @samp{\} in replacement |
| 1045 | @samp{\\} stands for a single @samp{\} in the replacement text. | 1123 | @samp{\\} stands for a single @samp{\} in the replacement text. |
| 1046 | @end table | 1124 | @end table |
| 1047 | |||
| 1048 | @code{replace-match} leaves point at the end of the replacement text, | ||
| 1049 | and returns @code{t}. | ||
| 1050 | @end defun | 1125 | @end defun |
| 1051 | 1126 | ||
| 1052 | @node Entire Match Data | 1127 | @node Entire Match Data |
| @@ -1239,19 +1314,27 @@ default value is @code{"^\014"} (i.e., @code{"^^L"} or @code{"^\C-l"}); | |||
| 1239 | this matches a line that starts with a formfeed character. | 1314 | this matches a line that starts with a formfeed character. |
| 1240 | @end defvar | 1315 | @end defvar |
| 1241 | 1316 | ||
| 1317 | The following two regular expressions should @emph{not} assume the | ||
| 1318 | 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 | ||
| 1320 | 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 | ||
| 1322 | matches that start after the left margin. In that case, a @samp{^} | ||
| 1323 | would be incorrect. | ||
| 1324 | |||
| 1242 | @defvar paragraph-separate | 1325 | @defvar paragraph-separate |
| 1243 | This is the regular expression for recognizing the beginning of a line | 1326 | This is the regular expression for recognizing the beginning of a line |
| 1244 | that separates paragraphs. (If you change this, you may have to | 1327 | that separates paragraphs. (If you change this, you may have to |
| 1245 | change @code{paragraph-start} also.) The default value is | 1328 | change @code{paragraph-start} also.) The default value is |
| 1246 | @w{@code{"^[@ \t\f]*$"}}, which matches a line that consists entirely of | 1329 | @w{@code{"[@ \t\f]*$"}}, which matches a line that consists entirely of |
| 1247 | spaces, tabs, and form feeds. | 1330 | spaces, tabs, and form feeds (after its left margin). |
| 1248 | @end defvar | 1331 | @end defvar |
| 1249 | 1332 | ||
| 1250 | @defvar paragraph-start | 1333 | @defvar paragraph-start |
| 1251 | This is the regular expression for recognizing the beginning of a line | 1334 | This is the regular expression for recognizing the beginning of a line |
| 1252 | that starts @emph{or} separates paragraphs. The default value is | 1335 | that starts @emph{or} separates paragraphs. The default value is |
| 1253 | @w{@code{"^[@ \t\n\f]"}}, which matches a line starting with a space, tab, | 1336 | @w{@code{"[@ \t\n\f]"}}, which matches a line starting with a space, tab, |
| 1254 | newline, or form feed. | 1337 | newline, or form feed (after its left margin). |
| 1255 | @end defvar | 1338 | @end defvar |
| 1256 | 1339 | ||
| 1257 | @defvar sentence-end | 1340 | @defvar sentence-end |
diff --git a/lispref/sequences.texi b/lispref/sequences.texi index c1e7f3dc2d0..0982b19c743 100644 --- a/lispref/sequences.texi +++ b/lispref/sequences.texi | |||
| @@ -462,11 +462,12 @@ existing vector. | |||
| 462 | @end group | 462 | @end group |
| 463 | @end example | 463 | @end example |
| 464 | 464 | ||
| 465 | When an argument is an integer (not a sequence of integers), it is | 465 | The @code{vconcat} function also allows integers as arguments. It |
| 466 | converted to a string of digits making up the decimal printed | 466 | converts them to strings of digits, making up the decimal print |
| 467 | representation of the integer. This special case exists for | 467 | representation of the integer, and then uses the strings instead of the |
| 468 | compatibility with Mocklisp, and we don't recommend you take advantage | 468 | original integers. @strong{Don't use this feature; we plan to eliminate |
| 469 | of it. If you want to convert an integer to digits in this way, use | 469 | it. If you already use this feature, change your programs now!} The |
| 470 | proper way to convert an integer to a decimal number in this way is with | ||
| 470 | @code{format} (@pxref{Formatting Strings}) or @code{number-to-string} | 471 | @code{format} (@pxref{Formatting Strings}) or @code{number-to-string} |
| 471 | (@pxref{String Conversion}). | 472 | (@pxref{String Conversion}). |
| 472 | 473 | ||
diff --git a/lispref/strings.texi b/lispref/strings.texi index 1ca59d81f69..a0321476dc0 100644 --- a/lispref/strings.texi +++ b/lispref/strings.texi | |||
| @@ -218,10 +218,10 @@ not @code{eq} to any existing string. | |||
| 218 | 218 | ||
| 219 | When an argument is an integer (not a sequence of integers), it is | 219 | When an argument is an integer (not a sequence of integers), it is |
| 220 | converted to a string of digits making up the decimal printed | 220 | converted to a string of digits making up the decimal printed |
| 221 | representation of the integer. @string{Don't use this feature---it | 221 | representation of the integer. @strong{Don't use this feature; we plan |
| 222 | exists for historical compatibility only, and we plan to change it by | 222 | to eliminate it. If you already use this feature, change your programs |
| 223 | and by.} If you wish to convert an integer to a decimal number in this | 223 | now!} The proper way to convert an integer to a decimal number in this |
| 224 | way, use @code{format} (@pxref{Formatting Strings}) or | 224 | way is with @code{format} (@pxref{Formatting Strings}) or |
| 225 | @code{number-to-string} (@pxref{String Conversion}). | 225 | @code{number-to-string} (@pxref{String Conversion}). |
| 226 | 226 | ||
| 227 | @example | 227 | @example |
| @@ -270,6 +270,10 @@ match exactly; case is significant. | |||
| 270 | (string= "ab" "ABC") | 270 | (string= "ab" "ABC") |
| 271 | @result{} nil | 271 | @result{} nil |
| 272 | @end example | 272 | @end example |
| 273 | |||
| 274 | The function @code{string=} ignores the text properties of the | ||
| 275 | two strings. To compare strings in a way that compares their text | ||
| 276 | properties also, use @code{equal} (@pxref{Equality Predicates}). | ||
| 273 | @end defun | 277 | @end defun |
| 274 | 278 | ||
| 275 | @defun string-equal string1 string2 | 279 | @defun string-equal string1 string2 |
diff --git a/lispref/symbols.texi b/lispref/symbols.texi index f3d13ebdad7..caba9a9bd7e 100644 --- a/lispref/symbols.texi +++ b/lispref/symbols.texi | |||
| @@ -350,6 +350,20 @@ See @code{documentation} in @ref{Accessing Documentation}, for another | |||
| 350 | example using @code{mapatoms}. | 350 | example using @code{mapatoms}. |
| 351 | @end defun | 351 | @end defun |
| 352 | 352 | ||
| 353 | @defun unintern symbol &optional obarray | ||
| 354 | This function deletes @var{symbol} from the obarray @var{obarray}. If | ||
| 355 | @code{symbol} is not actually in the obarray, @code{unintern} does | ||
| 356 | nothing. If @var{obarray} is @code{nil}, the current obarray is used. | ||
| 357 | |||
| 358 | If you provide a string instead of a symbol as @var{symbol}, it stands | ||
| 359 | for a symbol name. Then @code{unintern} deletes the symbol (if any) in | ||
| 360 | the obarray which has that name. If there is no such symbol, | ||
| 361 | @code{unintern} does nothing. | ||
| 362 | |||
| 363 | If @code{unintern} does delete a symbol, it returns @code{t}. Otherwise | ||
| 364 | it returns @code{nil}. | ||
| 365 | @end defun | ||
| 366 | |||
| 353 | @node Property Lists,, Creating Symbols, Symbols | 367 | @node Property Lists,, Creating Symbols, Symbols |
| 354 | @section Property Lists | 368 | @section Property Lists |
| 355 | @cindex property list | 369 | @cindex property list |
| @@ -379,6 +393,16 @@ objects, but the names are usually symbols. They are compared using | |||
| 379 | Here @code{lisp-indent-function} and @code{byte-compile} are property | 393 | Here @code{lisp-indent-function} and @code{byte-compile} are property |
| 380 | names, and the other two elements are the corresponding values. | 394 | names, and the other two elements are the corresponding values. |
| 381 | 395 | ||
| 396 | @menu | ||
| 397 | * Plists and Alists:: Comparison of the advantages of property | ||
| 398 | lists and association lists. | ||
| 399 | * Symbol Plists:: Functions to access symbols' property lists. | ||
| 400 | * Other Plists:: Accessing property lists stored elsewhere. | ||
| 401 | @end menu | ||
| 402 | |||
| 403 | @node Plists and Alists | ||
| 404 | @subsection Property Lists and Association Lists | ||
| 405 | |||
| 382 | @cindex property lists vs association lists | 406 | @cindex property lists vs association lists |
| 383 | Association lists (@pxref{Association Lists}) are very similar to | 407 | Association lists (@pxref{Association Lists}) are very similar to |
| 384 | property lists. In contrast to association lists, the order of the | 408 | property lists. In contrast to association lists, the order of the |
| @@ -408,12 +432,15 @@ name.) An association list may be used like a stack where associations | |||
| 408 | are pushed on the front of the list and later discarded; this is not | 432 | are pushed on the front of the list and later discarded; this is not |
| 409 | possible with a property list. | 433 | possible with a property list. |
| 410 | 434 | ||
| 435 | @node Symbol Plists | ||
| 436 | @subsection Property List Functions for Symbols | ||
| 437 | |||
| 411 | @defun symbol-plist symbol | 438 | @defun symbol-plist symbol |
| 412 | This function returns the property list of @var{symbol}. | 439 | This function returns the property list of @var{symbol}. |
| 413 | @end defun | 440 | @end defun |
| 414 | 441 | ||
| 415 | @defun setplist symbol plist | 442 | @defun setplist symbol plist |
| 416 | This function sets @var{symbol}'s property list to @var{plist}. | 443 | This function sets @var{symbol}'s property list to @var{plist}. |
| 417 | Normally, @var{plist} should be a well-formed property list, but this is | 444 | Normally, @var{plist} should be a well-formed property list, but this is |
| 418 | not enforced. | 445 | not enforced. |
| 419 | 446 | ||
| @@ -458,3 +485,37 @@ The @code{put} function returns @var{value}. | |||
| 458 | @result{} (verb transitive noun (a buzzing little bug)) | 485 | @result{} (verb transitive noun (a buzzing little bug)) |
| 459 | @end smallexample | 486 | @end smallexample |
| 460 | @end defun | 487 | @end defun |
| 488 | |||
| 489 | @node Other Plists | ||
| 490 | @subsection Property Lists Outside Symbols | ||
| 491 | |||
| 492 | These two functions are useful for manipulating property lists | ||
| 493 | that are stored in places other than symbols: | ||
| 494 | |||
| 495 | @defun plist-get plist property | ||
| 496 | This returns the value of the @var{property} property | ||
| 497 | stored in the property list @var{plist}. For example, | ||
| 498 | |||
| 499 | @example | ||
| 500 | (plist-get '(foo 4) 'foo) | ||
| 501 | @result{} 4 | ||
| 502 | @end example | ||
| 503 | @end defun | ||
| 504 | |||
| 505 | @defun plist-put plist property value | ||
| 506 | This stores @var{value} as the value of the @var{property} property | ||
| 507 | stored in the property list @var{plist}. It may modify @var{plist} | ||
| 508 | destructively, or it may construct new list structure without altering | ||
| 509 | the old. The function returns the modified property list, so you can | ||
| 510 | store that back in the place where you got @var{plist}. For example, | ||
| 511 | |||
| 512 | @example | ||
| 513 | (setq my-plist '(bar t foo 4)) | ||
| 514 | @result{} (bar t foo 4) | ||
| 515 | (setq my-plist (plist-put my-plist 'foo 69)) | ||
| 516 | @result{} (bar t foo 69) | ||
| 517 | (setq my-plist (plist-put my-plist 'quux '(a))) | ||
| 518 | @result{} (quux (a) bar t foo 5) | ||
| 519 | @end example | ||
| 520 | @end defun | ||
| 521 | |||
diff --git a/lispref/text.texi b/lispref/text.texi index 6153bdb69f1..eefd2c30259 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -156,6 +156,11 @@ It is not necessary for @var{start} to be less than @var{end}; the | |||
| 156 | arguments can be given in either order. But most often the smaller | 156 | arguments can be given in either order. But most often the smaller |
| 157 | argument is written first. | 157 | argument is written first. |
| 158 | 158 | ||
| 159 | If the text being copied has any text properties, these are copied into | ||
| 160 | the string along with the characters they belong to. @xref{Text | ||
| 161 | Properties}. However, overlays (@pxref{Overlays}) in the buffer and | ||
| 162 | their properties are ignored, not copied. | ||
| 163 | |||
| 159 | @example | 164 | @example |
| 160 | @group | 165 | @group |
| 161 | ---------- Buffer: foo ---------- | 166 | ---------- Buffer: foo ---------- |
| @@ -176,6 +181,24 @@ This is the contents of buffer foo | |||
| 176 | @end example | 181 | @end example |
| 177 | @end defun | 182 | @end defun |
| 178 | 183 | ||
| 184 | @defun buffer-substring-without-properties start end | ||
| 185 | This is like @code{buffer-substring}, except that it does not copy text | ||
| 186 | properties, just the characters themselves. @xref{Text Properties}. | ||
| 187 | Here's an example of using this function to get a word to look up in an | ||
| 188 | alist: | ||
| 189 | |||
| 190 | @example | ||
| 191 | (setq flammable | ||
| 192 | (assoc (buffer-substring start end) | ||
| 193 | '(("wood" . t) ("paper" . t) | ||
| 194 | ("steel" . nil) ("asbestos" . nil)))) | ||
| 195 | @end example | ||
| 196 | |||
| 197 | If this were written using @code{buffer-substring} instead, it would not | ||
| 198 | work reliably; any text properties that happened to be in the word | ||
| 199 | copied from the buffer would make the comparisons fail. | ||
| 200 | @end defun | ||
| 201 | |||
| 179 | @defun buffer-string | 202 | @defun buffer-string |
| 180 | This function returns the contents of the accessible portion of the | 203 | This function returns the contents of the accessible portion of the |
| 181 | current buffer as a string. This is the portion between | 204 | current buffer as a string. This is the portion between |
| @@ -343,18 +366,17 @@ it except to install it on a keymap. | |||
| 343 | 366 | ||
| 344 | In an interactive call, @var{count} is the numeric prefix argument. | 367 | In an interactive call, @var{count} is the numeric prefix argument. |
| 345 | 368 | ||
| 346 | This function calls @code{auto-fill-function} if the current column number | 369 | This command calls @code{auto-fill-function} whenever that is |
| 347 | is greater than the value of @code{fill-column} and the character | 370 | non-@code{nil} and the character inserted is a space or a newline |
| 348 | inserted is a space (@pxref{Auto Filling}). | 371 | (@pxref{Auto Filling}). |
| 349 | 372 | ||
| 350 | @c Cross refs reworded to prevent overfull hbox. --rjc 15mar92 | 373 | @c Cross refs reworded to prevent overfull hbox. --rjc 15mar92 |
| 351 | This function performs abbrev expansion if Abbrev mode is enabled and | 374 | This command performs abbrev expansion if Abbrev mode is enabled and |
| 352 | the inserted character does not have word-constituent | 375 | the inserted character does not have word-constituent |
| 353 | syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.) | 376 | syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.) |
| 354 | 377 | ||
| 355 | This function is also responsible for calling | 378 | This is also responsible for calling @code{blink-paren-function} when |
| 356 | @code{blink-paren-function} when the inserted character has close | 379 | the inserted character has close parenthesis syntax (@pxref{Blinking}). |
| 357 | parenthesis syntax (@pxref{Blinking}). | ||
| 358 | @end deffn | 380 | @end deffn |
| 359 | 381 | ||
| 360 | @deffn Command newline &optional number-of-newlines | 382 | @deffn Command newline &optional number-of-newlines |
| @@ -710,6 +732,9 @@ the kill ring, but does not delete the text from the buffer. It returns | |||
| 710 | @code{nil}. It also indicates the extent of the text copied by moving | 732 | @code{nil}. It also indicates the extent of the text copied by moving |
| 711 | the cursor momentarily, or by displaying a message in the echo area. | 733 | the cursor momentarily, or by displaying a message in the echo area. |
| 712 | 734 | ||
| 735 | 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. | ||
| 737 | |||
| 713 | Don't call @code{copy-region-as-kill} in Lisp programs unless you aim to | 738 | Don't call @code{copy-region-as-kill} in Lisp programs unless you aim to |
| 714 | support Emacs 18. For Emacs 19, it is better to use @code{kill-new} or | 739 | support Emacs 18. For Emacs 19, it is better to use @code{kill-new} or |
| 715 | @code{kill-append} instead. @xref{Low-Level Kill Ring}. | 740 | @code{kill-append} instead. @xref{Low-Level Kill Ring}. |
| @@ -1073,8 +1098,11 @@ specified width. The width is controlled by the variable | |||
| 1073 | automatically as you insert it, but changes to existing text may leave | 1098 | automatically as you insert it, but changes to existing text may leave |
| 1074 | it improperly filled. Then you must fill the text explicitly. | 1099 | it improperly filled. Then you must fill the text explicitly. |
| 1075 | 1100 | ||
| 1076 | Most of the functions in this section return values that are not | 1101 | Most of the commands in this section return values that are not |
| 1077 | meaningful. | 1102 | meaningful. All the functions that do filling take note of the current |
| 1103 | left margin, current right margin, and current justification style. If | ||
| 1104 | the current justification style is @code{none}, the filling functions | ||
| 1105 | don't actually do anything. | ||
| 1078 | 1106 | ||
| 1079 | @deffn Command fill-paragraph justify-flag | 1107 | @deffn Command fill-paragraph justify-flag |
| 1080 | @cindex filling a paragraph | 1108 | @cindex filling a paragraph |
| @@ -1123,8 +1151,11 @@ described above. | |||
| 1123 | This command considers a region of text as a paragraph and fills it. If | 1151 | This command considers a region of text as a paragraph and fills it. If |
| 1124 | the region was made up of many paragraphs, the blank lines between | 1152 | the region was made up of many paragraphs, the blank lines between |
| 1125 | paragraphs are removed. This function justifies as well as filling when | 1153 | paragraphs are removed. This function justifies as well as filling when |
| 1126 | @var{justify-flag} is non-@code{nil}. In an interactive call, any | 1154 | @var{justify-flag} is non-@code{nil}. The precise value of |
| 1127 | prefix argument requests justification. | 1155 | @var{justify-flag} specifies a style of justification, as in |
| 1156 | @code{justify-current-line}, below. | ||
| 1157 | |||
| 1158 | In an interactive call, any prefix argument requests justification. | ||
| 1128 | 1159 | ||
| 1129 | In Adaptive Fill mode, which is enabled by default, | 1160 | In Adaptive Fill mode, which is enabled by default, |
| 1130 | @code{fill-region-as-paragraph} on an indented paragraph when there is | 1161 | @code{fill-region-as-paragraph} on an indented paragraph when there is |
| @@ -1132,12 +1163,38 @@ no fill prefix uses the indentation of the second line of the paragraph | |||
| 1132 | as the fill prefix. | 1163 | as the fill prefix. |
| 1133 | @end deffn | 1164 | @end deffn |
| 1134 | 1165 | ||
| 1135 | @deffn Command justify-current-line | 1166 | @deffn Command justify-current-line how eop nosqueeze |
| 1136 | This command inserts spaces between the words of the current line so | 1167 | This command inserts spaces between the words of the current line so |
| 1137 | that the line ends exactly at @code{fill-column}. It returns | 1168 | that the line ends exactly at @code{fill-column}. It returns |
| 1138 | @code{nil}. | 1169 | @code{nil}. |
| 1170 | |||
| 1171 | The argument @var{how}, if non-@code{nil} specifies explicitly the style | ||
| 1172 | of justification. It can be @code{left}, @code{right}, @code{full}, | ||
| 1173 | @code{center}, or @code{none}. If it is @code{t}, that means to do | ||
| 1174 | follow specified justification style (see @code{current-justification}, | ||
| 1175 | below). @code{nil} means to do full justification. | ||
| 1176 | |||
| 1177 | If @var{eop} is non-@code{nil}, that means do left-justification when | ||
| 1178 | @code{current-justification} specifies full justification. This is used | ||
| 1179 | for the last line of a paragraph; even if the paragraph as a whole is | ||
| 1180 | fully justified, the last line should not be. | ||
| 1181 | |||
| 1182 | If @var{nosqueeze} is non-@code{nil}, that means do not change interior | ||
| 1183 | whitespace. | ||
| 1139 | @end deffn | 1184 | @end deffn |
| 1140 | 1185 | ||
| 1186 | @defopt default-justification | ||
| 1187 | 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 | ||
| 1189 | values are @code{left}, @code{right}, @code{full}, @code{center}, or | ||
| 1190 | @code{none}. | ||
| 1191 | @end defopt | ||
| 1192 | |||
| 1193 | @defun current-justification | ||
| 1194 | This function returns the proper justification style to use for filling | ||
| 1195 | the text around point. | ||
| 1196 | @end defun | ||
| 1197 | |||
| 1141 | @defopt fill-prefix | 1198 | @defopt fill-prefix |
| 1142 | This variable specifies a string of text that appears at the beginning | 1199 | This variable specifies a string of text that appears at the beginning |
| 1143 | of normal text lines and should be disregarded when filling them. Any | 1200 | of normal text lines and should be disregarded when filling them. Any |
| @@ -1168,6 +1225,67 @@ buffers that do not override it. This is the same as | |||
| 1168 | The default value for @code{default-fill-column} is 70. | 1225 | The default value for @code{default-fill-column} is 70. |
| 1169 | @end defvar | 1226 | @end defvar |
| 1170 | 1227 | ||
| 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 | ||
| 1246 | 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 | ||
| 1248 | command also refills the region to fit the new margin. | ||
| 1249 | @end deffn | ||
| 1250 | |||
| 1251 | @deffn Command set-right-margin from to margin | ||
| 1252 | This sets the @code{fill-colmn} property on the text from @var{from} to | ||
| 1253 | @var{to} so as to yield a right margin of width @var{margin}. If Auto | ||
| 1254 | Fill mode is enabled, this command also refills the region to fit the | ||
| 1255 | new margin. | ||
| 1256 | @end deffn | ||
| 1257 | |||
| 1258 | @defun current-left-margin | ||
| 1259 | 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} | ||
| 1261 | 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}. | ||
| 1263 | @end defun | ||
| 1264 | |||
| 1265 | @defun current-fill-column | ||
| 1266 | This function returns the proper fill column value to use for filling | ||
| 1267 | the text around point. The value is the value of the @code{fill-column} | ||
| 1268 | variable, minus the value of the @code{right-margin} property of the | ||
| 1269 | character after point. | ||
| 1270 | @end defun | ||
| 1271 | |||
| 1272 | @deffn Command move-to-left-margin &optional n force | ||
| 1273 | This function moves point to the left margin of the current line. The | ||
| 1274 | column moved to is determined by calling the function | ||
| 1275 | @code{current-left-margin}. If the argument @var{n} is specified, | ||
| 1276 | @code{move-to-left-margin} moves forward @var{n}@minus{}1 lines first. | ||
| 1277 | |||
| 1278 | If @var{force} is non-@code{nil}, that says to fix the line's | ||
| 1279 | indentation if that doesn't match the left margin value. | ||
| 1280 | @end deffn | ||
| 1281 | |||
| 1282 | @defun delete-to-left-margin from to | ||
| 1283 | This function removes left margin indentation from the text | ||
| 1284 | between @var{from} and @var{to}. The amount of indentation | ||
| 1285 | to delete is determined by calling @code{current-left-margin}. | ||
| 1286 | In no case does this function delete non-whitespace. | ||
| 1287 | @end defun | ||
| 1288 | |||
| 1171 | @node Auto Filling | 1289 | @node Auto Filling |
| 1172 | @comment node-name, next, previous, up | 1290 | @comment node-name, next, previous, up |
| 1173 | @section Auto Filling | 1291 | @section Auto Filling |
| @@ -1180,10 +1298,9 @@ For a description of functions that you can call explicitly to fill and | |||
| 1180 | justify existing text, see @ref{Filling}. | 1298 | justify existing text, see @ref{Filling}. |
| 1181 | 1299 | ||
| 1182 | @defvar auto-fill-function | 1300 | @defvar auto-fill-function |
| 1183 | The value of this variable should be a function (of no arguments) to | 1301 | The value of this variable should be a function (of no arguments) to be |
| 1184 | be called after self-inserting a space at a column beyond | 1302 | called after self-inserting a space or a newline. It may be @code{nil}, |
| 1185 | @code{fill-column}. It may be @code{nil}, in which case nothing | 1303 | in which case nothing special is done in that case. |
| 1186 | special is done. | ||
| 1187 | 1304 | ||
| 1188 | The value of @code{auto-fill-function} is @code{do-auto-fill} when | 1305 | The value of @code{auto-fill-function} is @code{do-auto-fill} when |
| 1189 | Auto-Fill mode is enabled. That is a function whose sole purpose is to | 1306 | Auto-Fill mode is enabled. That is a function whose sole purpose is to |
| @@ -1935,6 +2052,7 @@ along with the characters; this includes such diverse functions as | |||
| 1935 | * Changing Properties:: Setting the properties of a range of text. | 2052 | * Changing Properties:: Setting the properties of a range of text. |
| 1936 | * Property Search:: Searching for where a property changes value. | 2053 | * Property Search:: Searching for where a property changes value. |
| 1937 | * Special Properties:: Particular properties with special meanings. | 2054 | * Special Properties:: Particular properties with special meanings. |
| 2055 | * Format Properties:: Properties for representing formatting of text. | ||
| 1938 | * Sticky Properties:: How inserted text gets properties from | 2056 | * Sticky Properties:: How inserted text gets properties from |
| 1939 | neighboring text. | 2057 | neighboring text. |
| 1940 | * Saving Properties:: Saving text properties in files, and reading | 2058 | * Saving Properties:: Saving text properties in files, and reading |
| @@ -1986,6 +2104,22 @@ This function returns the entire property list of the character at | |||
| 1986 | @code{nil}, it defaults to the current buffer. | 2104 | @code{nil}, it defaults to the current buffer. |
| 1987 | @end defun | 2105 | @end defun |
| 1988 | 2106 | ||
| 2107 | @defvar default-text-properties | ||
| 2108 | This variable holds a property list giving default values for text | ||
| 2109 | 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 | ||
| 2111 | example: | ||
| 2112 | |||
| 2113 | @example | ||
| 2114 | (setq default-text-properties '(foo 69)) | ||
| 2115 | ;; @r{Make sure character 1 has no properties of its own.} | ||
| 2116 | (set-text-properties 1 2 nil) | ||
| 2117 | ;; @r{What we get, when we ask, is the default value.} | ||
| 2118 | (get-text-property 1 'foo) | ||
| 2119 | @result{} 69 | ||
| 2120 | @end example | ||
| 2121 | @end defvar | ||
| 2122 | |||
| 1989 | @node Changing Properties | 2123 | @node Changing Properties |
| 1990 | @subsection Changing Text Properties | 2124 | @subsection Changing Text Properties |
| 1991 | 2125 | ||
| @@ -2068,6 +2202,10 @@ from the specified range of text. Here's an example: | |||
| 2068 | @end example | 2202 | @end example |
| 2069 | @end defun | 2203 | @end defun |
| 2070 | 2204 | ||
| 2205 | See also the function @code{buffer-substring-without-properties} | ||
| 2206 | (@pxref{Buffer Contents}) which copies text from the buffer | ||
| 2207 | but does not copy its properties. | ||
| 2208 | |||
| 2071 | @node Property Search | 2209 | @node Property Search |
| 2072 | @subsection Property Search Functions | 2210 | @subsection Property Search Functions |
| 2073 | 2211 | ||
| @@ -2188,9 +2326,9 @@ of the symbol serve as defaults for the properties of the character. | |||
| 2188 | @cindex face codes of text | 2326 | @cindex face codes of text |
| 2189 | @kindex face @r{(text property)} | 2327 | @kindex face @r{(text property)} |
| 2190 | You can use the property @code{face} to control the font and color of | 2328 | You can use the property @code{face} to control the font and color of |
| 2191 | text. @xref{Faces}, for more information. This feature is temporary; | 2329 | text. Its value is a face name or a list of face names. @xref{Faces}, |
| 2192 | in the future, we may replace it with other ways of specifying how to | 2330 | for more information. This feature may be temporary; in the future, we |
| 2193 | display text. | 2331 | may replace it with other ways of specifying how to display text. |
| 2194 | 2332 | ||
| 2195 | @item mouse-face | 2333 | @item mouse-face |
| 2196 | @kindex mouse-face @r{(text property)} | 2334 | @kindex mouse-face @r{(text property)} |
| @@ -2225,16 +2363,19 @@ and then remove the property. @xref{Read Only Buffers}. | |||
| 2225 | 2363 | ||
| 2226 | @item invisible | 2364 | @item invisible |
| 2227 | @kindex invisible @r{(text property)} | 2365 | @kindex invisible @r{(text property)} |
| 2228 | A non-@code{nil} @code{invisible} property means a character does not | 2366 | A non-@code{nil} @code{invisible} property can make a character invisible |
| 2229 | appear on the screen. This works much like selective display. Details | 2367 | on the screen. @xref{Invisible Text}, for details. |
| 2230 | of this feature are likely to change in future versions, so check the | ||
| 2231 | @file{etc/NEWS} file in the version you are using. | ||
| 2232 | 2368 | ||
| 2233 | @item intangible | 2369 | @item intangible |
| 2234 | @kindex intangible @r{(text property)} | 2370 | @kindex intangible @r{(text property)} |
| 2235 | A non-@code{nil} @code{intangible} property on a character prevents | 2371 | If a group of consecutive characters have equal and non-@code{nil} |
| 2236 | putting point before that character. If you try, point actually goes | 2372 | @code{intangible} properties, then you cannot place point between them. |
| 2237 | after the character (and after all succeeding intangible characters). | 2373 | If you move point forward into the group, point actually moves to the |
| 2374 | end of the group. If you try to move point backward into the group, | ||
| 2375 | point actually moves to the start of the group. | ||
| 2376 | |||
| 2377 | When the variable @code{inhibit-point-motion-hooks} is non-@code{nil}, | ||
| 2378 | the @code{intangible} property is ignored. | ||
| 2238 | 2379 | ||
| 2239 | @item modification-hooks | 2380 | @item modification-hooks |
| 2240 | @cindex change hooks for a character | 2381 | @cindex change hooks for a character |
| @@ -2298,9 +2439,36 @@ value of point runs these hook functions. | |||
| 2298 | 2439 | ||
| 2299 | @defvar inhibit-point-motion-hooks | 2440 | @defvar inhibit-point-motion-hooks |
| 2300 | When this variable is non-@code{nil}, @code{point-left} and | 2441 | When this variable is non-@code{nil}, @code{point-left} and |
| 2301 | @code{point-entered} hooks are not run. | 2442 | @code{point-entered} hooks are not run, and the @code{intangible} |
| 2443 | property has no effect. | ||
| 2302 | @end defvar | 2444 | @end defvar |
| 2303 | 2445 | ||
| 2446 | @node Format Properties | ||
| 2447 | @section Formatted Text Properties | ||
| 2448 | |||
| 2449 | These text properties affect the behavior of the fill commands. They | ||
| 2450 | are used for representing formatted text. @xref{Filling}. | ||
| 2451 | |||
| 2452 | @table code | ||
| 2453 | @item hard | ||
| 2454 | 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 | ||
| 2456 | across them. However, this property takes effect only if the variable | ||
| 2457 | @code{use-hard-newlines} is non-@code{nil}. | ||
| 2458 | |||
| 2459 | @item right-margin | ||
| 2460 | This property specifies the right margin for filling this part of the | ||
| 2461 | text. | ||
| 2462 | |||
| 2463 | @item left-margin | ||
| 2464 | This property specifies the left margin for filling this part of the | ||
| 2465 | text. | ||
| 2466 | |||
| 2467 | @item justification | ||
| 2468 | This property specifies the style of justification for filling this part | ||
| 2469 | of the text. | ||
| 2470 | @end table | ||
| 2471 | |||
| 2304 | @node Sticky Properties | 2472 | @node Sticky Properties |
| 2305 | @subsection Stickiness of Text Properties | 2473 | @subsection Stickiness of Text Properties |
| 2306 | @cindex sticky text properties | 2474 | @cindex sticky text properties |
diff --git a/lispref/variables.texi b/lispref/variables.texi index cc69742be50..fb08a390c6d 100644 --- a/lispref/variables.texi +++ b/lispref/variables.texi | |||
| @@ -708,6 +708,39 @@ always affects the most local existing binding. | |||
| 708 | @end quotation | 708 | @end quotation |
| 709 | @end defun | 709 | @end defun |
| 710 | 710 | ||
| 711 | One other function for setting a variable is designed to add | ||
| 712 | an element to a list if it is not already present in the list. | ||
| 713 | |||
| 714 | @defun add-to-list symbol element | ||
| 715 | 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 | ||
| 717 | value. The value of @var{symbol} had better be a list already. | ||
| 718 | |||
| 719 | Here's a scenario showing how to use @code{add-to-list}: | ||
| 720 | |||
| 721 | @example | ||
| 722 | (setq foo '(a b)) | ||
| 723 | @result{} (a b) | ||
| 724 | |||
| 725 | (add-to-list 'foo 'c) ;; @r{Add @code{c}.} | ||
| 726 | @result{} (c a b) | ||
| 727 | |||
| 728 | (add-to-list 'foo 'b) ;; @r{No effect.} | ||
| 729 | @result{} (c a b) | ||
| 730 | |||
| 731 | foo ;; @r{@code{foo} was changed.} | ||
| 732 | @result{} (c a b) | ||
| 733 | @end example | ||
| 734 | @end defun | ||
| 735 | |||
| 736 | An equivalent expression for @code{(add-to-list '@var{var} | ||
| 737 | @var{value})} is this: | ||
| 738 | |||
| 739 | @example | ||
| 740 | (or (member @var{value} @var{var}) | ||
| 741 | (setq @var{var} (cons @var{value} @var{var}))) | ||
| 742 | @end example | ||
| 743 | |||
| 711 | @node Variable Scoping | 744 | @node Variable Scoping |
| 712 | @section Scoping Rules for Variable Bindings | 745 | @section Scoping Rules for Variable Bindings |
| 713 | 746 | ||
| @@ -921,7 +954,8 @@ languages in one form or another. Emacs also supports another, unusual | |||
| 921 | kind of variable binding: @dfn{buffer-local} bindings, which apply only | 954 | kind of variable binding: @dfn{buffer-local} bindings, which apply only |
| 922 | to one buffer. Emacs Lisp is meant for programming editing commands, | 955 | to one buffer. Emacs Lisp is meant for programming editing commands, |
| 923 | and having different values for a variable in different buffers is an | 956 | and having different values for a variable in different buffers is an |
| 924 | important customization method. | 957 | important customization method. (A few variables have bindings that |
| 958 | are local to a given X terminal; see @ref{Multiple Displays}.) | ||
| 925 | 959 | ||
| 926 | @menu | 960 | @menu |
| 927 | * Intro to Buffer-Local:: Introduction and concepts. | 961 | * Intro to Buffer-Local:: Introduction and concepts. |
| @@ -1072,6 +1106,9 @@ Making a variable buffer-local within a @code{let}-binding for that | |||
| 1072 | variable does not work. This is because @code{let} does not distinguish | 1106 | variable does not work. This is because @code{let} does not distinguish |
| 1073 | between different kinds of bindings; it knows only which variable the | 1107 | between different kinds of bindings; it knows only which variable the |
| 1074 | binding was made for. | 1108 | binding was made for. |
| 1109 | |||
| 1110 | @strong{Note:} do not use @code{make-local-variable} for a hook | ||
| 1111 | variable. Instead, use @code{make-local-hook}. @xref{Hooks}. | ||
| 1075 | @end deffn | 1112 | @end deffn |
| 1076 | 1113 | ||
| 1077 | @deffn Command make-variable-buffer-local variable | 1114 | @deffn Command make-variable-buffer-local variable |
| @@ -1116,6 +1153,12 @@ Note that storing new values into the @sc{cdr}s of cons cells in this | |||
| 1116 | list does @emph{not} change the local values of the variables. | 1153 | list does @emph{not} change the local values of the variables. |
| 1117 | @end defun | 1154 | @end defun |
| 1118 | 1155 | ||
| 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 | |||
| 1119 | @deffn Command kill-local-variable variable | 1162 | @deffn Command kill-local-variable variable |
| 1120 | This function deletes the buffer-local binding (if any) for | 1163 | This function deletes the buffer-local binding (if any) for |
| 1121 | @var{variable} (a symbol) in the current buffer. As a result, the | 1164 | @var{variable} (a symbol) in the current buffer. As a result, the |
| @@ -1277,4 +1320,3 @@ evaluated. | |||
| 1277 | @end group | 1320 | @end group |
| 1278 | @end example | 1321 | @end example |
| 1279 | @end defun | 1322 | @end defun |
| 1280 | |||
diff --git a/lispref/windows.texi b/lispref/windows.texi index 708862ab18b..b1dcd2d6e0e 100644 --- a/lispref/windows.texi +++ b/lispref/windows.texi | |||
| @@ -659,8 +659,10 @@ Contrast this with @code{set-buffer}, which makes @var{buffer-or-name} | |||
| 659 | the current buffer but does not display it in the selected window. | 659 | the current buffer but does not display it in the selected window. |
| 660 | @xref{Current Buffer}. | 660 | @xref{Current Buffer}. |
| 661 | 661 | ||
| 662 | If @var{buffer-or-name} does not identify an existing buffer, then | 662 | If @var{buffer-or-name} does not identify an existing buffer, then a new |
| 663 | a new buffer by that name is created. | 663 | buffer by that name is created. The major mode for the new buffer is |
| 664 | set according to the variable @code{default-major-mode}. @xref{Auto | ||
| 665 | Major Mode}. | ||
| 664 | 666 | ||
| 665 | Normally the specified buffer is put at the front of the buffer list. | 667 | Normally the specified buffer is put at the front of the buffer list. |
| 666 | This affects the operation of @code{other-buffer}. However, if | 668 | This affects the operation of @code{other-buffer}. However, if |
| @@ -715,7 +717,9 @@ already displayed in the selected window and @var{other-window} is | |||
| 715 | for @var{buffer-or-name}, so that nothing needs to be done. | 717 | for @var{buffer-or-name}, so that nothing needs to be done. |
| 716 | 718 | ||
| 717 | If @var{buffer-or-name} is a string that does not name an existing | 719 | If @var{buffer-or-name} is a string that does not name an existing |
| 718 | buffer, a buffer by that name is created. | 720 | 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}. | ||
| 722 | @xref{Auto Major Mode}. | ||
| 719 | @end defun | 723 | @end defun |
| 720 | 724 | ||
| 721 | @node Choosing Window | 725 | @node Choosing Window |
| @@ -1520,6 +1524,23 @@ created narrower than this. The absolute minimum width is one; any | |||
| 1520 | value below that is ignored. The default value is 10. | 1524 | value below that is ignored. The default value is 10. |
| 1521 | @end defopt | 1525 | @end defopt |
| 1522 | 1526 | ||
| 1527 | @defvar window-size-change-functions | ||
| 1528 | This variable holds a list of functions to be called if the size of any | ||
| 1529 | window changes for any reason. The functions are called just once per | ||
| 1530 | redisplay, and just once for each frame on which size changes have | ||
| 1531 | occurred. | ||
| 1532 | |||
| 1533 | Each function receives the frame as its sole argument. There is no | ||
| 1534 | direct way to find out which windows changed size, or precisely how; | ||
| 1535 | however, if your size-change function keeps track, after each change, of | ||
| 1536 | the windows that interest you, you can figure out what has changed by | ||
| 1537 | comparing the old size data with the new. | ||
| 1538 | |||
| 1539 | Creating or deleting windows counts as a size change, and therefore | ||
| 1540 | causes these functions to be called. Changing the frame size also | ||
| 1541 | counts, because it changes the sizes of the existing windows. | ||
| 1542 | @end defvar | ||
| 1543 | |||
| 1523 | @node Coordinates and Windows | 1544 | @node Coordinates and Windows |
| 1524 | @section Coordinates and Windows | 1545 | @section Coordinates and Windows |
| 1525 | 1546 | ||