[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
replace-regexp-in-string, using the dyn scoped variable STR
From: |
Lennart Borgman |
Subject: |
replace-regexp-in-string, using the dyn scoped variable STR |
Date: |
Wed, 11 Nov 2009 20:18:11 +0100 |
Sometimes it is necessary to use the variable str which is dynamically
scoped in replace-regexp-in-string. Below is an example of this.
Could we please document the use of str (and perhaps name it quite differently)?
Example:
;;(test-org-freemind-unescape-str-to-org "mA≌B<C<=")
;;(test-org-freemind-unescape-str-to-org "<<")
(defun test-org-freemind-unescape-str-to-org (fm-str)
(let ((org-str fm-str))
(setq org-str (replace-regexp-in-string
"&#x\\([a-f0-9]\\{2,4\\}\\);"
(lambda (m)
(char-to-string
;; Note: str is scoped dynamically from
;; `replace-regexp-in-string'.
(+ (string-to-number (match-string 1 str) 16)
0
)))
org-str))))
- replace-regexp-in-string, using the dyn scoped variable STR,
Lennart Borgman <=