unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* replace-regexp-in-string, using the dyn scoped variable STR
@ 2009-11-11 19:18 Lennart Borgman
  2009-11-11 20:25 ` Stefan Monnier
  2009-11-12  9:59 ` Juri Linkov
  0 siblings, 2 replies; 9+ messages in thread
From: Lennart Borgman @ 2009-11-11 19:18 UTC (permalink / raw)
  To: Emacs-Devel devel

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-11-12 22:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 19:18 replace-regexp-in-string, using the dyn scoped variable STR Lennart Borgman
2009-11-11 20:25 ` Stefan Monnier
2009-11-11 20:40   ` Lennart Borgman
2009-11-12  9:59 ` Juri Linkov
2009-11-12 10:17   ` Lennart Borgman
2009-11-12 15:26   ` Stefan Monnier
2009-11-12 15:58     ` Andreas Schwab
2009-11-12 17:05       ` Stefan Monnier
2009-11-12 22:07         ` Lennart Borgman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).