emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: info faces for strings and quotations


From: Drew Adams
Subject: RE: info faces for strings and quotations
Date: Wed, 6 Oct 2004 00:07:49 -0700

OK, sure, sure. Programming languages are formal languages, so your point is
of course correct, technically. And, if existing font-lock code doesn't do a
better job in practice than Info quote highlighting, at least it has the
theoretical advantage that it _could_ be made to parse the language as
needed. My point was a practical one, about the current state of font-lock
code. It is good enough; we live with it; we probably don't want it to spend
much more time trying to be more precise.

I'd much rather hear about results from practicing with this than arguments
of this sort. Or, lets say, in addition to arguments of this sort.

I only have the usual info files delivered with Emacs and Cygwin, and, yes,
none of them are devoted to examples of APL code...sigh. But, based on your
argument about not necessarily being appropriate to other languages than
Lisp, I did take a look at some of the 33 standard Info manuals I do have.
In fact, I checked them all -- all nodes (the highlighting helps to check
them quickly).

Many are of course about Emacs and Emacs Lisp packages. Even in those,
however, there are examples of code in other languages. I did find the
following highlighting problems in all the 33 manuals I checked. I didn't
find any pbs in the manuals not mentioned.

------------

CC MODE -- node Text Filling and Line Breaking: `\' (this case isn't treated
yet, but perhaps should be)

CL -- node Old CL Compatibility: middle of title "The `cl-compat'package"
got highlighted as a `...'

IDLWAVE -- node Getting Started: same pb as CC Mode (`\')
        -- node Code Templates: same

MH-E -- node Moving Your Mail Around: `"lpr -J '%s'"' (first ' ends `...';
second " starts "...")

MESSAGE -- node: Message Actions: lisp quoted sexp --
'(set-window-configuration...

EMACS FAQ -- several nodes have `...' or "..." in node titles. These are
highlighted.

WIDGET -- several nodes have `...' in titles

REFTEX -- node fancyref (LaTeX package): `fancyref' in title highlighted

VIP -- node New Commands: same pb as CC Mode (`\')
    -- node Important Keys: same

VIPER -- node Emacs Preliminaries: `C-\' (' is considered escaped, so
doesn't turn off highlighting)
      -- node Vi State: same
      -- node Insert State: same
      -- node Emacs Related Commands: same
      -- node New Commands: same pb as CC Mode (`\')
      -- node Key Index: isolated " -- * "<a-z1-9>P:

CALC -- node Arithmetic Tutorial: same pb as CC Mode (`\')
     -- node Types Tutorial: isolated " from hours, minutes, seconds entries
in table, such as 2@ 30' 0"
     -- node Programming Tutorial: this comment with isolated `: # Save
local values (Z `)
     -- node List Answer 9: same pb as CC Mode (`\')
     -- node List Tutorial Exercise 13: isolated " -- "Testing, 1, 2, 3
<RET>
     -- node Types Tutorial Exercise 4: more hours, minutes, seconds entries
     -- node Programming Tutorial Exercise 8, 9, and 10: isolated ` -- C-x
( Z `
     -- node HMS Forms: more hours, minutes, seconds as @ ' and "
     -- node HMS Formats: more hours, minutes, seconds as @ ' and "
     -- node Business Days: more hours, minutes, seconds as @ ' and "
     -- node Polynomials: key sequence `a \' (the ' is considered escaped by
the highlighting)
     -- node More About Embedded Mode: same pb as CC Mode (`\')
     -- node Customizing Embedded Mode: regexp `"\\'\\|\n$\\|\\$\\$?"'
(first ' ends `...' and second " starts "...")
     -- Calc Summary: isolated ` and " in table of key sequences
     -- Key Index: same as Calc Summary

     Note: the Calc manual is very large, has zillions of symbolic and
formulaic examples, and deals with the syntaxes of several other languages,
including Eqn, Mathematica, and Tex. It includes tabular material and ASCII
art. And yes, this manual, in particular, _benefits_ greatly from
quoted-name highlighting. I find it very difficult to parse (read) without
highlighting. Here are two typical paragraphs of _text_:

     Quotients of negative-looking values are simplified according to `(-a)
/ (-b)' to `a / b', `(-a) / (b - c)' to `a / (c - b)', and `(a - b) / (-c)'
to `(b - a) / c'.

     Generic identity matrices (*note Matrix Mode::) are simplified by the
following rules:  `idn(a) + b' to `a + b' if `b' is provably scalar, or
expanded out if `b' is a matrix; `idn(a) + idn(b)' to `idn(a + b)';
`-idn(a)' to `idn(-a)'; `a idn(b)' to `idn(a b)' if `a' is provably
scalar, or to `a b' if `a' is provably non-scalar; `idn(a) idn(b)' to
`idn(a b)'; analogous simplifications for quotients involving `idn';
and `idn(a)^n' to `idn(a^n)' where `n' is an integer.

EMACS LISP INTRO -- a few nodes, such as Top: `...' in titles
                 -- a few nodes, such as Height of label: sexp with ' inside
`...': `(apply 'max numbers-list)'
                 -- node beginning-of-buffer complete: same pb as CC Mode
(`\')
                 -- node sentence-end: same
                 -- node the-the: unbalanced "s in text: _I duplicate "the'_

TEXINFO -- several nodes, such as The `subsub' Commands, with `...' in title
        -- node First Line: same pb as CC Mode (`\')
        -- node Command Syntax: same
        -- node math: same
        -- node verb: isolated ' --  @verb{+@'e?`!`{}\+} this?
        -- node Inserting Accents: @`o
        -- node Defining Macros: `\PARAM1\' -- the ' is considered escaped

 - Drew




-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of
Stefan Monnier
Sent: Tuesday, October 05, 2004 9:53 PM
To: Drew Adams
Cc: address@hidden; Luc Teirlinck;
address@hidden
Subject: Re: info faces for strings and quotations


> And, the same rare problems can be seen with font-lock highlighting of
Emacs

It's actually slightly different: the nature of programming languages
implies that there exist an automatic way to unambiguously define what is
a correct parse.  I.e., font-lock highlighting has bugs, but they can
clearly be recognized as such (and often fixed if it matters enough).
Also font-lock bugs generally can be worked around by changing the
source code because such buffers are generally writable.

In Info files, the "..." and `...' syntax is not unambiguous (it is intended
to be parsed by humans only), so there is no automatic system that works
100% percent: any fix for a particular case will introduce problems
elsewhere.  And Info buffers are normally read-only and most Info users will
have a hard time finding the Info or Texinfo files to edit them (and they
often can't edit them because they don't have the required access rights).

Your regexps work great for Info pages describing Elisp code.  For Info
pages relating to some other language where the convention for escape
sequences in strings is significantly different, they may work
very poorly.  But that's what the config var is for, anyway.

I would probably turn it on ;-)


        Stefan


_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]