diff options
| author | Paul Eggert | 2015-09-01 17:25:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-09-01 17:29:47 -0700 |
| commit | afe1cf00713847c1d8f3a9d95d4980d705ec39f1 (patch) | |
| tree | e8a91671a7a48e56629e0874546570309870a400 /doc | |
| parent | 72aae7326b8e2264eb02e8f9725a367f62aa09fd (diff) | |
| download | emacs-afe1cf00713847c1d8f3a9d95d4980d705ec39f1.tar.gz emacs-afe1cf00713847c1d8f3a9d95d4980d705ec39f1.zip | |
Rework quoting in tutorial
* doc/lispintro/emacs-lisp-intro.texi (Sample let Expression)
(if in more detail, type-of-animal in detail, else): Rework the
early example to use " rather than ' so that we don’t burden
complete novices with the low-priority detail of text quoting style.
(Complete zap-to-char, kill-region, Complete copy-region-as-kill)
(kill-new function, kill-ring-yank-pointer)
(Complete forward-sentence, Loading Files)
(Code for current-kill, Code for current-kill, yank):
Resurrect the Emacs 22 versions of the code, which uses grave
quoting style in doc strings.
(Complete zap-to-char): Mention how quoting works in doc strings.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 189 |
1 files changed, 104 insertions, 85 deletions
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index a27a969f91b..3ac24183078 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi | |||
| @@ -3691,26 +3691,26 @@ to the two variables @code{zebra} and @code{tiger}. The body of the | |||
| 3691 | 3691 | ||
| 3692 | @smallexample | 3692 | @smallexample |
| 3693 | @group | 3693 | @group |
| 3694 | (let ((zebra 'stripes) | 3694 | (let ((zebra "stripes") |
| 3695 | (tiger 'fierce)) | 3695 | (tiger "fierce")) |
| 3696 | (message "One kind of animal has %s and another is %s." | 3696 | (message "One kind of animal has %s and another is %s." |
| 3697 | zebra tiger)) | 3697 | zebra tiger)) |
| 3698 | @end group | 3698 | @end group |
| 3699 | @end smallexample | 3699 | @end smallexample |
| 3700 | 3700 | ||
| 3701 | Here, the varlist is @code{((zebra 'stripes) (tiger 'fierce))}. | 3701 | Here, the varlist is @code{((zebra "stripes") (tiger "fierce"))}. |
| 3702 | 3702 | ||
| 3703 | The two variables are @code{zebra} and @code{tiger}. Each variable is | 3703 | The two variables are @code{zebra} and @code{tiger}. Each variable is |
| 3704 | the first element of a two-element list and each value is the second | 3704 | the first element of a two-element list and each value is the second |
| 3705 | element of its two-element list. In the varlist, Emacs binds the | 3705 | element of its two-element list. In the varlist, Emacs binds the |
| 3706 | variable @code{zebra} to the value @code{stripes}@footnote{According | 3706 | variable @code{zebra} to the value @code{"stripes"}@footnote{According |
| 3707 | to Jared Diamond in @cite{Guns, Germs, and Steel}, ``@dots{} zebras | 3707 | to Jared Diamond in @cite{Guns, Germs, and Steel}, ``@dots{} zebras |
| 3708 | become impossibly dangerous as they grow older'' but the claim here is | 3708 | become impossibly dangerous as they grow older'' but the claim here is |
| 3709 | that they do not become fierce like a tiger. (1997, W. W. Norton and | 3709 | that they do not become fierce like a tiger. (1997, W. W. Norton and |
| 3710 | Co., ISBN 0-393-03894-2, page 171)}, and binds the | 3710 | Co., ISBN 0-393-03894-2, page 171)}, and binds the |
| 3711 | variable @code{tiger} to the value @code{fierce}. In this example, | 3711 | variable @code{tiger} to the value @code{"fierce"}. In this example, |
| 3712 | both values are symbols preceded by a quote. The values could just as | 3712 | both values are strings. The values could just as well have been |
| 3713 | well have been another list or a string. The body of the @code{let} | 3713 | another list or a symbol. The body of the @code{let} |
| 3714 | follows after the list holding the variables. In this example, the | 3714 | follows after the list holding the variables. In this example, the |
| 3715 | body is a list that uses the @code{message} function to print a string | 3715 | body is a list that uses the @code{message} function to print a string |
| 3716 | in the echo area. | 3716 | in the echo area. |
| @@ -3855,17 +3855,17 @@ of time, we would not need to run the test!) | |||
| 3855 | For example, the value may be bound to an argument of a function | 3855 | For example, the value may be bound to an argument of a function |
| 3856 | definition. In the following function definition, the character of the | 3856 | definition. In the following function definition, the character of the |
| 3857 | animal is a value that is passed to the function. If the value bound to | 3857 | animal is a value that is passed to the function. If the value bound to |
| 3858 | @code{characteristic} is @code{fierce}, then the message, @samp{It's a | 3858 | @code{characteristic} is @code{"fierce"}, then the message, @samp{It is a |
| 3859 | tiger!} will be printed; otherwise, @code{nil} will be returned. | 3859 | tiger!} will be printed; otherwise, @code{nil} will be returned. |
| 3860 | 3860 | ||
| 3861 | @smallexample | 3861 | @smallexample |
| 3862 | @group | 3862 | @group |
| 3863 | (defun type-of-animal (characteristic) | 3863 | (defun type-of-animal (characteristic) |
| 3864 | "Print message in echo area depending on CHARACTERISTIC. | 3864 | "Print message in echo area depending on CHARACTERISTIC. |
| 3865 | If the CHARACTERISTIC is the symbol ‘fierce’, | 3865 | If the CHARACTERISTIC is the string \"fierce\", |
| 3866 | then warn of a tiger." | 3866 | then warn of a tiger." |
| 3867 | (if (equal characteristic 'fierce) | 3867 | (if (equal characteristic "fierce") |
| 3868 | (message "It’s a tiger!"))) | 3868 | (message "It is a tiger!"))) |
| 3869 | @end group | 3869 | @end group |
| 3870 | @end smallexample | 3870 | @end smallexample |
| 3871 | 3871 | ||
| @@ -3877,18 +3877,18 @@ can evaluate the following two expressions to see the results: | |||
| 3877 | 3877 | ||
| 3878 | @smallexample | 3878 | @smallexample |
| 3879 | @group | 3879 | @group |
| 3880 | (type-of-animal 'fierce) | 3880 | (type-of-animal "fierce") |
| 3881 | 3881 | ||
| 3882 | (type-of-animal 'zebra) | 3882 | (type-of-animal "striped") |
| 3883 | 3883 | ||
| 3884 | @end group | 3884 | @end group |
| 3885 | @end smallexample | 3885 | @end smallexample |
| 3886 | 3886 | ||
| 3887 | @c Following sentences rewritten to prevent overfull hbox. | 3887 | @c Following sentences rewritten to prevent overfull hbox. |
| 3888 | @noindent | 3888 | @noindent |
| 3889 | When you evaluate @code{(type-of-animal 'fierce)}, you will see the | 3889 | When you evaluate @code{(type-of-animal "fierce")}, you will see the |
| 3890 | following message printed in the echo area: @code{"It’s a tiger!"}; and | 3890 | following message printed in the echo area: @code{"It is a tiger!"}; and |
| 3891 | when you evaluate @code{(type-of-animal 'zebra)} you will see @code{nil} | 3891 | when you evaluate @code{(type-of-animal "striped")} you will see @code{nil} |
| 3892 | printed in the echo area. | 3892 | printed in the echo area. |
| 3893 | 3893 | ||
| 3894 | @node type-of-animal in detail | 3894 | @node type-of-animal in detail |
| @@ -3918,7 +3918,7 @@ The parts of the function that match this template look like this: | |||
| 3918 | @group | 3918 | @group |
| 3919 | (defun type-of-animal (characteristic) | 3919 | (defun type-of-animal (characteristic) |
| 3920 | "Print message in echo area depending on CHARACTERISTIC. | 3920 | "Print message in echo area depending on CHARACTERISTIC. |
| 3921 | If the CHARACTERISTIC is the symbol ‘fierce’, | 3921 | If the CHARACTERISTIC is the string \"fierce\", |
| 3922 | then warn of a tiger." | 3922 | then warn of a tiger." |
| 3923 | @var{body: the} @code{if} @var{expression}) | 3923 | @var{body: the} @code{if} @var{expression}) |
| 3924 | @end group | 3924 | @end group |
| @@ -3947,8 +3947,8 @@ looks like this: | |||
| 3947 | 3947 | ||
| 3948 | @smallexample | 3948 | @smallexample |
| 3949 | @group | 3949 | @group |
| 3950 | (if (equal characteristic 'fierce) | 3950 | (if (equal characteristic "fierce") |
| 3951 | (message "It’s a tiger!"))) | 3951 | (message "It is a tiger!"))) |
| 3952 | @end group | 3952 | @end group |
| 3953 | @end smallexample | 3953 | @end smallexample |
| 3954 | 3954 | ||
| @@ -3956,26 +3956,26 @@ looks like this: | |||
| 3956 | Here, the true-or-false-test is the expression: | 3956 | Here, the true-or-false-test is the expression: |
| 3957 | 3957 | ||
| 3958 | @smallexample | 3958 | @smallexample |
| 3959 | (equal characteristic 'fierce) | 3959 | (equal characteristic "fierce") |
| 3960 | @end smallexample | 3960 | @end smallexample |
| 3961 | 3961 | ||
| 3962 | @noindent | 3962 | @noindent |
| 3963 | In Lisp, @code{equal} is a function that determines whether its first | 3963 | In Lisp, @code{equal} is a function that determines whether its first |
| 3964 | argument is equal to its second argument. The second argument is the | 3964 | argument is equal to its second argument. The second argument is the |
| 3965 | quoted symbol @code{'fierce} and the first argument is the value of the | 3965 | string @code{"fierce"} and the first argument is the value of the |
| 3966 | symbol @code{characteristic}---in other words, the argument passed to | 3966 | symbol @code{characteristic}---in other words, the argument passed to |
| 3967 | this function. | 3967 | this function. |
| 3968 | 3968 | ||
| 3969 | In the first exercise of @code{type-of-animal}, the argument | 3969 | In the first exercise of @code{type-of-animal}, the argument |
| 3970 | @code{fierce} is passed to @code{type-of-animal}. Since @code{fierce} | 3970 | @code{"fierce"} is passed to @code{type-of-animal}. Since @code{"fierce"} |
| 3971 | is equal to @code{fierce}, the expression, @code{(equal characteristic | 3971 | is equal to @code{"fierce"}, the expression, @code{(equal characteristic |
| 3972 | 'fierce)}, returns a value of true. When this happens, the @code{if} | 3972 | "fierce")}, returns a value of true. When this happens, the @code{if} |
| 3973 | evaluates the second argument or then-part of the @code{if}: | 3973 | evaluates the second argument or then-part of the @code{if}: |
| 3974 | @code{(message "It’s a tiger!")}. | 3974 | @code{(message "It is a tiger!")}. |
| 3975 | 3975 | ||
| 3976 | On the other hand, in the second exercise of @code{type-of-animal}, the | 3976 | On the other hand, in the second exercise of @code{type-of-animal}, the |
| 3977 | argument @code{zebra} is passed to @code{type-of-animal}. @code{zebra} | 3977 | argument @code{"striped"} is passed to @code{type-of-animal}. @code{"striped"} |
| 3978 | is not equal to @code{fierce}, so the then-part is not evaluated and | 3978 | is not equal to @code{"fierce"}, so the then-part is not evaluated and |
| 3979 | @code{nil} is returned by the @code{if} expression. | 3979 | @code{nil} is returned by the @code{if} expression. |
| 3980 | 3980 | ||
| 3981 | @node else | 3981 | @node else |
| @@ -4034,33 +4034,33 @@ arguments to the function. | |||
| 4034 | @group | 4034 | @group |
| 4035 | (defun type-of-animal (characteristic) ; @r{Second version.} | 4035 | (defun type-of-animal (characteristic) ; @r{Second version.} |
| 4036 | "Print message in echo area depending on CHARACTERISTIC. | 4036 | "Print message in echo area depending on CHARACTERISTIC. |
| 4037 | If the CHARACTERISTIC is the symbol ‘fierce’, | 4037 | If the CHARACTERISTIC is the string \"fierce\", |
| 4038 | then warn of a tiger; else say it’s not fierce." | 4038 | then warn of a tiger; else say it is not fierce." |
| 4039 | (if (equal characteristic 'fierce) | 4039 | (if (equal characteristic "fierce") |
| 4040 | (message "It’s a tiger!") | 4040 | (message "It is a tiger!") |
| 4041 | (message "It’s not fierce!"))) | 4041 | (message "It is not fierce!"))) |
| 4042 | @end group | 4042 | @end group |
| 4043 | @end smallexample | 4043 | @end smallexample |
| 4044 | @sp 1 | 4044 | @sp 1 |
| 4045 | 4045 | ||
| 4046 | @smallexample | 4046 | @smallexample |
| 4047 | @group | 4047 | @group |
| 4048 | (type-of-animal 'fierce) | 4048 | (type-of-animal "fierce") |
| 4049 | 4049 | ||
| 4050 | (type-of-animal 'zebra) | 4050 | (type-of-animal "striped") |
| 4051 | 4051 | ||
| 4052 | @end group | 4052 | @end group |
| 4053 | @end smallexample | 4053 | @end smallexample |
| 4054 | 4054 | ||
| 4055 | @c Following sentence rewritten to prevent overfull hbox. | 4055 | @c Following sentence rewritten to prevent overfull hbox. |
| 4056 | @noindent | 4056 | @noindent |
| 4057 | When you evaluate @code{(type-of-animal 'fierce)}, you will see the | 4057 | When you evaluate @code{(type-of-animal "fierce")}, you will see the |
| 4058 | following message printed in the echo area: @code{"It’s a tiger!"}; but | 4058 | following message printed in the echo area: @code{"It is a tiger!"}; but |
| 4059 | when you evaluate @code{(type-of-animal 'zebra)}, you will see | 4059 | when you evaluate @code{(type-of-animal "striped")}, you will see |
| 4060 | @code{"It’s not fierce!"}. | 4060 | @code{"It is not fierce!"}. |
| 4061 | 4061 | ||
| 4062 | (Of course, if the @var{characteristic} were @code{ferocious}, the | 4062 | (Of course, if the @var{characteristic} were @code{"ferocious"}, the |
| 4063 | message @code{"It’s not fierce!"} would be printed; and it would be | 4063 | message @code{"It is not fierce!"} would be printed; and it would be |
| 4064 | misleading! When you write code, you need to take into account the | 4064 | misleading! When you write code, you need to take into account the |
| 4065 | possibility that some such argument will be tested by the @code{if} | 4065 | possibility that some such argument will be tested by the @code{if} |
| 4066 | and write your program accordingly.) | 4066 | and write your program accordingly.) |
| @@ -6348,7 +6348,7 @@ With arg N, put point N/10 of the way | |||
| 6348 | from the true beginning. | 6348 | from the true beginning. |
| 6349 | @end group | 6349 | @end group |
| 6350 | @group | 6350 | @group |
| 6351 | Don’t use this in Lisp programs! | 6351 | Don't use this in Lisp programs! |
| 6352 | \(goto-char (point-min)) is faster | 6352 | \(goto-char (point-min)) is faster |
| 6353 | and does not set the mark." | 6353 | and does not set the mark." |
| 6354 | (interactive "P") | 6354 | (interactive "P") |
| @@ -7604,8 +7604,8 @@ Here is the complete text of the version 22 implementation of the function: | |||
| 7604 | @smallexample | 7604 | @smallexample |
| 7605 | @group | 7605 | @group |
| 7606 | (defun zap-to-char (arg char) | 7606 | (defun zap-to-char (arg char) |
| 7607 | "Kill up to and including ARG’th occurrence of CHAR. | 7607 | "Kill up to and including ARG'th occurrence of CHAR. |
| 7608 | Case is ignored if ‘case-fold-search’ is non-nil in the current buffer. | 7608 | Case is ignored if `case-fold-search' is non-nil in the current buffer. |
| 7609 | Goes backward if ARG is negative; error if CHAR not found." | 7609 | Goes backward if ARG is negative; error if CHAR not found." |
| 7610 | (interactive "p\ncZap to char: ") | 7610 | (interactive "p\ncZap to char: ") |
| 7611 | (if (char-table-p translation-table-for-input) | 7611 | (if (char-table-p translation-table-for-input) |
| @@ -7620,6 +7620,19 @@ Goes backward if ARG is negative; error if CHAR not found." | |||
| 7620 | The documentation is thorough. You do need to know the jargon meaning | 7620 | The documentation is thorough. You do need to know the jargon meaning |
| 7621 | of the word ``kill''. | 7621 | of the word ``kill''. |
| 7622 | 7622 | ||
| 7623 | @cindex curved quotes | ||
| 7624 | @cindex curly quotes | ||
| 7625 | The version 22 documentation string for @code{zap-to-char} uses ASCII | ||
| 7626 | grave accent and apostrophe to quote a symbol, so it appears as | ||
| 7627 | @t{`case-fold-search'}. This quoting style was inspired by 1970s-era | ||
| 7628 | displays in which grave accent and apostrophe were often mirror images | ||
| 7629 | suitable for use as quotes. On most modern displays this is no longer | ||
| 7630 | true, and when these two ASCII characters appear in documentation | ||
| 7631 | strings or diagnostic message formats, Emacs typically transliterates | ||
| 7632 | them to curved single quotes, so that the abovequoted symbol appears | ||
| 7633 | as @t{‘case-fold-search’}. Source-code strings can also simply use | ||
| 7634 | curved quotes directly. | ||
| 7635 | |||
| 7623 | @node zap-to-char interactive | 7636 | @node zap-to-char interactive |
| 7624 | @subsection The @code{interactive} Expression | 7637 | @subsection The @code{interactive} Expression |
| 7625 | 7638 | ||
| @@ -7863,7 +7876,7 @@ to make one entry in the kill ring. | |||
| 7863 | 7876 | ||
| 7864 | In Lisp code, optional third arg YANK-HANDLER, if non-nil, | 7877 | In Lisp code, optional third arg YANK-HANDLER, if non-nil, |
| 7865 | specifies the yank-handler text property to be set on the killed | 7878 | specifies the yank-handler text property to be set on the killed |
| 7866 | text. See ‘insert-for-yank’." | 7879 | text. See `insert-for-yank'." |
| 7867 | ;; Pass point first, then mark, because the order matters | 7880 | ;; Pass point first, then mark, because the order matters |
| 7868 | ;; when calling kill-append. | 7881 | ;; when calling kill-append. |
| 7869 | (interactive (list (point) (mark))) | 7882 | (interactive (list (point) (mark))) |
| @@ -8291,9 +8304,9 @@ function: | |||
| 8291 | @smallexample | 8304 | @smallexample |
| 8292 | @group | 8305 | @group |
| 8293 | (defun copy-region-as-kill (beg end) | 8306 | (defun copy-region-as-kill (beg end) |
| 8294 | "Save the region as if killed, but don’t kill it. | 8307 | "Save the region as if killed, but don't kill it. |
| 8295 | In Transient Mark mode, deactivate the mark. | 8308 | In Transient Mark mode, deactivate the mark. |
| 8296 | If ‘interprogram-cut-function’ is non-nil, also save the text for a window | 8309 | If `interprogram-cut-function' is non-nil, also save the text for a window |
| 8297 | system cut and paste." | 8310 | system cut and paste." |
| 8298 | (interactive "r") | 8311 | (interactive "r") |
| 8299 | @end group | 8312 | @end group |
| @@ -8573,28 +8586,16 @@ function which in turn uses the @code{setcar} function. | |||
| 8573 | @unnumberedsubsubsec The @code{kill-new} function | 8586 | @unnumberedsubsubsec The @code{kill-new} function |
| 8574 | @findex kill-new | 8587 | @findex kill-new |
| 8575 | 8588 | ||
| 8576 | @c in GNU Emacs 22, additional documentation to kill-new: | ||
| 8577 | @ignore | ||
| 8578 | Optional third arguments YANK-HANDLER controls how the STRING is later | ||
| 8579 | inserted into a buffer; see `insert-for-yank' for details. | ||
| 8580 | When a yank handler is specified, STRING must be non-empty (the yank | ||
| 8581 | handler, if non-nil, is stored as a `yank-handler' text property on STRING). | ||
| 8582 | |||
| 8583 | When the yank handler has a non-nil PARAM element, the original STRING | ||
| 8584 | argument is not used by `insert-for-yank'. However, since Lisp code | ||
| 8585 | may access and use elements from the kill ring directly, the STRING | ||
| 8586 | argument should still be a \"useful\" string for such uses." | ||
| 8587 | @end ignore | ||
| 8588 | @need 1200 | 8589 | @need 1200 |
| 8589 | The @code{kill-new} function looks like this: | 8590 | In version 22 the @code{kill-new} function looks like this: |
| 8590 | 8591 | ||
| 8591 | @smallexample | 8592 | @smallexample |
| 8592 | @group | 8593 | @group |
| 8593 | (defun kill-new (string &optional replace yank-handler) | 8594 | (defun kill-new (string &optional replace yank-handler) |
| 8594 | "Make STRING the latest kill in the kill ring. | 8595 | "Make STRING the latest kill in the kill ring. |
| 8595 | Set ‘kill-ring-yank-pointer’ to point to it. | 8596 | Set `kill-ring-yank-pointer' to point to it. |
| 8596 | 8597 | ||
| 8597 | If `interprogram-cut-function’ is non-nil, apply it to STRING. | 8598 | If `interprogram-cut-function' is non-nil, apply it to STRING. |
| 8598 | Optional second argument REPLACE non-nil means that STRING will replace | 8599 | Optional second argument REPLACE non-nil means that STRING will replace |
| 8599 | the front of the kill ring, rather than being added to the list. | 8600 | the front of the kill ring, rather than being added to the list. |
| 8600 | @dots{}" | 8601 | @dots{}" |
| @@ -10089,10 +10090,10 @@ With argument, rotate that many kills forward (or backward, if negative)." | |||
| 10089 | 10090 | ||
| 10090 | (defun current-kill (n &optional do-not-move) | 10091 | (defun current-kill (n &optional do-not-move) |
| 10091 | "Rotate the yanking point by N places, and then return that kill. | 10092 | "Rotate the yanking point by N places, and then return that kill. |
| 10092 | If N is zero, ‘interprogram-paste-function’ is set, and calling it | 10093 | If N is zero, `interprogram-paste-function' is set, and calling it |
| 10093 | returns a string, then that string is added to the front of the | 10094 | returns a string, then that string is added to the front of the |
| 10094 | kill ring and returned as the latest kill. | 10095 | kill ring and returned as the latest kill. |
| 10095 | If optional arg DO-NOT-MOVE is non-nil, then don’t actually move the | 10096 | If optional arg DO-NOT-MOVE is non-nil, then don't actually move the |
| 10096 | yanking point; just return the Nth kill forward." | 10097 | yanking point; just return the Nth kill forward." |
| 10097 | (let ((interprogram-paste (and (= n 0) | 10098 | (let ((interprogram-paste (and (= n 0) |
| 10098 | interprogram-paste-function | 10099 | interprogram-paste-function |
| @@ -12427,10 +12428,10 @@ Here is the code for @code{forward-sentence}: | |||
| 12427 | @smallexample | 12428 | @smallexample |
| 12428 | @group | 12429 | @group |
| 12429 | (defun forward-sentence (&optional arg) | 12430 | (defun forward-sentence (&optional arg) |
| 12430 | "Move forward to next ‘sentence-end’. With argument, repeat. | 12431 | "Move forward to next end of sentence. With argument, repeat. |
| 12431 | With negative argument, move backward repeatedly to ‘sentence-beginning’. | 12432 | With negative argument, move backward repeatedly to start of sentence. |
| 12432 | 12433 | ||
| 12433 | The variable ‘sentence-end’ is a regular expression that matches ends of | 12434 | The variable `sentence-end' is a regular expression that matches ends of |
| 12434 | sentences. Also, every paragraph boundary terminates sentences as well." | 12435 | sentences. Also, every paragraph boundary terminates sentences as well." |
| 12435 | @end group | 12436 | @end group |
| 12436 | @group | 12437 | @group |
| @@ -17520,8 +17521,13 @@ Incidentally, @code{load-library} is an interactive interface to the | |||
| 17520 | @smallexample | 17521 | @smallexample |
| 17521 | @group | 17522 | @group |
| 17522 | (defun load-library (library) | 17523 | (defun load-library (library) |
| 17523 | "Load the library named LIBRARY. | 17524 | "Load the Emacs Lisp library named LIBRARY. |
| 17524 | This is an interface to the function ‘load’." | 17525 | This is an interface to the function `load'. LIBRARY is searched |
| 17526 | for in `load-path', both with and without `load-suffixes' (as | ||
| 17527 | well as `load-file-rep-suffixes'). | ||
| 17528 | |||
| 17529 | See Info node `(emacs)Lisp Libraries' for more details. | ||
| 17530 | See `load-file' for a different interface to `load'." | ||
| 17525 | (interactive | 17531 | (interactive |
| 17526 | (list (completing-read "Load library: " | 17532 | (list (completing-read "Load library: " |
| 17527 | (apply-partially 'locate-file-completion-table | 17533 | (apply-partially 'locate-file-completion-table |
| @@ -19005,13 +19011,21 @@ The @code{current-kill} function is used by @code{yank} and by | |||
| 19005 | @group | 19011 | @group |
| 19006 | (defun current-kill (n &optional do-not-move) | 19012 | (defun current-kill (n &optional do-not-move) |
| 19007 | "Rotate the yanking point by N places, and then return that kill. | 19013 | "Rotate the yanking point by N places, and then return that kill. |
| 19008 | If N is zero, ‘interprogram-paste-function’ is set, and calling it | 19014 | If N is zero and `interprogram-paste-function' is set to a |
| 19009 | returns a string, then that string is added to the front of the | 19015 | function that returns a string or a list of strings, and if that |
| 19010 | kill ring and returned as the latest kill. | 19016 | function doesn't return nil, then that string (or list) is added |
| 19017 | to the front of the kill ring and the string (or first string in | ||
| 19018 | the list) is returned as the latest kill. | ||
| 19011 | @end group | 19019 | @end group |
| 19012 | @group | 19020 | @group |
| 19013 | If optional arg DO-NOT-MOVE is non-nil, then don’t actually move the | 19021 | If N is not zero, and if `yank-pop-change-selection' is |
| 19014 | yanking point; just return the Nth kill forward." | 19022 | non-nil, use `interprogram-cut-function' to transfer the |
| 19023 | kill at the new yank point into the window system selection. | ||
| 19024 | @end group | ||
| 19025 | @group | ||
| 19026 | If optional arg DO-NOT-MOVE is non-nil, then don't actually | ||
| 19027 | move the yanking point; just return the Nth kill forward." | ||
| 19028 | |||
| 19015 | (let ((interprogram-paste (and (= n 0) | 19029 | (let ((interprogram-paste (and (= n 0) |
| 19016 | interprogram-paste-function | 19030 | interprogram-paste-function |
| 19017 | (funcall interprogram-paste-function)))) | 19031 | (funcall interprogram-paste-function)))) |
| @@ -19023,8 +19037,10 @@ yanking point; just return the Nth kill forward." | |||
| 19023 | ;; text to the kill ring, so Emacs doesn't try to own the | 19037 | ;; text to the kill ring, so Emacs doesn't try to own the |
| 19024 | ;; selection, with identical text. | 19038 | ;; selection, with identical text. |
| 19025 | (let ((interprogram-cut-function nil)) | 19039 | (let ((interprogram-cut-function nil)) |
| 19026 | (kill-new interprogram-paste)) | 19040 | (if (listp interprogram-paste) |
| 19027 | interprogram-paste) | 19041 | (mapc 'kill-new (nreverse interprogram-paste)) |
| 19042 | (kill-new interprogram-paste))) | ||
| 19043 | (car kill-ring)) | ||
| 19028 | @end group | 19044 | @end group |
| 19029 | @group | 19045 | @group |
| 19030 | (or kill-ring (error "Kill ring is empty")) | 19046 | (or kill-ring (error "Kill ring is empty")) |
| @@ -19032,8 +19048,12 @@ yanking point; just return the Nth kill forward." | |||
| 19032 | (nthcdr (mod (- n (length kill-ring-yank-pointer)) | 19048 | (nthcdr (mod (- n (length kill-ring-yank-pointer)) |
| 19033 | (length kill-ring)) | 19049 | (length kill-ring)) |
| 19034 | kill-ring))) | 19050 | kill-ring))) |
| 19035 | (or do-not-move | 19051 | (unless do-not-move |
| 19036 | (setq kill-ring-yank-pointer ARGth-kill-element)) | 19052 | (setq kill-ring-yank-pointer ARGth-kill-element) |
| 19053 | (when (and yank-pop-change-selection | ||
| 19054 | (> n 0) | ||
| 19055 | interprogram-cut-function) | ||
| 19056 | (funcall interprogram-cut-function (car ARGth-kill-element)))) | ||
| 19037 | (car ARGth-kill-element))))) | 19057 | (car ARGth-kill-element))))) |
| 19038 | @end group | 19058 | @end group |
| 19039 | @end smallexample | 19059 | @end smallexample |
| @@ -19344,15 +19364,15 @@ The code looks like this: | |||
| 19344 | "Reinsert (\"paste\") the last stretch of killed text. | 19364 | "Reinsert (\"paste\") the last stretch of killed text. |
| 19345 | More precisely, reinsert the stretch of killed text most recently | 19365 | More precisely, reinsert the stretch of killed text most recently |
| 19346 | killed OR yanked. Put point at end, and set mark at beginning. | 19366 | killed OR yanked. Put point at end, and set mark at beginning. |
| 19347 | With just \\[universal-argument] as argument, same but put point at | 19367 | With just \\[universal-argument] as argument, same but put point at beginning (and mark at end). |
| 19348 | beginning (and mark at end). With argument N, reinsert the Nth most | 19368 | With argument N, reinsert the Nth most recently killed stretch of killed |
| 19349 | recently killed stretch of killed text. | 19369 | text. |
| 19350 | 19370 | ||
| 19351 | When this command inserts killed text into the buffer, it honors | 19371 | When this command inserts killed text into the buffer, it honors |
| 19352 | ‘yank-excluded-properties’ and ‘yank-handler’ as described in the | 19372 | `yank-excluded-properties' and `yank-handler' as described in the |
| 19353 | doc string for ‘insert-for-yank-1’, which see. | 19373 | doc string for `insert-for-yank-1', which see. |
| 19354 | 19374 | ||
| 19355 | See also the command \\[yank-pop]." | 19375 | See also the command `yank-pop' (\\[yank-pop])." |
| 19356 | @end group | 19376 | @end group |
| 19357 | @group | 19377 | @group |
| 19358 | (interactive "*P") | 19378 | (interactive "*P") |
| @@ -19368,8 +19388,7 @@ See also the command \\[yank-pop]." | |||
| 19368 | ((eq arg '-) -2) | 19388 | ((eq arg '-) -2) |
| 19369 | (t (1- arg))))) | 19389 | (t (1- arg))))) |
| 19370 | (if (consp arg) | 19390 | (if (consp arg) |
| 19371 | ;; This is like exchange-point-and-mark, | 19391 | ;; This is like exchange-point-and-mark, but doesn't activate the mark. |
| 19372 | ;; but doesn't activate the mark. | ||
| 19373 | ;; It is cleaner to avoid activation, even though the command | 19392 | ;; It is cleaner to avoid activation, even though the command |
| 19374 | ;; loop would deactivate the mark because we inserted text. | 19393 | ;; loop would deactivate the mark because we inserted text. |
| 19375 | (goto-char (prog1 (mark t) | 19394 | (goto-char (prog1 (mark t) |