mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:36:26 +00:00
babel: `org-babel-ref-index-list' now converts trivial lists to scalars
Thanks to Darlan Cavalcante Moreira for this suggestion.
This commit is contained in:
parent
e84998ada8
commit
927ff1125b
|
@ -169,7 +169,9 @@ which case the entire range is returned."
|
|||
(let ((length (length lis))
|
||||
(portion (match-string 1 index))
|
||||
(remainder (substring index (match-end 0))))
|
||||
(flet ((wrap (num) (if (< num 0) (+ length num) num)))
|
||||
(flet ((wrap (num) (if (< num 0) (+ length num) num))
|
||||
(open (lis) (if (and (listp lis) (= (length lis) 1)) (car lis) lis)))
|
||||
(open
|
||||
(mapcar
|
||||
(lambda (sub-lis) (org-babel-ref-index-list remainder sub-lis))
|
||||
(if (string-match "\\(\\([-[:digit:]]+\\):\\([-[:digit:]]+\\)\\|\*\\)"
|
||||
|
@ -181,7 +183,7 @@ which case the entire range is returned."
|
|||
(wrap (string-to-number (match-string 2 portion)))
|
||||
(wrap (string-to-number (match-string 3 portion))))
|
||||
(list (wrap 0) (wrap -1)))))
|
||||
(list (nth (wrap (string-to-number portion)) lis))))))
|
||||
(list (nth (wrap (string-to-number portion)) lis)))))))
|
||||
lis))
|
||||
|
||||
(defun org-babel-ref-split-args (arg-string)
|
||||
|
|
Loading…
Reference in a new issue