all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oliver Scholz <epameinondas@gmx.de>
Cc: eliz@elta.co.il, dirt@gtk.org, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: terminal escapes in Info files?
Date: Wed, 29 Oct 2003 13:20:25 +0100	[thread overview]
Message-ID: <ud6cgi6ba.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: <jwv1xsxme9w.fsf-monnier+emacs/devel@vor.iro.umontreal.ca> (Stefan Monnier's message of "28 Oct 2003 13:08:37 -0500")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> Because, believe it or not, some people still use it,
>
> Of course I use it everyday.
>
>> there's a lot of history there, and just eradicating Info and replacing it
>> with HTML would not go over well.
>
> But by switching to something like enriched-mode, we're heading straight
> down that path and it isn't hard to see that sooner or later we'd want
> more than enriched-mode and ...
>
> I guess the question is: how much work would it require to take
> the subset of HTML generated by makeinfo and render it (both
> in M-x info and in the info program) ?
[...]

Just my 0.02 EUR:

The HTML for C-h i would not need to be “real” HTML, just something
which would look like HTML to a browser. What I mean is: It could be
like the text/enriched format (whitespace being significant, so that
you get a nice plain text when you just strip the markup), but with
tags borrowed from HTML:

<!-- [info file] -->
<html>
<h1>Defining Functions</h1>

<p>   We usually give a name to a function when it is first created.  This
is called "defining a function", and it is done with the `defun'
special form.</p>

<p> - Special Form: <b>defun</b> name argument-list body-forms
     `defun' is the usual way to define new Lisp functions.  It defines
     the symbol NAME as a function that looks like this:</p>

<code class="example"><pre>     
          (lambda ARGUMENT-LIST . BODY-FORMS)
</pre></code>

[...]

<code class="lisp"><pre>
          (defun capitalize-backwards ()
            "Upcase the last letter of a word."
            (interactive)
            (backward-word 1)
            (forward-word 1)
            (backward-char 1)
            (capitalize-word 1))
</pre></code>

[...]
</html>


In that case it should be simple to use either format.el or
`write-region-annotate-functions' to strip the markup and put faces or
other text properties on the text. Proof of concept (works with the
example above):


(defconst info-translations
  '((face (Info-title-1-face "h1")
	  (variable-pitch "p")
	  (bold "b"))
    (nil (nil "code"))
    (nil (nil "pre"))))

(defun info-next-annotation ()
  (let ((found nil))
    (while (and (not found)
		(search-forward "<" nil t))
      (backward-char 1)
      (cond ((looking-at "</\\([[:alnum:]]+\\)>")
	     (setq found (list (match-beginning 0)
			       (match-end 0)
			       (match-string 1)
			       nil)))
	    ((looking-at "<\\([[:alnum:]]+\\)\\(?:.*?\\)>")
	     (setq found (list (match-beginning 0)
			       (match-end 0)
			       (match-string 1)
			       t)))
	    ((looking-at "<!--")
	     (let ((beg (point)))
	       (when (search-forward "-->" nil t)
		 (skip-chars-forward "\n")
		 (delete-region beg (point)))))
	    (t (forward-char 1))))
    found))
	      

(defun info-deannotate-region (beg end)
  (interactive "r")
  (format-deannotate-region beg end info-translations
			    'info-next-annotation))



    Oliver
-- 
Oliver Scholz               8 Brumaire an 212 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org

  reply	other threads:[~2003-10-29 12:20 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-28 17:46 terminal escapes in Info files? Karl Berry
2003-10-28 18:08 ` Stefan Monnier
2003-10-29 12:20   ` Oliver Scholz [this message]
2003-10-29 14:21     ` Eli Zaretskii
2003-10-29 16:24       ` Oliver Scholz
2003-10-29 17:29         ` Robert J. Chassell
2003-10-29 18:09           ` Stefan Monnier
2003-10-30  1:13             ` Robert J. Chassell
2003-10-30  6:10               ` Stephen J. Turnbull
2003-10-30 22:06                 ` Robert J. Chassell
2003-11-03 12:19                   ` Stephen J. Turnbull
2003-10-30 16:36               ` Stefan Monnier
2003-10-29 18:40           ` Oliver Scholz
2003-10-29 19:09             ` Oliver Scholz
2003-10-29 20:02               ` Luc Teirlinck
2003-10-29 20:47                 ` Oliver Scholz
2003-10-29 22:58                   ` Luc Teirlinck
2003-10-30  2:37                   ` Robert J. Chassell
2003-10-30  2:55                   ` Robert J. Chassell
2003-10-29 17:45         ` Eli Zaretskii
2003-10-29 18:00         ` Reiner Steib
2003-10-29 18:43           ` Oliver Scholz
2003-10-30  4:19     ` Richard Stallman
2003-10-30  6:11       ` Eli Zaretskii
2003-10-31  0:07         ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-10-28 20:09 Karl Berry
2003-10-29 12:52 ` Oliver Scholz
2003-10-29 14:14   ` Eli Zaretskii
2003-10-29 14:31     ` Andreas Schwab
2003-10-29 17:51       ` Alper Ersoy
2003-10-29 18:53         ` Alper Ersoy
2003-10-29 18:11       ` Eli Zaretskii
2003-10-29 21:08         ` Andreas Schwab
2003-10-29 21:18           ` Alper Ersoy
2003-10-29 21:40           ` Eli Zaretskii
2003-10-29 15:28     ` Oliver Scholz
2003-10-31  2:29     ` Thien-Thi Nguyen
2003-10-29 19:02 ` Richard Stallman
2003-10-28 20:06 Karl Berry
2003-10-28 20:06 Karl Berry
2003-10-28 21:23 ` Stefan Monnier
2003-10-28 23:41 ` Miles Bader
2003-10-28 16:51 Karl Berry
2003-10-28 16:59 ` Stefan Monnier
2003-10-28 17:16   ` Eli Zaretskii
2003-10-28 17:56     ` Stefan Monnier
2003-10-28 20:34       ` Eli Zaretskii
2003-10-28 16:50 Karl Berry
2003-10-28  1:26 Karl Berry
2003-10-28 10:51 ` Alper Ersoy
2003-10-28 13:48   ` Oliver Scholz
2003-10-30 10:42     ` Alper Ersoy
2003-10-28 16:19   ` Stefan Monnier
2003-10-29 19:02     ` Richard Stallman
2003-10-29 19:47       ` David Kastrup
2003-10-29 21:43         ` Eli Zaretskii
2003-10-29 22:39           ` David Kastrup
2003-10-30  6:03             ` Eli Zaretskii
2003-10-30 18:00         ` Richard Stallman
2003-10-29 19:01   ` Richard Stallman
2003-10-29 19:45     ` Alper Ersoy
2003-10-29 19:42       ` Eli Zaretskii
2003-10-30 18:00       ` Richard Stallman
2003-10-29 19:02 ` Richard Stallman
2003-10-26 12:20 Karl Berry
2003-10-26 12:40 ` Simon Josefsson
2003-10-26 15:40   ` Alex Schroeder
2003-10-27  7:02 ` Richard Stallman
2003-10-27 19:29   ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=ud6cgi6ba.fsf@ID-87814.user.dfncis.de \
    --to=epameinondas@gmx.de \
    --cc=dirt@gtk.org \
    --cc=eliz@elta.co.il \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.