From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: ruler support in hexl mode Date: 11 Mar 2004 12:43:40 -0500 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 1079100576 32751 80.91.224.253 (12 Mar 2004 14:09:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Mar 2004 14:09:36 +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 15:09:29 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 1B1nLs-0003hj-00 for ; Fri, 12 Mar 2004 15:09:28 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1nLs-0004nA-00 for ; Fri, 12 Mar 2004 15:09:28 +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 1B1hKd-0008Ss-Gn for emacs-devel@quimby.gnus.org; Fri, 12 Mar 2004 02:43:47 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B1hJx-0008Rs-Sy for emacs-devel@gnu.org; Fri, 12 Mar 2004 02:43:05 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B1dGl-0004gy-TW for emacs-devel@gnu.org; Thu, 11 Mar 2004 22:24:03 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B1UDi-0000DI-GB for emacs-devel@gnu.org; Thu, 11 Mar 2004 12:43:46 -0500 Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 1CC2C204EE; Thu, 11 Mar 2004 12:43:41 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id C21508C8E4; Thu, 11 Mar 2004 12:43:40 -0500 (EST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: Original-Lines: 33 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-1.524, requis 5, BAYES_01 -1.52) 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:20353 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20353 > 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. 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. 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. Stefan