From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: displaying octal sequences in emacs 21.3.1 Date: Sat, 09 Oct 2004 12:48:38 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1097319213 622 80.91.229.6 (9 Oct 2004 10:53:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 9 Oct 2004 10:53:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 09 12:53:22 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CGEqo-0008GM-00 for ; Sat, 09 Oct 2004 12:53:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGExd-0004wl-Pz for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Oct 2004 07:00:25 -0400 Original-Newsgroups: gnu.emacs.help X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:/mGacV+zgR89DYWGOv0zYcOyOvw= Original-NNTP-Posting-Host: 84.57.49.112 Original-X-Trace: 9 Oct 2004 12:48:41 +0200, 84.57.49.112 Original-Lines: 55 Original-X-Complaints-To: abuse@arcor-ip.de Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!feed.news.tiscali.de!newsfeed.arcor-ip.de!news.arcor-ip.de!84.57.49.112 Original-Xref: shelby.stanford.edu gnu.emacs.help:125790 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21152 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21152 Roland Winkler writes: > Eli Zaretskii 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é!