(JDE users: This assumes `jde-use-font-lock' is set to nil. Can someone
figure out how to make it work with 'jde-use-font-lock' is t).
Usage:
In your .emacs -
(require 'highlight-beyond-fill-column)
(font-lock-add-keywords 'java-mode
'(
(find-after-fill-column 0 highlight prepend)
)
)
;------- begin highlight-beyond-fill-column.el --------
;-;;; highlight-beyond-fill-column.el --- font-lock-add-keywords aid for
Emacs
;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
;; Author: Sandip Chitale ([EMAIL PROTECTED])
;; Keywords: programming decipline convenience
;; Keywords:
;; Time-stamp: Aug 22 2001 11:10 AM Pacific Daylight Time
;; Version: 1.0
;; This file is *NOT* (yet?) part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Commentary:
;; This defines a function that can be used by `font-lock-add-keywords' to
find the columns
;; that are beyond `fill-column'.
;;
;; Installation:
;; Put the following in your .emacs
;;
;; (require 'highlight-beyond-fill-column)
;;
;; Example usage:
;;
;; Setup java-mode
;; (font-lock-add-keywords 'java-mode
;; '(
;; (find-after-fill-column 0 highlight prepend)
;; )
;; )
; Setup emacs-lis[-mode
;; (font-lock-add-keywords 'emacs-lisp-mode
;; '(
;; (find-after-fill-column 0 highlight prepend)
;; )
;; )
;; This is based on initial code provided by Jim Janney
([EMAIL PROTECTED])
;;; Code:
(defun find-after-fill-column (limit)
"A function that can be used by `font-lock-add-keywords' to find columns
that are
beyond the `fill-column'."
(let (
; remember the point
(original-point (point))
)
; if already past the fill column start on next line
(if (> (current-column) fill-column)
(forward-line 1)
)
(while (and (< (point) limit) ;
still within limit
(or (< (move-to-column fill-column) fill-column) ; the
line has less than `fill-column' columns
(= (point) (line-end-position)) ; end
of line
)
)
; goto next line
(forward-line 1)
)
(if (>= (point) limit) ;
beyond limit
(progn
(goto-char original-point) ;
restore point
nil ;
return nil
)
(set-match-data (list (point-marker) ; set
match data
(progn
(end-of-line)
(forward-char) ; this
gives the highlight till the end of the window
(point-marker)
)
)
)
t) ;
return t indicating that the match data was set
)
)
(provide 'highlight-beyond-fill-column)
------ end highlight-beyond-fill-column.el --------