help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Changing Color Of Column # In Modeline


From: Ilya Zakharevich
Subject: Re: Changing Color Of Column # In Modeline
Date: Tue, 22 Nov 2005 23:09:02 +0000 (UTC)
User-agent: trn [how to get a version via %-escapes???] with a custom header

[A complimentary Cc of this posting was sent to
rgb
<rbielaws@i1.net>], who wrote in article 
<1132680280.003922.155730@g47g2000cwa.googlegroups.com>:
> > Is that possible?  Does anyone have a code snippet which does that or
> > something similar?
> 
> http://www.emacswiki.org/cgi-bin/wiki/ColumnMarker

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

(defun match-at-column-79 (end)
  (let (done c res)
    (while (and (not done)
                (< (point) end))
      ;;(message "At point=%s, end=%s, col=%s" (point) end (setq c 
(current-column)))
      (cond                             ; need to move forward >=1 char
          ((< 79 (current-column))
           (forward-line 1))            ; will not move at eobp only
          ((< 79 (move-to-column 80))   ; will move >= 0 char; 0 chars at eolp
           (setq done t res t)
           (forward-char -1)
           (re-search-forward "."))
          ((eobp)
           (setq done t))
          (t
           (forward-line 1))))
    res))

(add-hook 'font-lock-mode-hook
          (function
           (lambda ()
             (font-lock-add-keywords 
              nil
              '((match-at-column-79 0 secondary-selection t))
              'append))))

Hope this helps,
Ilya


reply via email to

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