unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Cc: boris@gnu.org, eliz@gnu.org, alex@emacswiki.org, emacs-devel@gnu.org
Subject: Re: enriched-mode and switching major modes.
Date: Wed, 22 Sep 2004 12:35:15 +0200	[thread overview]
Message-ID: <ufz5ar3q4.fsf@ID-87814.user.uni-berlin.de> (raw)
In-Reply-To: <E1C9pPh-0005DY-Gz@fencepost.gnu.org> (Richard Stallman's message of "Tue, 21 Sep 2004 14:30:53 -0400")

I split my answer to this mail in order to adress some issues
separately.

Richard Stallman <rms@gnu.org> writes:

[nested blocks]
> What does it *mean* to copy a character from inside environment
> `larum' which is inside environment `lirum' and insert it somewere
> else?  What should that character look like in its new location?

Two things could make sense here:

* Copy the properties of the /immediate/ containing block.

* Ignore the block formatting properties and copy only normal text
  properties.

I definitely prefer the second one.  I think it would be the Right
Thing.  If I copy text from a H1 paragraph and insert it into a H2
paragraph, then it should get all character formatting properties that
are specified at the paragraph level from the H2 environment.  But if
the text has /additional/ character formatting properties specified,
like it contains some italic words, those should be preserved.

[...]
>     <h1>Some <i>meaningless</i> heading</h1>
>
>     The <i> element maps directly to text properties, of course.  But the
>     h1 element both demands that its contents be rendered as a paragraph
>     (a block) /and/ specifies certain character formatting properties for
>     the whole of it, e.g. a large bold font.
>
>     When encoding a buffer, I need to identify the whole paragraph as
>     being of the type "h1".  I.e. I have to distinguish it from:
>
>     <p><font size=7><b>Some <i>meaningless</i> heading</font></p>
>
> Why do you have to distinguish them? 

It is about preserving the user's intent.

Word processors as well as the file formats used in word processing
typically provide several ways to apply character formatting
properties on text:

*  paragraph formatting stylesheets
   - RTF: \sN
   - HTML: block elements like h1, h2 ... 

*  character formatting stylesheets
   - RTF: \csN
   - HTML: inline elements like em

*  direct specification of character formatting properties
   - RTF: \fN, \fsN, \b ...
   - HTML: i, b, font ...

The first two provide an layer of indirection which allows to specify
the user's /semantical/ intent on the document text.  Some
users---well, /I/ for example---would prefer /not/ to work with direct
specification of formatting properties at all.

It is a matter of what is the intent that the user has expressed.  Did
she specify "I want this to be a top level headline" or did she
specify "I want this to be large, bold text"?

The difference will show up, when the document is transfered to
another rendering device or when the user changes her mind and changes
the stylesheet for "level 1 headlines".  We have to preserve that
intent of the user in the data structure.  That's why I introduced the
concept of the abstract document and distinguished it from the
appearance.  The abstract document is the aggregation of the user's
intent.

Specifying only the appearance ("This should be large, bold text") is
considered bad practice in word processing.  Some users do it this
way; but many, at least most people /I/ know, prefer stylesheets.  If
Emacs would fail to preserve the semantical intents, it would get a
very bad reputation as a word processor.  Even worse, we would have to
expect that sophisticated users would recommend /not/ to use Emacs in
document exchange.  This must not happen.  Emacs has the potential to
be much better than any existing word processor; I would be very sad
if it happens to become worse.

> Why wouldn't it work simply to put these properties on the whole
> text of the paragraph?  What aspect would work differently as a
> result of doing one or the other, and why is it better if the
> properties are attached to paragraphs?

When encoding the document, I have to determine the type of a
paragraph, so that the encoded document file conserves the user's
semantical intent.  I have to get that information from somewhere.

If we can guarantee, that text properties affecting the paragraph
/always/ cover the whole of text of a paragraph, then this o.k.  When
encoding, I first distuinguish the paragraph; then I look at the text
property.  Kim has hinted at some ways of guaranteeing this.  Offhand
I believe that this would work for non-nested paragraphs (blocks).  I
dislike that approach, though, partly because I don't trust its
robustness, partly because it does not scale to handle nested blocks.

This whole affair is partly an UI problem.  The functions that encode
the document must be able to unambigously determine the type of a
paragraph as well as its other features from the data structure.  But
also the user must get feedback on how her actions affected the
abstract document (as expressed in said data structure):

>     We have to deal with the case that a user deletes the hard newline (if
>     you evaluate the code above: just hit backspace).  Is the resulting
>     paragraph of type `h1' or of type `h2'?
>
> Why ask the question?  Why not just accept that it's a paragraph
> of partly h1 text and partly h2 text?

In HTML there is no such thing as a paragraph that is partly H1 and H2
text.  What you suggest would result in this:

<h1>lirum larum</h1><h2>lirum larum</h2>

Any user agent (web browser, another word processor) would render this
as two paragraphs (blocks).  But the user in Emacs saw it as a single
paragraph when she saved that document.  Due to the commands she has
issued (maybe accidentally) the data structure treats it as two
separate paragraphs and encodes it accordingly when writing to the
file; but the user does not get any visual feedback on this.  She will
be surprised.  If she knows that things like this could happen, she
could feel the urge to examine the encoded document file before she
transers it to somebody else.  Eventually she could even stop to use
the word processing facilities and edit the raw HTML from the
beginning; or use another word processor.

Of course, treating "h1" and "h2" always as character formatting types
only would avoid the "one paragraph that suddenly becomes two
paragraphs" effect:

<p><font size=7><b>lirum larum</b></font><font size=6><b>lirum larum</b><font></p>

But then we fail again to preserve any semantical intent.



    Oliver
-- 
Oliver Scholz               Jour de la Révolution de l'Année 212 de la Révolution
Ostendstr. 61               Liberté, Egalité, Fraternité!
60314 Frankfurt a. M.       

  parent reply	other threads:[~2004-09-22 10:35 UTC|newest]

Thread overview: 150+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-04 23:58 enriched-mode and switching major modes Luc Teirlinck
2004-09-05 17:25 ` Richard Stallman
2004-09-06  0:59   ` Luc Teirlinck
2004-09-06 16:42     ` Stefan
2004-09-06 16:53       ` Luc Teirlinck
2004-09-10 17:40     ` Richard Stallman
2004-09-11  2:14       ` Luc Teirlinck
2004-09-11 16:56         ` Stefan
2004-09-11 21:51           ` Luc Teirlinck
2004-09-11 22:55             ` Stefan
2004-09-12  1:46               ` Luc Teirlinck
2004-09-12 18:18                 ` Stefan
2004-09-12  2:50               ` Luc Teirlinck
2004-09-13  7:00               ` Richard Stallman
2004-09-12  9:10         ` Richard Stallman
2004-09-12 16:51           ` Luc Teirlinck
2004-09-12 17:08             ` Oliver Scholz
2004-09-12 18:36             ` Kim F. Storm
2004-09-12 20:01               ` Luc Teirlinck
2004-09-13  7:32                 ` Kim F. Storm
2004-09-13 23:03             ` Richard Stallman
2004-09-14  3:46               ` Luc Teirlinck
2004-09-14 12:26                 ` Stefan Monnier
2004-09-14 22:12                   ` Luc Teirlinck
2004-09-15  9:32                 ` Richard Stallman
2004-09-17  9:36                 ` Richard Stallman
2004-09-19 20:07                   ` Luc Teirlinck
2004-09-06  7:36   ` Oliver Scholz
2004-09-06 19:01     ` Alex Schroeder
2004-09-10 17:40       ` Richard Stallman
2004-09-10 19:30         ` Oliver Scholz
2004-09-13 23:04           ` Richard Stallman
2004-09-14 14:41             ` Oliver Scholz
2004-09-14 16:31               ` Oliver Scholz
2004-09-15  1:39               ` Luc Teirlinck
2004-09-15  1:47                 ` Luc Teirlinck
2004-09-15  8:06                 ` Oliver Scholz
2004-09-15 15:42               ` Richard Stallman
2004-09-16 13:20                 ` Kai Grossjohann
2004-09-17 23:22                   ` Richard Stallman
2004-09-16 17:04                 ` Oliver Scholz
2004-09-17  5:15                   ` Eli Zaretskii
2004-09-17 14:34                     ` Oliver Scholz
2004-09-17 20:43                       ` Kai Grossjohann
2004-09-17 22:05                         ` Kim F. Storm
2004-09-18 19:07                           ` Richard Stallman
2004-09-18 15:37                         ` Robert J. Chassell
2004-09-18 11:14                       ` Eli Zaretskii
2004-09-18 12:04                         ` David Kastrup
2004-09-18 13:32                           ` Eli Zaretskii
2004-09-18 13:46                             ` David Kastrup
2004-09-18 15:57                               ` Eli Zaretskii
2004-09-19 17:19                                 ` Kai Grossjohann
2004-09-18 22:55                           ` Richard Stallman
2004-09-18 17:08                         ` Oliver Scholz
2004-09-18 17:48                           ` Eli Zaretskii
2004-09-18 20:02                             ` Oliver Scholz
2004-09-18 21:25                               ` Eli Zaretskii
2004-09-18 21:54                                 ` Oliver Scholz
2004-09-20  0:06                                   ` Richard Stallman
2004-09-20 11:48                                     ` Oliver Scholz
2004-09-21 18:30                                       ` Richard Stallman
2004-09-21 19:08                                         ` Eli Zaretskii
2004-09-21 20:06                                           ` Stefan Monnier
2004-09-22  4:54                                             ` Eli Zaretskii
2004-09-22 18:20                                           ` Richard Stallman
2004-09-22 18:39                                             ` Eli Zaretskii
2004-09-23 16:44                                               ` Richard Stallman
2004-09-22 10:01                                         ` Oliver Scholz
2004-09-22 13:08                                           ` Stefan Monnier
2004-09-22 13:11                                           ` Stefan Monnier
2004-09-22 13:14                                             ` Oliver Scholz
2004-09-22 16:27                                               ` Stefan Monnier
2004-09-23  1:48                                               ` Luc Teirlinck
2004-09-23  9:29                                             ` Richard Stallman
2004-09-23  9:48                                               ` David Kastrup
2004-09-23 16:44                                                 ` Richard Stallman
2004-09-23 11:35                                               ` Stefan
2004-09-23 12:46                                                 ` David Kastrup
2004-09-23 12:59                                                 ` Oliver Scholz
2004-09-24 12:08                                                 ` Richard Stallman
2004-09-24 12:50                                                   ` Stefan
2004-09-25 15:34                                                     ` Richard Stallman
2004-09-24 10:59                                           ` Eli Zaretskii
2004-09-24 11:53                                             ` Oliver Scholz
2004-09-24 15:51                                               ` Oliver Scholz
2004-09-24 20:55                                                 ` Alex Schroeder
2004-09-24 21:11                                                   ` Oliver Scholz
2004-09-25 16:36                                                 ` Eli Zaretskii
2004-09-22 10:35                                         ` Oliver Scholz [this message]
2004-09-22 18:21                                           ` Richard Stallman
2004-09-20  0:05                               ` Richard Stallman
2004-09-18 22:11                             ` Kim F. Storm
2004-09-19  3:47                               ` Eli Zaretskii
2004-09-20  0:05                               ` Richard Stallman
2004-09-20 11:07                                 ` Oliver Scholz
2004-09-20 11:55                                   ` Kim F. Storm
2004-09-21 18:30                                   ` Richard Stallman
2004-09-22  7:44                                     ` Kim F. Storm
2004-09-22 18:14                                       ` Eli Zaretskii
2004-09-22 21:53                                         ` Kim F. Storm
2004-09-23  4:47                                           ` Eli Zaretskii
2004-09-23  7:13                                             ` Kim F. Storm
2004-09-22 18:20                                       ` Richard Stallman
2004-09-22 21:58                                         ` Kim F. Storm
2004-09-20 12:47                                 ` Kai Grossjohann
2004-09-17 15:08                   ` Robert J. Chassell
2004-09-18 17:34                     ` Oliver Scholz
2004-09-18 23:05                       ` Robert J. Chassell
2004-09-19 11:07                         ` Oliver Scholz
2004-09-19 11:24                           ` David Kastrup
2004-09-19 13:14                           ` Robert J. Chassell
2004-09-20  5:49                           ` Stefan
2004-09-20  6:17                             ` David Kastrup
2004-09-20  6:26                               ` Stefan
2004-09-20 11:00                             ` Oliver Scholz
2004-09-20 13:24                               ` Stefan Monnier
2004-09-20 14:17                                 ` Oliver Scholz
2004-09-20 14:55                                   ` Stefan Monnier
2004-09-20 19:18                                     ` David Kastrup
2004-09-20 19:49                                       ` Stefan Monnier
2004-09-20 19:37                                     ` Oliver Scholz
2004-09-20 20:04                                       ` Stefan Monnier
2004-09-21  9:07                                         ` Oliver Scholz
2004-09-21 14:43                                           ` Robert J. Chassell
2004-09-20 21:44                                   ` Robert J. Chassell
2004-09-17 23:22                   ` Richard Stallman
2004-09-18 16:57                     ` Oliver Scholz
2004-09-18 17:12                       ` Oliver Scholz
2004-09-20  0:05                       ` Richard Stallman
2004-09-20 11:35                         ` Oliver Scholz
2004-09-20 11:47                           ` Kim F. Storm
2004-09-20 13:27                             ` Oliver Scholz
2004-09-20 14:23                               ` Kim F. Storm
2004-09-20 19:35                                 ` Oliver Scholz
2004-09-20 19:35                               ` Oliver Scholz
2004-09-20 20:21                                 ` Kim F. Storm
2004-09-21  9:07                                   ` Oliver Scholz
2004-09-21 11:20                                     ` Kim F. Storm
2004-09-22  7:11                                   ` Richard Stallman
2004-09-21 18:30                             ` Richard Stallman
2004-09-21 20:31                               ` Miles Bader
2004-09-22  3:20                               ` James Clark
2004-09-23  9:30                                 ` Richard Stallman
2004-09-21  9:53                         ` Kai Grossjohann
2004-09-21 11:32                           ` Kim F. Storm
2004-09-21 18:53                           ` Eli Zaretskii
2004-09-21 20:34                             ` Miles Bader
2004-09-22  0:31                             ` David Kastrup
2004-09-22 14:00                           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ufz5ar3q4.fsf@ID-87814.user.uni-berlin.de \
    --to=alkibiades@gmx.de \
    --cc=alex@emacswiki.org \
    --cc=boris@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).