emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Use regexp-opt in org-set-tag-faces
@ 2019-01-31 14:15 Anders Johansson
  2019-02-02 21:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Johansson @ 2019-01-31 14:15 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

I just noticed a place where it would be appropriate to use 
regexp-opt instead of doing:
(concat ":\\(" (mapconcat 'car value "\\|") "\\):"))))

regexp-opt promises to be more efficient.


-- 
Anders Johansson

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-faces.el-Use-regexp-opt-in-org-set-tag-faces.patch --]
[-- Type: text/x-patch, Size: 894 bytes --]

From 2a70a709dcbdb1ff7d00b20de8410935d725ac70 Mon Sep 17 00:00:00 2001
From: Anders Johansson <mejlaandersj@gmail.com>
Date: Thu, 31 Jan 2019 15:04:30 +0100
Subject: [PATCH] org-faces.el: Use regexp-opt in org-set-tag-faces

* org-faces.el (org-set-tag-faces): Use appropriate call to regexp-opt

TINYCHANGE
---
 lisp/org-faces.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 1ba5b5e..1b9118f 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -311,7 +311,7 @@ determines if it is a foreground or a background color."
   (if (not value)
       (setq org-tags-special-faces-re nil)
     (setq org-tags-special-faces-re
-	  (concat ":\\(" (mapconcat 'car value "\\|") "\\):"))))
+	  (concat ":" (regexp-opt (mapcar 'car value) t) ":"))))
 
 (defface org-checkbox '((t :inherit bold))
   "Face for checkboxes."
-- 
2.20.1


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

* Re: [PATCH] Use regexp-opt in org-set-tag-faces
  2019-01-31 14:15 [PATCH] Use regexp-opt in org-set-tag-faces Anders Johansson
@ 2019-02-02 21:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2019-02-02 21:51 UTC (permalink / raw)
  To: Anders Johansson; +Cc: emacs-orgmode@gnu.org

Hello,

Anders Johansson <mejlaandersj@gmail.com> writes:

> I just noticed a place where it would be appropriate to use regexp-opt
> instead of doing:
> (concat ":\\(" (mapconcat 'car value "\\|") "\\):"))))
>
> regexp-opt promises to be more efficient.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2019-02-02 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31 14:15 [PATCH] Use regexp-opt in org-set-tag-faces Anders Johansson
2019-02-02 21:51 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).