[Top][All Lists]

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

Re: UI tests

From: Alan Mackenzie
Subject: Re: UI tests
Date: Thu, 12 Nov 2015 14:37:25 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, Phillip.

On Thu, Nov 12, 2015 at 02:09:32PM +0000, Phillip Lord wrote:

[ .... ]

> One additional problem, though, is that Emacs doesn't really have a
> concept of "headless". Things like syntax highlighting in buffers just
> work different when running in batch, because Emacs assumes it's running
> on a TTY. For example, HTML generated by htmlize comes out differently
> in batch, than from a windowed Emacs, because Emacs in batch cannot
> display colour.

I'm not sure whether or not this is relevant, but Emacs can be duped
into doing font-locking in batch mode.  Please examine the following
function (out of CC Mode's 000tests.el), and see if there's anything
in it you could use:

(defun cc-test-force-font-lock-buffer ()
  ;; Try to forcibly font lock the current buffer, even in batch mode.
  ;; We're doing really dirty things to trick font-lock into action in
  ;; batch mode in the different emacsen.
  (let ((orig-noninteractive-function
         (and (fboundp 'noninteractive)
              (symbol-function 'noninteractive)))
         (and (boundp 'noninteractive)
              (symbol-value 'noninteractive)))
        ;; font-lock in XEmacs 19 looks at a variable named `noninteractive'.
        (noninteractive nil))
          (when orig-noninteractive-function
            ;; XEmacs (at least 21.4) calls `noninteractive' to check
            ;; for batch mode, so we let it lie.
            (fset 'noninteractive (lambda () nil)))
          (font-lock-mode 1)
          (unless (or (get-text-property (point-min) 'face)
                      (next-single-property-change (point-min) 'face))
            ;; Some emacsen have already fontified the buffer above,
            ;; but others need some more coercion..
            (let (;; Avoid getting some lazy fontification package that
                  ;; might decide that nothing should be done.
      (when orig-noninteractive-function
        (fset 'noninteractive orig-noninteractive-function)))))

> Phil

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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