unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Josefsson <jas@extundo.com>
Cc: Alex Schroeder <alex@gnu.org>, dirt@gtk.org, emacs-devel@gnu.org
Subject: Re: terminal escapes in Info files?
Date: Sun, 26 Oct 2003 13:40:02 +0100	[thread overview]
Message-ID: <ilubrs4w4t9.fsf@extundo.com> (raw)
In-Reply-To: <200310261220.h9QCKsb15110@f7.net> (Karl Berry's message of "Sun, 26 Oct 2003 07:20:55 -0500")

karl@freefriends.org (Karl Berry) writes:

> 1) write ANSI terminal escape codes directly in the Info file.  (Even on
> non-ANSI terminals, if there are any left, these could be translated to
> appropriate termcap sequence.)
...
> - is one of (1) or (2) significantly easier to implement in Emacs?

Rendering ANSI escape sequences in e-mail was recently proposed for
Gnus, and thanks to ansi-color.el it is easy to do: just call
ansi-color-apply-on-region from ansi-color.el.  You only need to make
sure the ESC sequence is not destroyed until it reach the decoding
code, of course.

(autoload 'ansi-color-apply-on-region "ansi-color")

(defun article-treat-ansi-sequences ()
  "Translate ANSI SGR control sequences into overlays or extents."
  (interactive)
  (save-excursion
    (when (article-goto-body)
      (let ((buffer-read-only nil))
	(ansi-color-apply-on-region (point) (point-max))))))

PS.  Alex, what do you think about the following?  Those functions are
documented in the top-level comment, and appear to be basic API entry
points for the ansi-color.el library, so it might be useful to
autoload them.  I don't know if adding autoload cookies here and there
is considered polluting though.

--- ansi-color.el.~1.14.~	2003-10-07 19:16:00.000000000 +0200
+++ ansi-color.el	2003-10-26 13:37:37.000000000 +0100
@@ -1,6 +1,6 @@
 ;;; ansi-color.el --- translate ANSI escape sequences into faces
 
-;; Copyright (C) 1999, 2000, 2001  Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2003  Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Alex Schroeder <alex@gnu.org>
@@ -285,6 +285,7 @@
 escape sequence.")
 (make-variable-buffer-local 'ansi-color-context)
 
+;;;###autoload
 (defun ansi-color-filter-apply (string)
   "Filter out all SGR control sequences from STRING.
 
@@ -315,6 +316,7 @@
 	(setq ansi-color-context nil)))
     result))
 
+;;;###autoload
 (defun ansi-color-apply (string)
   "Translates SGR control sequences into text-properties.
 
@@ -398,6 +400,7 @@
 	(setq ansi-color-context-region (list nil (match-beginning 0)))
       (setq ansi-color-context-region nil)))))
 
+;;;###autoload
 (defun ansi-color-apply-on-region (begin end)
   "Translates SGR control sequences into overlays or extents.

  reply	other threads:[~2003-10-26 12:40 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-26 12:20 terminal escapes in Info files? Karl Berry
2003-10-26 12:40 ` Simon Josefsson [this message]
2003-10-26 15:40   ` Alex Schroeder
2003-10-27  7:02 ` Richard Stallman
2003-10-27 19:29   ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
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-28 16:50 Karl Berry
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 17:46 Karl Berry
2003-10-28 18:08 ` Stefan Monnier
2003-10-29 12:20   ` Oliver Scholz
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
2003-10-28 20:06 Karl Berry
2003-10-28 21:23 ` Stefan Monnier
2003-10-28 23:41 ` Miles Bader
2003-10-28 20:06 Karl Berry
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

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=ilubrs4w4t9.fsf@extundo.com \
    --to=jas@extundo.com \
    --cc=alex@gnu.org \
    --cc=dirt@gtk.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).