* bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting
@ 2016-04-10 23:02 Dima Kogan
2016-04-11 9:15 ` Andreas Schwab
2016-04-11 12:47 ` Anders Lindgren
0 siblings, 2 replies; 4+ messages in thread
From: Dima Kogan @ 2016-04-10 23:02 UTC (permalink / raw)
To: 23266
[-- Attachment #1: Type: text/plain, Size: 820 bytes --]
Hi. I'm running an emacs built from the emacs-25 branch on 2016/04/05
(a05fb21). I'm seeing Makefiles incorrectly rendered at times. Example.
I load the following Makefile:
===================================
XXX := \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb \
$(DIR)/aaa/bbb
===================================
Things look correct here. In particular all the DIR are rendered with
font-lock-variable-name-face
I then kill (with C-k) any of the DIR lines. Two of the DIR around the
line being killed then lose the font-lock-variable-name-face. The buffer
needs to be reverted to get proper highlighting back. I'm attaching
screenshots (emacs -Q -nw) before and after the kill.
Thanks
[-- Attachment #2: before.png --]
[-- Type: image/png, Size: 1670 bytes --]
[-- Attachment #3: after.png --]
[-- Type: image/png, Size: 1400 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting
2016-04-10 23:02 bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting Dima Kogan
@ 2016-04-11 9:15 ` Andreas Schwab
2016-04-11 12:47 ` Anders Lindgren
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2016-04-11 9:15 UTC (permalink / raw)
To: Dima Kogan; +Cc: 23266
Dima Kogan <dima@secretsauce.net> writes:
> I then kill (with C-k) any of the DIR lines. Two of the DIR around the
> line being killed then lose the font-lock-variable-name-face. The buffer
> needs to be reverted to get proper highlighting back.
Does M-o M-o also restore proper highlighting?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting
2016-04-10 23:02 bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting Dima Kogan
2016-04-11 9:15 ` Andreas Schwab
@ 2016-04-11 12:47 ` Anders Lindgren
2021-07-08 0:58 ` Lars Ingebrigtsen
1 sibling, 1 reply; 4+ messages in thread
From: Anders Lindgren @ 2016-04-11 12:47 UTC (permalink / raw)
To: 23266, Dima Kogan, Andreas Schwab
[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]
Hi!
I think it's the following font-lock keyword that is broken:
("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\|[@%<?^+*][FD]?\\)"
(1 font-lock-variable-name-face prepend))
The regexp match constructs like $(NAME). However, in an attempt not to
match $$(NAME), it tries to match any other character besides $ before
$(NAME). When $(NAME) is at the beginning of a line, at the beginning of
the search, this fails.
The reason why the buffer originally is colored correctly is that the [^$]
match the newline of the previous line. However, after an edit, font-lock
only highlights the edited parts. When the search resumes on a line
starting with $(NAME), the regexp no longer match.
You can verify this in Font-Lock Studio (
https://github.com/Lindydancer/font-lock-studio) by first single-stepping
(SPC) the rule in the whole buffer, then mark a single line and step only
that line, using `font-lock-studio' and `font-lock-studio-region',
respectively.
This can be fixed in a number of ways:
* Replace "[^$]" with "\\(^\\|[^$]\\)", which mean to match the beginning
of a line or any non-$ character.
* Implement the search in a function that would search for the regex
(except the "[^$]" part) plus code to check that it's not preceded by a "$".
* Extend the region that should be highlighted to include all lines that
end with the "\" character. This can be done by adding a mode-specific
function to `font-lock-extend-region-functions'.
Note that there seems to be six rules in Makefile mode using this pattern,
I guess all of them needs to be fixes.
-- Anders Lindgren
[-- Attachment #2: Type: text/html, Size: 2026 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting
2016-04-11 12:47 ` Anders Lindgren
@ 2021-07-08 0:58 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-08 0:58 UTC (permalink / raw)
To: Anders Lindgren; +Cc: Andreas Schwab, 23266, Dima Kogan
Anders Lindgren <andlind@gmail.com> writes:
> This can be fixed in a number of ways:
>
> * Replace "[^$]" with "\\(^\\|[^$]\\)", which mean to match the beginning of a
> line or any non-$ character.
Thanks; I did this in Emacs 28, and it seems to fix the issue.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-08 0:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 23:02 bug#23266: 25.0.92; GNUmakefile mode incorrect syntax highlighting Dima Kogan
2016-04-11 9:15 ` Andreas Schwab
2016-04-11 12:47 ` Anders Lindgren
2021-07-08 0:58 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.