[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 6e6354c074: org-tags-expand: Do no modify buffer's
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 6e6354c074: org-tags-expand: Do no modify buffer's syntax table by side effect |
Date: |
Mon, 8 May 2023 07:58:13 -0400 (EDT) |
branch: externals/org
commit 6e6354c074a323780f103aabf45be74104ce3ecf
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-tags-expand: Do no modify buffer's syntax table by side effect
* lisp/org.el (org-mode-tags-syntax-table): New variable holding
syntax table for tags.
(org-mode): Initialize tag syntax table.
(org-make-tags-matcher): Match tags using appropriate syntax table.
(org-tags-expand): Do no modify syntax table by side effect.
Reported-by: Mattias EngdegÄrd <mattias.engdegard@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#68
---
lisp/org.el | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 4fb2e94c80..542959f730 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4788,6 +4788,9 @@ This is for getting out of special buffers like capture.")
(defvar org-agenda-file-menu-enabled t
"When non-nil, refresh Agenda files in Org menu when loading Org.")
+(defvar org-mode-tags-syntax-table
+ "Syntax table including \"@\" and \"_\" as word constituents.")
+
;;;###autoload
(define-derived-mode org-mode outline-mode "Org"
"Outline-based notes management and organizer, alias
@@ -4844,6 +4847,12 @@ The following commands are available:
(modify-syntax-entry ?~ "_")
(modify-syntax-entry ?< "(>")
(modify-syntax-entry ?> ")<")
+ ;; Set tags syntax table.
+ (setq org-mode-tags-syntax-table
+ (make-syntax-table org-mode-syntax-table))
+ ;; @ and _ are allowed as word-components in tags.
+ (modify-syntax-entry ?@ "w" org-mode-tags-syntax-table)
+ (modify-syntax-entry ?_ "w" org-mode-tags-syntax-table)
(setq-local font-lock-unfontify-region-function 'org-unfontify-region)
;; Activate before-change-function
(setq-local org-table-may-need-update t)
@@ -11406,7 +11415,9 @@ See also `org-scan-tags'."
(propp (match-end 5))
(mm
(cond
- (regexp `(org-match-any-p ,(substring tag 1 -1) tags-list))
+ (regexp
+ `(with-syntax-table org-mode-tags-syntax-table
+ (org-match-any-p ,(substring tag 1 -1) tags-list)))
(levelp
`(,(org-op-to-function (match-string 3 term))
level
@@ -11518,7 +11529,6 @@ the list of tags in this group."
(single-as-list (org--tags-expand-group (list match) tag-groups nil))
(org-group-tags
(let* ((case-fold-search t)
- (tag-syntax org-mode-syntax-table)
(group-keys (mapcar #'car tag-groups))
(key-regexp (concat "\\([+-]?\\)" (regexp-opt group-keys 'words)))
(return-match match))
@@ -11529,11 +11539,8 @@ the list of tags in this group."
(setq s (match-end 0))
(add-text-properties
(match-beginning 0) (match-end 0) '(regexp t) return-match)))
- ;; @ and _ are allowed as word-components in tags.
- (modify-syntax-entry ?@ "w" tag-syntax)
- (modify-syntax-entry ?_ "w" tag-syntax)
;; For each tag token found in MATCH, compute a regexp and it
- (with-syntax-table tag-syntax
+ (with-syntax-table org-mode-tags-syntax-table
(replace-regexp-in-string
key-regexp
(lambda (m)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 6e6354c074: org-tags-expand: Do no modify buffer's syntax table by side effect,
ELPA Syncer <=