Tuesday, July 27, 2010

Re: Is "read-only text" possible in vim?

* 2010-07-27 10:58 (-0500), Stahlman Family wrote:

> Vim is, by design, a text editor, not a word-processor. Storing
> properties and such in files automatically would be highly
> undesirable.

Being a text editor is not mutually exclusive with text properties.
Also, text properties are not necessarily data that will be stored in
files. For example, in Emacs text properties only exist in internal
buffer data. Buffers are Emacs Lisp data types just like integers,
strings etc. Only buffer object's textual content is saved to files
because, after all, Emacs is a text editor. :-)

So, text properties are merely a framework to allow attaching meta data
to buffer's content directly, rather than maintaining the data somewhere
else. Vim already maintains such information like highlight structures
and fold areas but it does not offer Emacs-like *general* programming
interface for handling that data.

In Vim's terms Emacs's text properties are like a dictionary object for
every character in a buffer. Some dictionary keys are standardized
(e.g., for highlighting, read-only parts etc.) but programmer can add
any keys and data she wants.

> The difference here is that the Vim user explicitly adds the
> highlighting tokens (or "properties", to use your terminology), [...]

The Emacs way is that the highlight system adds text properties to the
buffer object and the display engine uses that information to display
text with different colors etc. Nice thing is that it's also a *general*
programming interface for other features like click-able buttons or
invisibility or storing information about text's semantics etc.

My point here is that it's not intellectually honest to say that because
Vim is a text editor it must not offer programmable text properties.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment