diff options
| -rw-r--r-- | lisp/simple.el | 38 | ||||
| -rw-r--r-- | lisp/subr.el | 32 |
2 files changed, 36 insertions, 34 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index c7d3b2e6b0b..c43fe548c82 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4662,9 +4662,9 @@ If N is negative, this is a more recent kill. | |||
| 4662 | The sequence of kills wraps around, so that after the oldest one | 4662 | The sequence of kills wraps around, so that after the oldest one |
| 4663 | comes the newest one. | 4663 | comes the newest one. |
| 4664 | 4664 | ||
| 4665 | When this command inserts killed text into the buffer, it honors | 4665 | This command honors the `yank-handled-properties' and |
| 4666 | `yank-excluded-properties' and `yank-handler' as described in the | 4666 | `yank-excluded-properties' variables, and the `yank-handler' text |
| 4667 | doc string for `insert-for-yank-1', which see." | 4667 | property, in the way that `yank' does." |
| 4668 | (interactive "*p") | 4668 | (interactive "*p") |
| 4669 | (if (not (eq last-command 'yank)) | 4669 | (if (not (eq last-command 'yank)) |
| 4670 | (user-error "Previous command was not a yank")) | 4670 | (user-error "Previous command was not a yank")) |
| @@ -4697,10 +4697,34 @@ at the end, and set mark at the beginning without activating it. | |||
| 4697 | With just \\[universal-argument] as argument, put point at beginning, and mark at end. | 4697 | With just \\[universal-argument] as argument, put point at beginning, and mark at end. |
| 4698 | With argument N, reinsert the Nth most recent kill. | 4698 | With argument N, reinsert the Nth most recent kill. |
| 4699 | 4699 | ||
| 4700 | When this command inserts text into the buffer, it honors the | 4700 | This command honors the `yank-handled-properties' and |
| 4701 | `yank-handled-properties' and `yank-excluded-properties' | 4701 | `yank-excluded-properties' variables, and the `yank-handler' text |
| 4702 | variables, and the `yank-handler' text property. See | 4702 | property, as described below. |
| 4703 | `insert-for-yank-1' for details. | 4703 | |
| 4704 | Properties listed in `yank-handled-properties' are processed, | ||
| 4705 | then those listed in `yank-excluded-properties' are discarded. | ||
| 4706 | |||
| 4707 | If STRING has a non-nil `yank-handler' property anywhere, the | ||
| 4708 | normal insert behavior is altered, and instead, for each contiguous | ||
| 4709 | segment of STRING that has a given value of the `yank-handler' | ||
| 4710 | property, that value is used as follows: | ||
| 4711 | |||
| 4712 | The value of a `yank-handler' property must be a list of one to four | ||
| 4713 | elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO). | ||
| 4714 | FUNCTION, if non-nil, should be a function of one argument (the | ||
| 4715 | object to insert); FUNCTION is called instead of `insert'. | ||
| 4716 | PARAM, if present and non-nil, is passed to FUNCTION (to be handled | ||
| 4717 | in whatever way is appropriate; e.g. if FUNCTION is `yank-rectangle', | ||
| 4718 | PARAM may be a list of strings to insert as a rectangle). If PARAM | ||
| 4719 | is nil, then the current segment of STRING is used. | ||
| 4720 | If NOEXCLUDE is present and non-nil, the normal removal of | ||
| 4721 | `yank-excluded-properties' is not performed; instead FUNCTION is | ||
| 4722 | responsible for the removal. This may be necessary if FUNCTION | ||
| 4723 | adjusts point before or after inserting the object. | ||
| 4724 | UNDO, if present and non-nil, should be a function to be called | ||
| 4725 | by `yank-pop' to undo the insertion of the current PARAM. It is | ||
| 4726 | given two arguments, the start and end of the region. FUNCTION | ||
| 4727 | may set `yank-undo-function' to override UNDO. | ||
| 4704 | 4728 | ||
| 4705 | See also the command `yank-pop' (\\[yank-pop])." | 4729 | See also the command `yank-pop' (\\[yank-pop])." |
| 4706 | (interactive "*P") | 4730 | (interactive "*P") |
diff --git a/lisp/subr.el b/lisp/subr.el index e9e19d35f65..9c717e16b94 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2859,9 +2859,11 @@ remove properties specified by `yank-excluded-properties'." | |||
| 2859 | (defvar yank-undo-function) | 2859 | (defvar yank-undo-function) |
| 2860 | 2860 | ||
| 2861 | (defun insert-for-yank (string) | 2861 | (defun insert-for-yank (string) |
| 2862 | "Call `insert-for-yank-1' repetitively for each `yank-handler' segment. | 2862 | "Insert STRING at point for the `yank' command. |
| 2863 | 2863 | ||
| 2864 | See `insert-for-yank-1' for more details." | 2864 | This function is like `insert', except it honors the variables |
| 2865 | `yank-handled-properties' and `yank-excluded-properties', and the | ||
| 2866 | `yank-handler' text property, in the way that `yank' does." | ||
| 2865 | (let (to) | 2867 | (let (to) |
| 2866 | (while (setq to (next-single-property-change 0 'yank-handler string)) | 2868 | (while (setq to (next-single-property-change 0 'yank-handler string)) |
| 2867 | (insert-for-yank-1 (substring string 0 to)) | 2869 | (insert-for-yank-1 (substring string 0 to)) |
| @@ -2869,31 +2871,7 @@ See `insert-for-yank-1' for more details." | |||
| 2869 | (insert-for-yank-1 string)) | 2871 | (insert-for-yank-1 string)) |
| 2870 | 2872 | ||
| 2871 | (defun insert-for-yank-1 (string) | 2873 | (defun insert-for-yank-1 (string) |
| 2872 | "Insert STRING at point for the `yank' command. | 2874 | "Helper for `insert-for-yank', which see." |
| 2873 | This function is like `insert', except it honors the variables | ||
| 2874 | `yank-handled-properties' and `yank-excluded-properties', and the | ||
| 2875 | `yank-handler' text property. | ||
| 2876 | |||
| 2877 | Properties listed in `yank-handled-properties' are processed, | ||
| 2878 | then those listed in `yank-excluded-properties' are discarded. | ||
| 2879 | |||
| 2880 | If STRING has a non-nil `yank-handler' property on its first | ||
| 2881 | character, the normal insert behavior is altered. The value of | ||
| 2882 | the `yank-handler' property must be a list of one to four | ||
| 2883 | elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO). | ||
| 2884 | FUNCTION, if non-nil, should be a function of one argument, an | ||
| 2885 | object to insert; it is called instead of `insert'. | ||
| 2886 | PARAM, if present and non-nil, replaces STRING as the argument to | ||
| 2887 | FUNCTION or `insert'; e.g. if FUNCTION is `yank-rectangle', PARAM | ||
| 2888 | may be a list of strings to insert as a rectangle. | ||
| 2889 | If NOEXCLUDE is present and non-nil, the normal removal of | ||
| 2890 | `yank-excluded-properties' is not performed; instead FUNCTION is | ||
| 2891 | responsible for the removal. This may be necessary if FUNCTION | ||
| 2892 | adjusts point before or after inserting the object. | ||
| 2893 | UNDO, if present and non-nil, should be a function to be called | ||
| 2894 | by `yank-pop' to undo the insertion of the current object. It is | ||
| 2895 | given two arguments, the start and end of the region. FUNCTION | ||
| 2896 | may set `yank-undo-function' to override UNDO." | ||
| 2897 | (let* ((handler (and (stringp string) | 2875 | (let* ((handler (and (stringp string) |
| 2898 | (get-text-property 0 'yank-handler string))) | 2876 | (get-text-property 0 'yank-handler string))) |
| 2899 | (param (or (nth 1 handler) string)) | 2877 | (param (or (nth 1 handler) string)) |