diff options
authorGrégoire Jadi <>2013-01-26 21:27:51 (GMT)
committer Bastien Guerry <>2013-02-13 15:29:09 (GMT)
commit67febc36001d55fac0f1ac3ece5dd606c2c7666f (patch)
parent9964d89d1b36be2bc7cc3377f986fb69d981d307 (diff)
Unify `org-id-reverse-string' and `org-babel-reverse-string' into `org-reverse-string'
* lisp/org.el (org-reverse-string): Add `org-reverse-string' to reverse a string. * lisp/org-id.el(org-id-new, org-id-decode): Replace `org-id-reverse-string' by `org-reverse-string'. * lisp/ob-core.el(org-babel-trim): Replace `org-babel-reverse-string' by `org-reverse-string' and declare it. TINYCHANGE
3 files changed, 9 insertions, 11 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index eeda16d..717746e 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -93,6 +93,7 @@
(declare-function org-escape-code-in-region "org-src" (beg end))
(declare-function org-unescape-code-in-string "org-src" (s))
(declare-function org-table-to-lisp "org-table" (&optional txt))
+(declare-function org-reverse-string "org" (string))
(defgroup org-babel nil
"Code block evaluation and management in `org-mode' documents."
@@ -2502,10 +2503,6 @@ If the table is trivial, then return it as a scalar."
(match-string 1 cell))
cell) t))
-(defun org-babel-reverse-string (string)
- "Return the reverse of STRING."
- (apply 'string (reverse (string-to-list string))))
(defun org-babel-chomp (string &optional regexp)
"Strip trailing spaces and carriage returns from STRING.
Default regexp used is \"[ \f\t\n\r\v]\" but can be
@@ -2520,8 +2517,8 @@ overwritten by specifying a regexp as a second argument."
"Strip leading and trailing spaces and carriage returns from STRING.
Like `org-babel-chomp' only it runs on both the front and back
of the string."
- (org-babel-chomp (org-babel-reverse-string
- (org-babel-chomp (org-babel-reverse-string string) regexp))
+ (org-babel-chomp (org-reverse-string
+ (org-babel-chomp (org-reverse-string string) regexp))
(defvar org-babel-org-babel-call-process-region-original nil)
diff --git a/lisp/org-id.el b/lisp/org-id.el
index c046c59..32c05e6 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -343,7 +343,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
(unless (org-uuidgen-p unique)
(setq unique (org-id-uuid))))
((eq org-id-method 'org)
- (let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
+ (let* ((etime (org-reverse-string (org-id-time-to-b36)))
(postfix (if org-id-include-domain
(require 'message)
@@ -376,9 +376,6 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
(substring rnd 18 20)
(substring rnd 20 32))))
-(defun org-id-reverse-string (s)
- (mapconcat 'char-to-string (nreverse (string-to-list s)) ""))
(defun org-id-int-to-b36-one-digit (i)
"Turn an integer between 0 and 61 into a single character 0..9, A..Z, a..z."
@@ -432,7 +429,7 @@ and time is the usual three-integer representation of time."
(if (= 2 (length parts))
(setq prefix (car parts) time (nth 1 parts))
(setq prefix nil time (nth 0 parts)))
- (setq time (org-id-reverse-string time))
+ (setq time (org-reverse-string time))
(setq time (list (org-id-b36-to-int (substring time 0 4))
(org-id-b36-to-int (substring time 4 8))
(org-id-b36-to-int (substring time 8 12))))
diff --git a/lisp/org.el b/lisp/org.el
index 4176f78..153311c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21126,6 +21126,10 @@ for the search purpose."
(error "Unable to create a link to here"))))
(org-occur-in-agenda-files (regexp-quote link))))
+(defun org-reverse-string (string)
+ "Return the reverse of STRING."
+ (apply 'string (reverse (string-to-list string))))
(defun org-uniquify (list)
"Remove duplicate elements from LIST."
(let (res)