mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-02-05 21:26:18 +00:00
ob-ref: fixed error caused by missing count function, now using org-count
* lisp/ob-ref.el (org-babel-ref-resolve-reference): removed an error introduced while fixing compiler warnings -- required mirroring of the count cl-seqs function under the org-mode namespace. * lisp/org.el (org-count): adding an org-mode version of the cl-seqs count function
This commit is contained in:
parent
fb72ef7809
commit
2f178148f9
@ -41,7 +41,7 @@
|
||||
;; same file would be
|
||||
|
||||
;; #+TBLNAME: sandbox
|
||||
;; | 1 | 2 | 3 |
|
||||
;; | 1 | 2 | 3 |
|
||||
;; | 4 | org-babel | 6 |
|
||||
;;
|
||||
;; #+begin_src emacs-lisp :var table=sandbox
|
||||
@ -55,6 +55,7 @@
|
||||
|
||||
(declare-function org-remove-if-not "org" (predicate seq))
|
||||
(declare-function org-at-table-p "org" (&optional table-type))
|
||||
(declare-function org-count "org" (CL-ITEM CL-SEQ))
|
||||
|
||||
(defun org-babel-ref-variables (params)
|
||||
"Convert PARAMS to variable names and values.
|
||||
@ -108,13 +109,10 @@ return nil."
|
||||
(let ((case-fold-search t)
|
||||
type args new-refere new-referent result lob-info split-file split-ref
|
||||
index index-row index-col)
|
||||
;; if ref is indexed grab the indices -- beware nested indicies
|
||||
;; if ref is indexed grab the indices -- beware nested indices
|
||||
(when (and (string-match "\\[\\(.+\\)\\]" ref)
|
||||
(let ((str (substring ref 0 (match-beginning 0))))
|
||||
(= (length (org-remove-if-not
|
||||
(lambda (el) (equal ?( el)) (string-to-list "((eric))")))
|
||||
(length (org-remove-if-not
|
||||
(lambda (el) (equal ?) el)) (string-to-list "((eric))"))))))
|
||||
(= (org-count ?( str) (org-count ?) str))))
|
||||
(setq index (match-string 1 ref))
|
||||
(setq ref (substring ref 0 (match-beginning 0))))
|
||||
;; assign any arguments to pass to source block
|
||||
|
11
lisp/org.el
11
lisp/org.el
@ -18223,6 +18223,17 @@ for the search purpose."
|
||||
(setq list (delete (pop elts) list)))
|
||||
list)
|
||||
|
||||
(defun org-count (cl-item cl-seq)
|
||||
"Count the number of occurrences of ITEM in SEQ.
|
||||
Taken from `count' in cl-seq.el with all keyword arguments removed."
|
||||
(let ((cl-end (length cl-seq)) (cl-start 0) (cl-count 0) cl-x)
|
||||
(when (consp cl-seq) (setq cl-seq (nthcdr cl-start cl-seq)))
|
||||
(while (< cl-start cl-end)
|
||||
(setq cl-x (if (consp cl-seq) (pop cl-seq) (aref cl-seq cl-start)))
|
||||
(if (equal cl-item cl-x) (setq cl-count (1+ cl-count)))
|
||||
(setq cl-start (1+ cl-start)))
|
||||
cl-count))
|
||||
|
||||
(defun org-remove-if (predicate seq)
|
||||
"Remove everything from SEQ that fulfills PREDICATE."
|
||||
(let (res e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user