[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH 4/7] New function: Substitute posix classes in regular expres
From: |
David Maus |
Subject: |
[O] [PATCH 4/7] New function: Substitute posix classes in regular expression |
Date: |
Tue, 2 Aug 2011 11:23:37 +0200 |
* org-macs.el (org-substitute-posix-classes): New function. Substitute
posix classes in regular expression.
(org-re): Rewritten to use new function.
---
lisp/org-macs.el | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index ab21ef7..198d210 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -93,21 +93,23 @@ Also, do not record undo information."
before-change-functions after-change-functions)
,@body))))
+(defun org-substitute-posix-classes (re)
+ "Substitute posix classes in regular expression RE."
+ (let ((ss re))
+ (save-match-data
+ (while (string-match "\\[:alnum:\\]" ss)
+ (setq ss (replace-match "a-zA-Z0-9" t t ss)))
+ (while (string-match "\\[:word:\\]" ss)
+ (setq ss (replace-match "a-zA-Z0-9" t t ss)))
+ (while (string-match "\\[:alpha:\\]" ss)
+ (setq ss (replace-match "a-zA-Z" t t ss)))
+ (while (string-match "\\[:punct:\\]" ss)
+ (setq ss (replace-match "address@hidden" t t ss)))
+ ss)))
+
(defmacro org-re (s)
"Replace posix classes in regular expression."
- (if (featurep 'xemacs)
- (let ((ss s))
- (save-match-data
- (while (string-match "\\[:alnum:\\]" ss)
- (setq ss (replace-match "a-zA-Z0-9" t t ss)))
- (while (string-match "\\[:word:\\]" ss)
- (setq ss (replace-match "a-zA-Z0-9" t t ss)))
- (while (string-match "\\[:alpha:\\]" ss)
- (setq ss (replace-match "a-zA-Z" t t ss)))
- (while (string-match "\\[:punct:\\]" ss)
- (setq ss (replace-match "address@hidden" t t ss)))
- ss))
- s))
+ (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
(defmacro org-preserve-lc (&rest body)
(org-with-uninterned (line col)
--
1.7.2.5
- Re: [O] [PATCH 1/7] New macro: Execute BODY in enviroment with uninterned SYMBOLS, (continued)
[O] [PATCH 2/7] New macro: Evaluate FORM in ENVIRONMENT, David Maus, 2011/08/02
[O] [PATCH 3/7] Use new macro org-with-uninterned, David Maus, 2011/08/02
[O] [PATCH 4/7] New function: Substitute posix classes in regular expression,
David Maus <=
[O] [PATCH 5/7] Use macro org-with-uninterned, David Maus, 2011/08/02
[O] [PATCH 6/7] Use org-eval-in-environment, make macros functions, David Maus, 2011/08/02
[O] [PATCH 7/7] Make org-batch-store-agenda-views a fun, use org-eval-in-environment, David Maus, 2011/08/02
Re: [O] [PATCH 0/8] Org mode macros, refactored, David Maus, 2011/08/02
Re: [O] [PATCH 0/8] Org mode macros, refactored, Štěpán Němec, 2011/08/02