[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: keymap in yank-excluded-properties
From: |
Kim F. Storm |
Subject: |
Re: keymap in yank-excluded-properties |
Date: |
26 Aug 2002 00:49:44 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Richard Stallman <address@hidden> writes:
> Is it generally a good idea not to copy keymap text property?
>
> Yes--very much so. In most cases that leads to very confusing
> results.
>
> What's correct to do for yanking a table? Yanking the whole table
> ought to preserve its properties so that the table still functions as
> one. Yanking a part of the table which can act as a complete table in
> itself should also do that. However, yanking some of the text within
> the table, which is less than a whole table entry, should forget that
> it came from a table and treat it like any ordinary text.
>
> Does that make sense to you? If so, can you look for a design to
> achieve those results?
Perhaps a new text property `yank-function' which takes a function as value.
`yank' will look for that property on kill-ring elements and call the
function with one argument: the string (or rectangle?) to yank. The
function is then responsible for inserting the string in the buffer
and remove any unwanted properties [i.e. it is expected to do the
actual insertion].
A table could have this property set to a function which check that
the string to insert is really a complete table -- and keep the
properties in that case [using insert] -- or remove the properties
otherwise [using insert-for-yank].
This is a simple, but flexible concept which may be used for other
purposes as well; for example, text killed by a "special" function
[e.g. kill-rectangle] may be later inserted using plain C-y by another
special function [e.g. insert-rectangle].
--
Kim F. Storm <address@hidden> http://www.cua.dk