all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: Masatake YAMATO <jet@gyve.org>, emacs-devel@gnu.org
Subject: Re: ruler support in hexl mode
Date: 11 Mar 2004 17:27:06 +0100	[thread overview]
Message-ID: <m3k71rnycl.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <jwv65dfxi5i.fsf-monnier+emacs@asado.iro.umontreal.ca>

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 
> > +;; This function is derived from `ruler-mode-ruler' in ruler-mode.el.
> > +(defun hexl-mode-ruler ()
> > +  "Return a string ruler for hexl mode."
> > +  (when hexl-use-ruler
> > +    (let* ((fullw (ruler-mode-full-window-width))
> > +	   (w     (window-width))
> > +	   (m     (window-margins))
> > +	   (lsb   (ruler-mode-left-scroll-bar-cols))
> > +	   (lf    (ruler-mode-left-fringe-cols))
> > +	   (lm    (or (car m) 0))
> > +	   (ruler (make-string fullw ?\ ))
> 
> We really need to move this out of ruler-mode into frame.el or some other
> "global" file.  And to give it a clean interface so its implementation can
> be improved later.

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):

  (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))
    ;; Highlight the current column.
    (put-text-property (+ 11 (/ (* 5 highlight) 2))
                       (+ 13 (/ (* 5 highlight) 2))
                       'face 'highlight s))

> Note that the use of the display property also allows us to deal with
> fractional sizes, although lsb and lf don't take advantage of it yet.

The above code snippet does exact pixel alignment !

> Also I wish we could put some more useful info up there, but admittedly,
> I can't think of any.


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  parent reply	other threads:[~2004-03-11 16:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05  5:29 ruler support in hexl mode Masatake YAMATO
2004-03-08 20:05 ` Stefan Monnier
2004-03-09 12:11   ` Masatake YAMATO
2004-03-11  6:59   ` Masatake YAMATO
2004-03-11 16:27   ` Kim F. Storm [this message]
2004-03-11 17:43     ` Stefan Monnier
2004-03-11 23:56       ` Kim F. Storm
2004-03-12  6:05         ` Masatake YAMATO
2004-03-12 21:24           ` Stefan Monnier
2004-03-13 18:13             ` Masatake YAMATO
2004-03-15  7:37               ` Masatake YAMATO
2004-03-15  4:55       ` Richard Stallman
2004-03-15 11:00         ` Kim F. Storm
2004-03-16 19:02           ` Richard Stallman
2004-03-17  0:08             ` Kim F. Storm
2004-03-17  0:42               ` Stefan Monnier
2004-03-17  2:23               ` Kim F. Storm
2004-03-19  5:01               ` Richard Stallman
2004-03-19 10:06                 ` Kim F. Storm
2004-03-19 13:33                   ` Kim F. Storm
2004-03-08 21:00 ` Miles Bader
2004-03-11 14:41   ` Juanma Barranquero
2004-03-17  3:59     ` Miles Bader
2004-03-18  0:53       ` Juanma Barranquero
2004-03-20  4:48         ` Richard Stallman
2004-03-22 11:52           ` Juanma Barranquero

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k71rnycl.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=jet@gyve.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.