RE: How to highlight columns?
"Dan Bar Dov" <[email protected]> Wed, 24 Aug 2005 10:25:27 +0300
| Newsgroups | gmane.emacs.xemacs.general |
|---|---|
| Message-ID | <[email protected]> |
Good, except as you noted the tabs. Can it use the "tab-width" to compensate? Dan > -----Original Message----- > From: Glynn Clements [mailto:[email protected]] > Sent: Tuesday, August 23, 2005 9:41 PM > To: Dan Bar Dov > Cc: [email protected] > Subject: Re: How to highlight columns? > > > Dan Bar Dov wrote: > > > I'd like to highlight all text/code that's beyond column 80. > > I cannot figure how to set font-lock to do that, not how to > write an > > interactive functions to do that. > > Here's a simple example: > > (defun highlight-tail () > (interactive) > (let ((exp "^.\\{1,80\\}\\(.*\\)$") > (face (find-face 'highlight))) > (while (re-search-forward exp nil t) > (let* ((start (match-beginning 1)) > (end (match-end 1)) > (extent (make-extent start end))) > (set-extent-property extent 'face face) > (goto-char end))))) > > It highlights everything after the 80th character, which may > not be the 80th column due to characters spanning multiple > columns (primarily tabs, but also control characters using ^M > or \015 display forms). > > -- > Glynn Clements <[email protected]> >