* How to highlight UUID in all buffes?
@ 2022-10-15 7:11 Jean Louis
2022-10-15 7:17 ` Emanuel Berg
2022-10-15 7:41 ` Jean Louis
0 siblings, 2 replies; 11+ messages in thread
From: Jean Louis @ 2022-10-15 7:11 UTC (permalink / raw)
To: Help GNU Emacs
I would like to highlight UUID in all buffers, how to do it?
67454f35-bd05-4712-b6c4-88f40e883f10
Complete guide to Universal Unique Identifiers (UUID) | UUIDTools.com:
https://www.uuidtools.com/what-is-uuid
So I wish to get Emacs regular expression from reference:
UUID Regular Expression (REGEX)
The regex below can be used to validate the format of UUIDs:
[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}
RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace:
https://www.rfc-editor.org/rfc/rfc4122
Universally unique identifier - Wikipedia:
https://en.wikipedia.org/wiki/Universally_unique_identifier
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 7:11 How to highlight UUID in all buffes? Jean Louis
@ 2022-10-15 7:17 ` Emanuel Berg
2022-10-15 7:41 ` Jean Louis
1 sibling, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2022-10-15 7:17 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
Jean Louis wrote:
> [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}
Write that in Elisp and then get it font locked like this ...
(font-lock-add-keywords 'emacs-lisp-mode
'(
("font-lock-builtin-face" . font-lock-builtin-face)
("font-lock-comment-delimiter-face" . font-lock-comment-delimiter-face)
("font-lock-comment-face" . font-lock-comment-face)
("font-lock-constant-face" . font-lock-constant-face)
("font-lock-doc-face" . font-lock-doc-face)
("font-lock-function-name-face" . font-lock-function-name-face)
("font-lock-keyword-face" . font-lock-keyword-face)
("font-lock-negation-char-face" . font-lock-negation-char-face)
("font-lock-preprocessor-face" . font-lock-preprocessor-face)
("font-lock-regexp-grouping-backslash" . 'font-lock-regexp-grouping-backslash)
("font-lock-regexp-grouping-construct" . 'font-lock-regexp-grouping-construct)
("font-lock-string-face" . font-lock-string-face)
("font-lock-type-face" . font-lock-type-face)
("font-lock-variable-name-face" . font-lock-variable-name-face)
("font-lock-warning-face" . font-lock-warning-face)
)
t)
https://dataswamp.org/~incal/figures/emacs/dressed-up-as-themselves.png
[-- Attachment #2: dressed-up-as-themselves.png --]
[-- Type: image/png, Size: 6768 bytes --]
[-- Attachment #3: Type: text/plain, Size: 61 bytes --]
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 7:11 How to highlight UUID in all buffes? Jean Louis
2022-10-15 7:17 ` Emanuel Berg
@ 2022-10-15 7:41 ` Jean Louis
2022-10-15 8:11 ` William Xu
1 sibling, 1 reply; 11+ messages in thread
From: Jean Louis @ 2022-10-15 7:41 UTC (permalink / raw)
To: Help GNU Emacs
Now I found regular expression in library thingatpt:
(defconst thing-at-point-uuid-regexp
(rx bow
(repeat 8 hex-digit) "-"
(repeat 4 hex-digit) "-"
(repeat 4 hex-digit) "-"
(repeat 4 hex-digit) "-"
(repeat 12 hex-digit)
eow)
"A regular expression matching a UUID.
See RFC 4122 for the description of the format.")
How to invoke highlighting in every buffer on UUID?
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 7:41 ` Jean Louis
@ 2022-10-15 8:11 ` William Xu
2022-10-15 9:33 ` Jean Louis
0 siblings, 1 reply; 11+ messages in thread
From: William Xu @ 2022-10-15 8:11 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> Now I found regular expression in library thingatpt:
>
> (defconst thing-at-point-uuid-regexp
> (rx bow
> (repeat 8 hex-digit) "-"
> (repeat 4 hex-digit) "-"
> (repeat 4 hex-digit) "-"
> (repeat 4 hex-digit) "-"
> (repeat 12 hex-digit)
> eow)
> "A regular expression matching a UUID.
> See RFC 4122 for the description of the format.")
>
> How to invoke highlighting in every buffer on UUID?
Use font-lock-add-keywords?
--
William
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 8:11 ` William Xu
@ 2022-10-15 9:33 ` Jean Louis
2022-10-15 10:34 ` William Xu
2022-10-15 10:55 ` Daniel Martín
0 siblings, 2 replies; 11+ messages in thread
From: Jean Louis @ 2022-10-15 9:33 UTC (permalink / raw)
To: William Xu; +Cc: help-gnu-emacs
* William Xu <william.xwl@gmail.com> [2022-10-15 11:13]:
> Jean Louis <bugs@gnu.support> writes:
>
> > Now I found regular expression in library thingatpt:
> >
> > (defconst thing-at-point-uuid-regexp
> > (rx bow
> > (repeat 8 hex-digit) "-"
> > (repeat 4 hex-digit) "-"
> > (repeat 4 hex-digit) "-"
> > (repeat 4 hex-digit) "-"
> > (repeat 12 hex-digit)
> > eow)
> > "A regular expression matching a UUID.
> > See RFC 4122 for the description of the format.")
> >
> > How to invoke highlighting in every buffer on UUID?
>
> Use font-lock-add-keywords?
I have tried this:
(font-lock-add-keywords 'mail-mode '((thing-at-point-uuid-regexp 1 'link)))
77cf1d78-9b35-4f20-a240-9ef1552702f4
But I don't see it working.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 9:33 ` Jean Louis
@ 2022-10-15 10:34 ` William Xu
2022-10-15 10:42 ` Jean Louis
2022-10-15 10:55 ` Daniel Martín
1 sibling, 1 reply; 11+ messages in thread
From: William Xu @ 2022-10-15 10:34 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> I have tried this:
>
> (font-lock-add-keywords 'mail-mode '((thing-at-point-uuid-regexp 1 'link)))
Try:
(font-lock-add-keywords 'mail-mode `((,(concat "\\(" thing-at-point-uuid-regexp "\\)") 1 'link)))
--
William
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 10:34 ` William Xu
@ 2022-10-15 10:42 ` Jean Louis
2022-10-15 11:03 ` William Xu
0 siblings, 1 reply; 11+ messages in thread
From: Jean Louis @ 2022-10-15 10:42 UTC (permalink / raw)
To: William Xu; +Cc: help-gnu-emacs
* William Xu <william.xwl@gmail.com> [2022-10-15 13:36]:
> Jean Louis <bugs@gnu.support> writes:
>
> > I have tried this:
> >
> > (font-lock-add-keywords 'mail-mode '((thing-at-point-uuid-regexp 1 'link)))
>
> Try:
>
> (font-lock-add-keywords 'mail-mode `((,(concat "\\(" thing-at-point-uuid-regexp "\\)") 1 'link)))
64ec985c-5aeb-4e24-952f-ef66b7f8bf1e
When I do:
{M-x font-lock-update RET}
I get:
Debugger entered--Lisp error: (void-function thing-at-point-uuid-regexp)
thing-at-point-uuid-regexp(565)
font-lock-fontify-keywords-region(1 565 nil)
font-lock-default-fontify-region(1 565 nil)
font-lock-fontify-region(1 565)
font-lock-update(nil)
funcall-interactively(font-lock-update nil)
call-interactively(font-lock-update record nil)
command-execute(font-lock-update record)
execute-extended-command(nil "font-lock-update" "font-lock-update")
funcall-interactively(execute-extended-command nil "font-lock-update" "font-lock-update")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 10:42 ` Jean Louis
@ 2022-10-15 11:03 ` William Xu
0 siblings, 0 replies; 11+ messages in thread
From: William Xu @ 2022-10-15 11:03 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> * William Xu <william.xwl@gmail.com> [2022-10-15 13:36]:
>> Jean Louis <bugs@gnu.support> writes:
>>
>> > I have tried this:
>> >
>> > (font-lock-add-keywords 'mail-mode '((thing-at-point-uuid-regexp 1 'link)))
>>
>> Try:
>>
>> (font-lock-add-keywords 'mail-mode `((,(concat "\\(" thing-at-point-uuid-regexp "\\)") 1 'link)))
>
> 64ec985c-5aeb-4e24-952f-ef66b7f8bf1e
>
> When I do:
>
> {M-x font-lock-update RET}
>
> I get:
>
> Debugger entered--Lisp error: (void-function thing-at-point-uuid-regexp)
> thing-at-point-uuid-regexp(565)
Your added the keyword wrongly earlier. Try fock-lock-remove-keywords, or
simply restart your emacs.
--
William
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How to highlight UUID in all buffes?
2022-10-15 9:33 ` Jean Louis
2022-10-15 10:34 ` William Xu
@ 2022-10-15 10:55 ` Daniel Martín
2022-10-16 9:55 ` Jean Louis
1 sibling, 1 reply; 11+ messages in thread
From: Daniel Martín @ 2022-10-15 10:55 UTC (permalink / raw)
To: William Xu; +Cc: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
>
> I have tried this:
>
> (font-lock-add-keywords 'mail-mode '((thing-at-point-uuid-regexp 1 'link)))
>
> 77cf1d78-9b35-4f20-a240-9ef1552702f4
>
> But I don't see it working.
You need to eval the defconst when creating the list (with a backquote
construct), and replace the 1 with 0 because your regular expression
does not use any groups. That is:
(font-lock-add-keywords 'mail-mode `((,thing-at-point-uuid-regexp 0 'link)))
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-10-16 16:12 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-15 7:11 How to highlight UUID in all buffes? Jean Louis
2022-10-15 7:17 ` Emanuel Berg
2022-10-15 7:41 ` Jean Louis
2022-10-15 8:11 ` William Xu
2022-10-15 9:33 ` Jean Louis
2022-10-15 10:34 ` William Xu
2022-10-15 10:42 ` Jean Louis
2022-10-15 11:03 ` William Xu
2022-10-15 10:55 ` Daniel Martín
2022-10-16 9:55 ` Jean Louis
2022-10-16 16:12 ` Bruno Barbier
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).