[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Changing Color Of Column # In Modeline

From: Drew Adams
Subject: RE: Changing Color Of Column # In Modeline
Date: Fri, 25 Nov 2005 10:54:33 -0800

    > >
    > This one looks too restrictive.  Some time ago I wrote this:
    > Ilya

    I always knew it should be done that way but I never use tabs or
    multi-column characters so it's been low on my to-do list. Perhaps
    now I can knock that item off my list.

Well, "should be done that way" is not so clear, to me. I see different
advantages with RGB's code and Ilya's code:

 - RGB's code lets you easily highlight multiple columns (with different
faces), move those columns, and turn their highlighting on/off

 - Ilya's code treats multiple-column characters such as TAB correctly

Of course, Ilya's code might be made more flexible, by wrapping it in
commands that provide the advantages of RGB's code.

For reference (for those who lost the thread), here is Ilya's code, with a
variable substituted for `79', tabs untabified, and `secondary-selection'
quoted (so it will also work in Emacs 20):

(defvar limit-column 30)

(defun match-at-column (end)
  (let (done c res)
    (while (and (not done) (< (point) end))
      (cond ((< limit-column (current-column)) (forward-line 1))
            ((< limit-column (move-to-column (1+ limit-column)))
             (setq done t res t)
             (forward-char -1)
             (re-search-forward "."))
            ((eobp) (setq done t))
            (t (forward-line 1))))

(add-hook 'font-lock-mode-hook
          (lambda ()
             '((match-at-column 0 'secondary-selection t))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]