emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Anders Johansson <mejlaandersj@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Use regexp-opt in org-set-tag-faces
Date: Thu, 31 Jan 2019 15:15:59 +0100	[thread overview]
Message-ID: <87ftt8hq00.fsf@gmail.com> (raw)

[-- 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


             reply	other threads:[~2019-01-31 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 14:15 Anders Johansson [this message]
2019-02-02 21:51 ` [PATCH] Use regexp-opt in org-set-tag-faces Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftt8hq00.fsf@gmail.com \
    --to=mejlaandersj@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).