unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Anders Lindgren <andlind@gmail.com>
To: Davis Herring <herring@lanl.gov>
Cc: Stephen Leake <stephen_leake@stephe-leake.org>,
	Drew Adams <drew.adams@oracle.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: compilation-mode, face, font-lock-face
Date: Thu, 2 Feb 2017 21:43:18 +0100	[thread overview]
Message-ID: <CABr8eba_8Ahy6-MofZ6eneFenv0cx1W3ZgUbv6cdcCbCkT10FQ@mail.gmail.com> (raw)
In-Reply-To: <a250c4ff-6574-7d13-e330-74b412847e1e@lanl.gov>

[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]

On Thu, Feb 2, 2017 at 8:31 PM, Davis Herring <herring@lanl.gov> wrote:

> OK, I can understand that if there is no display then there
>> _cannot_ be any font-locking, so the `noninteractive' test
>> makes sense, I guess.
>>
>
> Even that is questionable -- there are many (unfortunate) situations in
> which font-lock is used to apply syntactically meaningful properties to the
> text that might then be used by Lisp programs.  It's fine if font-lock
> skips configuring the lack of display, of course, and it could be OK for it
> to skip setting the face property (since a program that depended on
> examining it could be said to be broken).  But even then, what if a
> non-interactive Emacs is supposed to be running tests of font-lock itself?


Fortunately, it's easy to bypass this test. `font-lock-fontify-region` can
be called explicitly to add highlighting even in batch mode. Alternatively,
`noninteractive` is a variable that can be bound to another value. For
example, I do the following in one of my packages*:

            (let ((noninteractive nil))
              (font-lock-mode 1))

*) "e2ansi", a package that converts text with face information into ANSI
sequences. You can configure "less" to run an emacs in batch mode to add
syntax highlighting to anything viewed in the terminal. See the environment
variable LESSOPEN and https://github.com/Lindydancer/e2ansi for more
information.


But even then, what if a non-interactive Emacs is supposed to be running
> tests of font-lock itself?


Funny you should ask. I just published a collection of tests for font-lock
the other day. It consists of real-world source files in various
programming languages and font-lock reference files in "faceup" format. It
run fine in batch mode as well as in the GUI. See
https://github.com/Lindydancer/font-lock-regression-suite and
https://github.com/Lindydancer/faceup for more information.

    -- Anders

[-- Attachment #2: Type: text/html, Size: 2969 bytes --]

      reply	other threads:[~2017-02-02 20:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 10:52 compilation-mode, face, font-lock-face Stephen Leake
2017-02-02 11:52 ` Michael Heerdegen
2017-02-02 16:47   ` Stephen Leake
2017-02-02 17:33     ` Drew Adams
2017-02-02 19:31       ` Davis Herring
2017-02-02 20:43         ` Anders Lindgren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABr8eba_8Ahy6-MofZ6eneFenv0cx1W3ZgUbv6cdcCbCkT10FQ@mail.gmail.com \
    --to=andlind@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=herring@lanl.gov \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).