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

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

font-lock problem with a block of text (font-latex)


From: Jim Ottaway
Subject: font-lock problem with a block of text (font-latex)
Date: Wed, 07 Jan 2004 17:45:18 +0000
User-agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.2 (gnu/linux)

I am using font-latex with the AUCTeX LaTeX mode (CVS version), but
this is more likely a more general question about font-locking blocks
of text.

I don't like the way that the highlighting in footnotes overrides any
other highlighting of code within the footnote, so in my .emacs I
have:

(defvar hlfn-fn-face 'hlfn-fn-face)

;;; with a light default background, changing the background looks
;;; better, and with a dark background, changing the foreground looks
;;; better.
(defface hlfn-fn-face
  '((((class color) (background light))
     (:background "gray90"))
    (((class color) (background dark))
     (:foreground "seagreen3")))
  "Face for footnote text in LaTeX mode.")

(defvar hlfn-fn-regexp "\\\\footnote\\>")

(defun hlfn-match (limit)
  (require 'font-latex)
  (font-latex-match-command-outside-arguments 
   hlfn-fn-regexp
   limit nil nil))

(defun latex-extra-font-lock ()
  (font-lock-add-keywords
   nil
   '((hlfn-match
      (0 font-lock-keyword-face append t)
      (2 hlfn-fn-face append t)))
   t))

(add-hook 'LaTeX-mode-hook 'latex-extra-font-lock)

And I have removed footnote from `font-latex-match-reference'.

This does what I want; I can see the extent of the footnote because it
is highlighted with hlfn-fn-face, and any other commands in the
footnote are highlighted too.  

My problem is with the highlighting of the background (when the
default background is light), the grey colour extends to the edge of
the window, and I would like to limit it to the end of the line:

Felix qui potuit rerum cognoscere causas,###########################
Quique metus omnes, et inexorabile fatum,###########################
Subjecit pedibus, strepitumque Acherontis avari---##################
                                                                    
In the above, the # characters show the highlighting that I would like
to avoid, it extends to the edge of the window.

I have tried some obvious things, such as adding '("\n" . default) to
the keywords, but it doesn't work.  Does anyone have any idea how this
could be done?

Regards,

Jim Ottaway




reply via email to

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