unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: displaying octal sequences in emacs 21.3.1
Date: Sat, 09 Oct 2004 12:48:38 +0200	[thread overview]
Message-ID: <ud5zsw4jd.fsf@ID-87814.user.uni-berlin.de> (raw)
In-Reply-To: m34ql5ovkd.fsf@tfkp07.physik.uni-erlangen.de

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> Eli Zaretskii <eliz@is.elta.co.il> writes:
>
>> On 2 Jul 1999, Roland Winkler wrote:
>> 
>> > My default setting for editing files is unibyte with
>> > iso-latin-1. What should I do if in certain buffers I want
>> > everything beyond 7bit asci to be displayed with the
>> > corresponding octal number?
[...]

I use this:

;; -------------------------------------------------------------------
;;; `eight-bit-graphic' and `eight-bit-control'

;; Display characters from the charsets `eight-bit-control' and
;; `eight-bit-graphic' as octal numbers in a different face.

(defface egoge-8bit-char-face
  '((t
     (:weight bold :inherit font-lock-warning-face)))
  "Face used to display characters from the charsets
`eight-bit-graphic' and `eight-bit-control'.")

(defun egoge-display-eight-bit-as-octal (&optional face)
  (let ((face-offset (if face
			 (* (face-id face)
			    (expt 2 19))
		       0))
	char)
    (dotimes (i 128)
      (setq char (+ i 128))
      (aset standard-display-table char
	    (vconcat (mapcar (lambda (c)
			       (+ face-offset c))
			     (format "\\%o" char)))))))

(unless (> emacs-major-version 21)
  (egoge-display-eight-bit-as-octal 'egoge-8bit-char-face))


It works in multibyte buffers, too.  And it works for all buffers.
IMO this is the right thing.  If you want to edit Latin-1, use a
multibyte buffer; if you want to see the octal sequences for
non-ascii, use a unibyte buffer.

[And actually I think something like this should be the default in
Emacs.]

    Oliver
-- 
18 Vendémiaire an 213 de la Révolution
Liberté, Egalité, Fraternité!

  reply	other threads:[~2004-10-09 10:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-08 19:32 displaying octal sequences in emacs 21.3.1 Roland Winkler
2004-10-09 10:48 ` Oliver Scholz [this message]
2004-10-09 10:56 ` Eli Zaretskii
     [not found] ` <mailman.2245.1097320047.2017.help-gnu-emacs@gnu.org>
2004-10-09 23:35   ` Roland Winkler
2004-10-10  4:47     ` 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

  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=ud5zsw4jd.fsf@ID-87814.user.uni-berlin.de \
    --to=alkibiades@gmx.de \
    /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.
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).