From: David Smith <davidsmith@acm.org>
To: emacs-orgmode@gnu.org
Subject: Non-ascii tag names
Date: Sun, 17 Jun 2007 03:01:44 +0900 [thread overview]
Message-ID: <f518hu$1t7$1@sea.gmane.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
Carsten, you said in
http://thread.gmane.org/gmane.emacs.orgmode/1327/focus=1328 that non-ascii
tag names are not supported. I've written a patch that seems to make this
work appropriately just by fixing the regexps involving tags to use
[:alnum:] instead of a-zA-Z0-9. Is this insufficient?
Cheers,
David
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: i18n_tags.patch --]
[-- Type: text/x-diff; name="i18n_tags.patch", Size: 14033 bytes --]
# HG changeset patch
# User David Smith <davidsmith@acm.org>
# Date 1182016499 -32400
# Node ID fbf053db75b446b7b896a943ed07696e2fe08110
# Parent 8296b36637ff07252e11bd5eb3f87946f33351a9
patch queue: i18n tags
diff -r 8296b36637ff -r fbf053db75b4 org.el
--- a/org.el Sun Jun 17 02:38:36 2007 +0900
+++ b/org.el Sun Jun 17 02:54:59 2007 +0900
@@ -3494,7 +3494,7 @@ means to push this value onto the list i
(cond
((equal e "{") (push '(:startgroup) tgs))
((equal e "}") (push '(:endgroup) tgs))
- ((string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e)
+ ((string-match "^\\([[:alnum:]_@]+\\)(\\(.\\))$" e)
(push (cons (match-string 1 e)
(string-to-char (match-string 2 e)))
tgs))
@@ -3530,7 +3530,7 @@ means to push this value onto the list i
org-todo-line-tags-regexp
(concat "^\\(\\*+\\)[ \t]*\\(?:\\("
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
- "\\)\\>\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)")
+ "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@]+:[ \t]*\\)?$\\)")
org-looking-at-done-regexp
(concat "^" "\\(?:"
(mapconcat 'regexp-quote org-done-keywords "\\|") "\\)"
@@ -4230,7 +4230,7 @@ between words."
"\\)\\>")))
(defun org-activate-tags (limit)
- (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
+ (if (re-search-forward "[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]" limit t)
(progn
(add-text-properties (match-beginning 1) (match-end 1)
(list 'mouse-face 'highlight
@@ -5981,7 +5981,7 @@ this heading."
(progn
(if (re-search-forward
(concat "\\(^\\|\r\\)"
- (regexp-quote heading) "[ \t]*\\(:[a-zA-Z0-9_@:]+:\\)?[ \t]*\\($\\|\r\\)")
+ (regexp-quote heading) "[ \t]*\\(:[[:alnum:]_@:]+:\\)?[ \t]*\\($\\|\r\\)")
nil t)
(goto-char (match-end 0))
;; Heading not found, just insert it at the end
@@ -6100,7 +6100,7 @@ If ONOFF is `on' or `off', don't toggle
(let (res current)
(save-excursion
(beginning-of-line)
- (if (re-search-forward "[ \t]:\\([a-zA-Z0-9_@:]+\\):[ \t]*$"
+ (if (re-search-forward "[ \t]:\\([[:alnum:]_@:]+\\):[ \t]*$"
(point-at-eol) t)
(progn
(setq current (match-string 1))
@@ -6206,9 +6206,9 @@ outside the table.")
(defconst org-table-range-regexp2
(concat
- "\\(" "@[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)"
+ "\\(" "@[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[[:alnum:]]+" "\\)"
"\\.\\."
- "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[a-zA-Z0-9]+" "\\)")
+ "\\(" "@?[-0-9I$&]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\|" "\\$[[:alnum:]]+" "\\)")
"Match a range for reference display.")
(defconst org-table-translate-regexp
@@ -7731,7 +7731,7 @@ When NAMED is non-nil, look for a named
"\n")))
(defsubst org-table-formula-make-cmp-string (a)
- (when (string-match "^\\(@\\([0-9]+\\)\\)?\\(\\$?\\([0-9]+\\)\\)?\\(\\$?[a-zA-Z0-9]+\\)?" a)
+ (when (string-match "^\\(@\\([0-9]+\\)\\)?\\(\\$?\\([0-9]+\\)\\)?\\(\\$?[[:alnum:]]+\\)?" a)
(concat
(if (match-end 2) (format "@%05d" (string-to-number (match-string 2 a))) "")
(if (match-end 4) (format "$%05d" (string-to-number (match-string 4 a))) "")
@@ -7752,7 +7752,7 @@ When NAMED is non-nil, look for a named
(when (looking-at "\\([ \t]*\n\\)*#\\+TBLFM: *\\(.*\\)")
(setq strings (org-split-string (match-string 2) " *:: *"))
(while (setq string (pop strings))
- (when (string-match "\\(@[0-9]+\\$[0-9]+\\|\\$\\([a-zA-Z0-9]+\\)\\) *= *\\(.*[^ \t]\\)" string)
+ (when (string-match "\\(@[0-9]+\\$[0-9]+\\|\\$\\([[:alnum:]]+\\)\\) *= *\\(.*[^ \t]\\)" string)
(setq scol (if (match-end 2)
(match-string 2 string)
(match-string 1 string))
@@ -10070,7 +10070,7 @@ according to FMT (default from `org-emai
;; We are using a headline, clean up garbage in there.
(if (string-match org-todo-regexp s)
(setq s (replace-match "" t t s)))
- (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
+ (if (string-match ":[[:alnum:]_@:]+:[ \t]*$" s)
(setq s (replace-match "" t t s)))
(setq s (org-trim s))
(if (string-match (concat "^\\(" org-quote-string "\\|"
@@ -10078,7 +10078,7 @@ according to FMT (default from `org-emai
(setq s (replace-match "" t t s)))
(while (string-match org-ts-regexp s)
(setq s (replace-match "" t t s))))
- (while (string-match "[^a-zA-Z_0-9 \t]+" s)
+ (while (string-match "[^[:alnum:] \t]+" s)
(setq s (replace-match " " t t s)))
(or string (setq s (concat "*" s))) ; Add * for headlines
(mapconcat 'identity (org-split-string s "[ \t]+") " ")))
@@ -10420,7 +10420,7 @@ optional argument IN-EMACS is non-nil, E
(setq type (match-string 1) path (match-string 2))
(throw 'match t)))
(save-excursion
- (when (org-in-regexp "\\(:[A-Za-z_@0-9:]+\\):[ \t]*$")
+ (when (org-in-regexp "\\(:[[:alnum:]_@:]+\\):[ \t]*$")
(setq type "tags"
path (match-string 1))
(while (string-match ":" path)
@@ -10645,7 +10645,7 @@ in all files. If AVOID-POS is given, ig
(when (equal (string-to-char s) ?*)
;; Anchor on headlines, post may include tags.
(setq pre "^\\*+[ \t]*\\(?:\\sw+\\)?[ \t]*"
- post "[ \t]*\\(?:[ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
+ post "[ \t]*\\(?:[ \t]+:[[:alnum:]_@:+]:[ \t]*\\)?$"
s (substring s 1)))
(remove-text-properties
0 (length s)
@@ -10863,7 +10863,7 @@ onto the ring."
"Follow a VM link to FOLDER and ARTICLE."
(require 'vm)
(setq article (org-add-angle-brackets article))
- (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
+ (if (string-match "^//\\([[:alnum:]]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
;; ange-ftp or efs or tramp access
(let ((user (or (match-string 1 folder) (user-login-name)))
(host (match-string 2 folder))
@@ -11118,9 +11118,9 @@ If the file does not exist, an error is
(old-pos (point))
(old-mode major-mode)
ext cmd)
- (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
+ (if (string-match "^.*\\.\\([[:alnum:]]+\\.gz\\)$" dfile)
(setq ext (match-string 1 dfile))
- (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
+ (if (string-match "^.*\\.\\([[:alnum:]]+\\)$" dfile)
(setq ext (match-string 1 dfile))))
(if in-emacs
(setq cmd 'emacs)
@@ -11397,7 +11397,7 @@ See also the variable `org-reverse-note-
(goto-char (point-min))
(if (re-search-forward
(concat "^\\*+[ \t]+" (regexp-quote heading)
- "\\([ \t]+:[@a-zA-Z0-9_:]*\\)?[ \t]*$")
+ "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$")
nil t)
(setq org-goto-start-pos (match-beginning 0))))
@@ -11591,10 +11591,10 @@ At all other locations, this simply call
(catch 'exit
(let* ((end (point))
(beg1 (save-excursion
- (skip-chars-backward "a-zA-Z_@0-9")
+ (skip-chars-backward "[:alnum:]_@")
(point)))
(beg (save-excursion
- (skip-chars-backward "a-zA-Z0-9_:$")
+ (skip-chars-backward "[:alnum:]_:$")
(point)))
(confirm (lambda (x) (stringp (car x))))
(searchhead (equal (char-before beg) ?*))
@@ -12267,7 +12267,7 @@ are included in the output."
are included in the output."
(let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
- "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*$"))
+ "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$"))
(props (list 'face nil
'done-face 'org-done
'undone-face nil
@@ -12364,7 +12364,7 @@ also TODO lines."
;; Parse the string and create a lisp form
(let ((match0 match)
- (re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|[A-Za-z_@0-9]+\\)")
+ (re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|[[:alnum:]_@]+\\)")
minus tag mm
tagsmatch todomatch tagsmatcher todomatcher kwd matcher
orterms term orlist re-p level-p)
@@ -12584,7 +12584,7 @@ Returns the new tags string, or nil to n
groups ingroup)
(save-excursion
(beginning-of-line 1)
- (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
+ (if (looking-at ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*\\(\r\\|$\\)")
(setq ov-start (match-beginning 1)
ov-end (match-end 1)
ov-prefix "")
@@ -12719,7 +12719,7 @@ Returns the new tags string, or nil to n
(delete-region (point) (point-at-eol))
(org-fast-tag-insert "Current" current c-face)
(org-set-current-tags-overlay current ov-prefix)
- (while (re-search-forward "\\[.\\] \\([a-zA-Z0-9_@]+\\)" nil t)
+ (while (re-search-forward "\\[.\\] \\([[:alnum:]_@]+\\)" nil t)
(setq tg (match-string 1))
(add-text-properties (match-beginning 1) (match-end 1)
(list 'face
@@ -12739,7 +12739,7 @@ Returns the new tags string, or nil to n
(error "Not on a heading"))
(save-excursion
(beginning-of-line 1)
- (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
+ (if (looking-at ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*\\(\r\\|$\\)")
(org-match-string-no-properties 1)
"")))
@@ -12748,7 +12748,7 @@ Returns the new tags string, or nil to n
(let (tags)
(save-excursion
(goto-char (point-min))
- (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
+ (while (re-search-forward "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]" nil t)
(mapc (lambda (x) (add-to-list 'tags x))
(org-split-string (org-match-string-no-properties 1) ":"))))
(mapcar 'list tags)))
@@ -13906,7 +13906,7 @@ the returned times will be formatted str
(when (setq time (get-text-property p :org-clock-minutes))
(save-excursion
(beginning-of-line 1)
- (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$")
+ (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$")
(setq level (- (match-end 1) (match-beginning 1)))
(<= level maxlevel))
(setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
@@ -15476,10 +15476,10 @@ MATCH is being ignored."
"\\)\\>"))
(tags (nth 2 org-stuck-projects))
(tags-re (if (member "*" tags)
- "^\\*+.*:[a-zA-Z0-9_@]+:[ \t]*$"
+ "^\\*+.*:[[:alnum:]_@]+:[ \t]*$"
(concat "^\\*+.*:\\("
(mapconcat 'identity tags "\\|")
- "\\):[a-zA-Z0-9_@:]*[ \t]*$")))
+ "\\):[[:alnum:]_@:]*[ \t]*$")))
(gen-re (nth 3 org-stuck-projects))
(re-list
(delq nil
@@ -16238,7 +16238,7 @@ only the correctly processes TXT should
(if s1 (setq s1 (org-get-time-of-day s1 'string t)))
(if s2 (setq s2 (org-get-time-of-day s2 'string t))))
- (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt)
+ (when (string-match "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$" txt)
;; Tags are in the string
(if (or (eq org-agenda-remove-tags t)
(and org-agenda-remove-tags
@@ -16977,7 +16977,7 @@ the new TODO state."
(let ((buffer-read-only))
(save-excursion
(goto-char (if line (point-at-bol) (point-min)))
- (while (re-search-forward "\\([ \t]+\\):[a-zA-Z0-9_@:]+:[ \t]*$"
+ (while (re-search-forward "\\([ \t]+\\):[[:alnum:]_@:]+:[ \t]*$"
(if line (point-at-eol) nil) t)
(delete-region (match-beginning 1) (match-end 1))
(goto-char (match-beginning 1))
@@ -17038,7 +17038,7 @@ the tags of the current headline come la
(org-back-to-heading t)
(condition-case nil
(while t
- (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
+ (if (looking-at "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
(setq tags (append (org-split-string
(org-match-string-no-properties 1) ":")
tags)))
@@ -18508,7 +18508,7 @@ underlined headlines. The default is 3.
(setq txt (org-html-expand-for-ascii txt))
(if (and (memq org-export-with-tags '(not-in-toc nil))
- (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
+ (string-match "[ \t]+:[[:alnum:]_@:]+:[ \t]*$" txt))
(setq txt (replace-match "" t t txt)))
(if (string-match quote-re0 txt)
(setq txt (replace-match "" t t txt)))
@@ -18655,7 +18655,7 @@ underlined headlines. The default is 3.
(insert "\n"))
(setq char (nth (- umax level) (reverse org-export-ascii-underline)))
(unless org-export-with-tags
- (if (string-match "[ \t]+\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
+ (if (string-match "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$" title)
(setq title (replace-match "" t t title))))
(if org-export-with-section-numbers
(setq title (concat (org-section-number level) " " title)))
@@ -19123,7 +19123,7 @@ lang=\"%s\" xml:lang=\"%s\">
(org-search-todo-below
line lines level))))
(if (and (memq org-export-with-tags '(not-in-toc nil))
- (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
+ (string-match "[ \t]+:[[:alnum:]_@:]+:[ \t]*$" txt))
(setq txt (replace-match "" t t txt)))
(if (string-match quote-re0 txt)
(setq txt (replace-match "" t t txt)))
@@ -19829,7 +19829,7 @@ But it has the disadvantage, that Org-mo
(defun org-export-cleanup-toc-line (s)
"Remove tags and time staps from lines going into the toc."
- (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s)
+ (if (string-match " +:[[:alnum:]_@:]+: *$" s)
(setq s (replace-match "" t t s)))
(when org-export-remove-timestamps-from-toc
(while (string-match org-maybe-keyword-time-regexp s)
@@ -19968,7 +19968,7 @@ When TITLE is nil, just close all open l
(when title
;; If title is nil, this means this function is called to close
;; all levels, so the rest is done only if title is given
- (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
+ (when (string-match "\\(:[[:alnum:]_@:]+:\\)[ \t]*$" title)
(setq title (replace-match
(if org-export-with-tags
(save-match-data
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next reply other threads:[~2007-06-16 20:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-16 18:01 David Smith [this message]
2007-06-16 22:15 ` Non-ascii tag names Carsten Dominik
2007-06-18 8:19 ` Carsten Dominik
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='f518hu$1t7$1@sea.gmane.org' \
--to=davidsmith@acm.org \
--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).