1457 |
(set-text-properties start end nil) |
(set-text-properties start end nil) |
1458 |
(remove-list-of-text-properties start end yank-excluded-properties)))) |
(remove-list-of-text-properties start end yank-excluded-properties)))) |
1459 |
|
|
1460 |
(defun insert-for-yank (&rest strings) |
(defvar yank-undo-function) |
|
"Insert STRINGS at point, stripping some text properties. |
|
|
Strip text properties from the inserted text |
|
|
according to `yank-excluded-properties'. |
|
|
Otherwise just like (insert STRINGS...)." |
|
|
(let ((opoint (point))) |
|
|
(apply 'insert strings) |
|
|
(remove-yank-excluded-properties opoint (point)))) |
|
1461 |
|
|
1462 |
|
(defun insert-for-yank (string) |
1463 |
|
"Insert STRING at point, stripping some text properties. |
1464 |
|
Strip text properties from the inserted text according to |
1465 |
|
`yank-excluded-properties'. Otherwise just like (insert STRING). |
1466 |
|
|
1467 |
|
If STRING has a non-nil yank-handler property on the first character, |
1468 |
|
the normal insert behaviour is modified in various ways. The value of |
1469 |
|
the yank-handler property must be a list with one to five elements |
1470 |
|
with the following format: (FUNCTION PARAM NOEXCLUDE UNDO COMMAND). |
1471 |
|
When FUNCTION is present and non-nil, it is called instead of `insert' |
1472 |
|
to insert the string. FUNCTION takes one argument--the object to insert. |
1473 |
|
If PARAM is present and non-nil, it replaces STRING as the object |
1474 |
|
passed to FUNCTION (or `insert'); for example, if FUNCTION is |
1475 |
|
`yank-rectangle', PARAM may be a list of strings to insert as a |
1476 |
|
rectangle. |
1477 |
|
If NOEXCLUDE is present and non-nil, the normal removal of the |
1478 |
|
yank-excluded-properties is not performed; instead FUNCTION is |
1479 |
|
responsible for removing those properties. This may be necessary |
1480 |
|
if FUNCTION adjusts point before or after inserting the object. |
1481 |
|
If UNDO is present and non-nil, it is a function that will be called |
1482 |
|
by `yank-pop' to undo the insertion of the current object. It is |
1483 |
|
called with two arguments |
1484 |
|
FUNCTION may set `yank-undo-function' to override this. |
1485 |
|
If COMMAND is present and non-nil, `this-command' is set to COMMAND |
1486 |
|
after calling FUNCTION (or insert). Note that setting `this-command' |
1487 |
|
to a value different from `yank' will prevent `yank-pop' from undoing |
1488 |
|
this yank." |
1489 |
|
(let* ((method (get-text-property 0 'yank-handler string)) |
1490 |
|
(param (or (nth 1 method) string)) |
1491 |
|
(opoint (point))) |
1492 |
|
(setq yank-undo-function (nth 3 method)) ;; UNDO |
1493 |
|
(if (nth 0 method) ;; FUNCTION |
1494 |
|
(funcall (car method) param) |
1495 |
|
(setq opoint (point)) |
1496 |
|
(insert param)) |
1497 |
|
(unless (nth 2 method) ;; NOEXCLUDE |
1498 |
|
(remove-yank-excluded-properties opoint (point))) |
1499 |
|
(if (nth 4 method) ;; COMMAND |
1500 |
|
(setq this-command (nth 4 method))))) |
1501 |
|
|
1502 |
(defun insert-buffer-substring-no-properties (buf &optional start end) |
(defun insert-buffer-substring-no-properties (buf &optional start end) |
1503 |
"Insert before point a substring of buffer BUFFER, without text properties. |
"Insert before point a substring of buffer BUFFER, without text properties. |
1504 |
BUFFER may be a buffer or a buffer name. |
BUFFER may be a buffer or a buffer name. |