[Top][All Lists]

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

Re: Marking lisp expressions

From: Jean-Christophe Helary
Subject: Re: Marking lisp expressions
Date: Sun, 26 Jan 2020 22:58:45 +0900

> On Jan 26, 2020, at 22:03, Gavin Smith <address@hidden> wrote:
>> 2) if not, would it be acceptable to create a few more semantic markers that 
>> correspond to "arguments", "constants" and "comments" ?
> I doubt that this is the best approach to syntax highlighting. It
> requires significant effort in marking up code examples. Moreover, the
> list of categories may be unending.
> I looked at some syntax highlighting configuration files for a couple
> of languages (in vim). For C, categories include:
> statement, label, conditional, loop keyword, to-do comment, regular
> comment, strings, escape syntax in string, various markers for
> incorrect syntax, operators, types, storage classes, constant symbols,
> preprocessor conditionals, other preprocessor directives, and probably
> more
> You can easily imagine that other languages have different categories,
> e.g. Perl might have a category for regular expressions.

Yes, but there are categories that don't seem very necessary to provide 
minimalist visual feedback, especially in the context of lisp (I know rms is 
working on a C reference in texinfo, but it's not like other languages are 
queueing to get a texinfo reference).

Elisp/C/Scheme (Guile) seem to be the 3 languages at the core of the Gnu 
project, so providing texinfo with some minimal infrastructure to cover just 
the 3 of them could be a start?

> I wonder if there should be some way of specifying the language of an
> @example block. For example,
> @example elisp
> (defun subst (x y z)
>  (cond ((atom z)
>         (cond ((eq z y) x)
>               ('t z)))
>        ('t (cons (subst x y (car z))
>                  (subst x y (cdr z))))))
> @end example
> producing a marker in the HTML output that could be used by a syntax
> highlighter.

As I wrote earlier, org does that (and the flexibility of org was a reason why 
it was suggested a while ago that org-mode should be used instead of texinfo to 
write the emacs and related documentation).

My understanding is that org calls the elisp mode that supports the language to 
offer syntax highlighting and proper indentation. But that stays in the org 
buffer (except if the file is exported to html).

I have no idea what I am talking about, mind you, but maybe having makeinfo 
call the appropriate mode, export the code block region to html based on that 
mode and insert that html into the "general" makeinfo HTML output would be the 
way to go ? Maybe not all the styles, etc., but just the HTML structure 
(anything within <body> </body>) so that texinfo specific styles can later be 

That would require to be aware of what structure each mode gives to such output 
so that proper CSS selectors are used (which is inconvenient). There are 
probably more elegant ways to achieve that, though.

Jean-Christophe Helary
----------------------------------------------- @brandelune

reply via email to

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