unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16525: 24.3; Weird font-lock for multi-line regexp
@ 2014-01-23  8:20 Alex Kost
  2014-01-23  8:30 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2014-01-23  8:20 UTC (permalink / raw)
  To: 16525

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

When I try to use a multi-line regexp in `font-lock-keywords', I have an
unusual result: some lines are highlighted and some are not (lines are
the same).

I have made a test mode, a text sample and a screenshot to show how it
looks for me when tested with "emacs -Q".

Recipe:
1. emacs -Q
2. Evaluate the contents of attached "test.el"
3. "M-x test-font-lock-mode" in a buffer with attached "sample"


[-- Attachment #2: test.el --]
[-- Type: application/emacs-lisp, Size: 339 bytes --]

[-- Attachment #3: sample --]
[-- Type: text/plain, Size: 2774 bytes --]

<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]
<foo> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua.  [18:42]

[-- Attachment #4: 2014-01-23_115015.png --]
[-- Type: image/png, Size: 162522 bytes --]

[-- Attachment #5: Type: text/plain, Size: 679 bytes --]


In GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-08-07 on -mnt-storage-buildroots-staging-i686-eric
Windowing system distributor `The X.Org Foundation', version 11.0.11405000
Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=i686 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16525: 24.3; Weird font-lock for multi-line regexp
  2014-01-23  8:20 bug#16525: 24.3; Weird font-lock for multi-line regexp Alex Kost
@ 2014-01-23  8:30 ` Glenn Morris
  2014-01-23  8:35   ` Glenn Morris
  2014-01-23  9:59   ` Alex Kost
  0 siblings, 2 replies; 4+ messages in thread
From: Glenn Morris @ 2014-01-23  8:30 UTC (permalink / raw)
  To: Alex Kost; +Cc: 16525

Alex Kost wrote:

> When I try to use a multi-line regexp in `font-lock-keywords', I have an
> unusual result: some lines are highlighted and some are not (lines are
> the same).
[...]
> (defun test-font-lock-keywords ()
>   '(("^<\\(foo\\)> \\(.+\\(?:
>  .+?\\)\\)\\(\\[.*\\]\\)$"
>      (1 'font-lock-function-name-face)
>      (2 'font-lock-comment-face)
>      (3 'font-lock-string-face))))

It's not that simple. See info node `(elisp)Font Lock Multiline'.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16525: 24.3; Weird font-lock for multi-line regexp
  2014-01-23  8:30 ` Glenn Morris
@ 2014-01-23  8:35   ` Glenn Morris
  2014-01-23  9:59   ` Alex Kost
  1 sibling, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2014-01-23  8:35 UTC (permalink / raw)
  To: Alex Kost; +Cc: 16525

Glenn Morris wrote:

> It's not that simple. See info node `(elisp)Font Lock Multiline'.

I meant to say, info node `(elisp)Multiline Font Lock'. Anyway, this

http://www.gnu.org/software/emacs/manual/html_node/elisp/Multiline-Font-Lock.html





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16525: 24.3; Weird font-lock for multi-line regexp
  2014-01-23  8:30 ` Glenn Morris
  2014-01-23  8:35   ` Glenn Morris
@ 2014-01-23  9:59   ` Alex Kost
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Kost @ 2014-01-23  9:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16525

Glenn Morris (2014-01-23 12:30 +0400) wrote:

> Alex Kost wrote:
>
>> When I try to use a multi-line regexp in `font-lock-keywords', I have an
>> unusual result: some lines are highlighted and some are not (lines are
>> the same).
> [...]
>> (defun test-font-lock-keywords ()
>>   '(("^<\\(foo\\)> \\(.+\\(?:
>>  .+?\\)\\)\\(\\[.*\\]\\)$"
>>      (1 'font-lock-function-name-face)
>>      (2 'font-lock-comment-face)
>>      (3 'font-lock-string-face))))
>
> It's not that simple. See info node `(elisp)Font Lock Multiline'.

Thank you, I should have searched before posting.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-23  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23  8:20 bug#16525: 24.3; Weird font-lock for multi-line regexp Alex Kost
2014-01-23  8:30 ` Glenn Morris
2014-01-23  8:35   ` Glenn Morris
2014-01-23  9:59   ` Alex Kost

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).