From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: ruler support in hexl mode Date: 12 Mar 2004 00:56:29 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20040305.142915.63122255.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1079071963 1802 80.91.224.253 (12 Mar 2004 06:12:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Mar 2004 06:12:43 +0000 (UTC) Cc: Masatake YAMATO , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Mar 12 07:12:31 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1fuJ-00030Z-00 for ; Fri, 12 Mar 2004 07:12:31 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1fuJ-0006Ss-00 for ; Fri, 12 Mar 2004 07:12:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B1fiG-0001Px-EP for emacs-devel@quimby.gnus.org; Fri, 12 Mar 2004 01:00:04 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B1fTe-0008CZ-93 for emacs-devel@gnu.org; Fri, 12 Mar 2004 00:44:58 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B1Z7F-0008Ce-Du for emacs-devel@gnu.org; Thu, 11 Mar 2004 17:57:57 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B1Z7E-0008CG-QZ for emacs-devel@gnu.org; Thu, 11 Mar 2004 17:57:24 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 9A47E47FE36; Thu, 11 Mar 2004 23:56:53 +0100 (CET) Original-To: Stefan Monnier In-Reply-To: Original-Lines: 43 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20340 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20340 Stefan Monnier writes: > > You can drop all of that ruler-mode- stuff if you use the advanced > > pixel-alignment form of :align-to (see xdisp.c around line 17990): > > Hey neat. When was this added? > > > (let ((s " 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789abcdef") > > (pos 0)) > > ;; Turn spaces in the header into stretch specs so they work > > ;; regardless of the header-line face. > > (while (string-match "[ \t]+" s pos) > > (setq pos (match-end 0)) > > (put-text-property (match-beginning 0) pos 'display > > ;; Assume fixed-size chars > > `(space :align-to (+ (scroll-bar . left) > > left-fringe left-margin > > ,(1- pos))) > > s)) > > Note that if there's no margin (i.e. 99% of the time) this will not align > things properly on a text terminal. This is the reason why I do > a `make-string' for the leading space: the size of the string is used > for alignment in text-terminals while the `display' prop is used otherwise. Clever! I didn't consider that. > > Of course, the text-terminal display engine should ideally be improved to > understand :align-to and such things, but I won't be the one to implement it. I can give it a try. > > Also, how about adding a `text-start' special case which would stand for > (+ (scroll-bar . left) left-fringe left-margin) so that we don't have to > remember all the possible display elements and so that when we decide to > add yet another display element we won't have to update the code. That's a good idea. I'll do that. -- Kim F. Storm http://www.cua.dk