From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Org release 8.2.5g (minor release from maint) Date: Sat, 01 Mar 2014 09:06:29 +0100 Message-ID: <87txbi8hru.fsf@bzg.ath.cx> References: <87k3dtsat8.fsf@bzg.ath.cx> <87wqhtywkx.fsf@Rainer.invalid> <87fvocbigv.fsf@Rainer.invalid> <87ios0vdnr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJewU-0007mz-JC for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 03:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJewO-0001Ub-JX for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 03:06:42 -0500 Received: from rs249.mailgun.us ([209.61.151.249]:50534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJewO-0001UW-B3 for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 03:06:36 -0500 In-Reply-To: <87ios0vdnr.fsf@gmail.com> (Eric Schulte's message of "Wed, 26 Feb 2014 16:23:13 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Achim Gratz , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Eric, Eric Schulte writes: > Oh, I did not realize `subseq' was part of the cl library. Since it > seems subseq is a generally useful utility, would there be any appetite > for implementing an org-subseq function? There was already org-sublist, which I adapted to mimic the behavior of subseq. Can you try the attached patch and see if it works as advertized? Thanks, --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-subseq.patch Changes in stash@{0}^2^..stash@{0} 3 files changed, 10 insertions(+), 9 deletions(-) lisp/ob-lob.el | 4 ++-- lisp/org-table.el | 4 ++-- lisp/org.el | 11 ++++++----- Modified lisp/ob-lob.el diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index c93198a..210dbb4 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -148,12 +148,12 @@ if so then run the appropriate source block from the Library." ;; hash evaluation, since for a call line :var ;; extension *is* execution. (let ((params (nth 2 pre-info))) - (append (subseq pre-info 0 2) + (append (org-subseq pre-info 0 2) (list (cons (cons :c-var (cdr (assoc :var params))) (assq-delete-all :var (copy-tree params)))) - (subseq pre-info 3)))))) + (org-subseq pre-info 3)))))) (old-hash (when cache-p (org-babel-current-result-hash pre-info))) (org-babel-current-src-block-location (point-marker))) (if (and cache-p (equal new-hash old-hash)) Modified lisp/org-table.el diff --git a/lisp/org-table.el b/lisp/org-table.el index 520ac8a..38a9171 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2698,8 +2698,8 @@ not overwrite the stored one." (replace-match (save-match-data (org-table-make-reference - (org-sublist - fields (string-to-number (match-string 1 form)) + (org-subseq + fields (1- (string-to-number (match-string 1 form))) (string-to-number (match-string 2 form))) keep-empty numbers lispp)) t t form))) Modified lisp/org.el diff --git a/lisp/org.el b/lisp/org.el index 41fb22c..32f27b1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -22059,12 +22059,13 @@ so values can contain further %-escapes if they are define later in TABLE." (setq string (replace-match sref t t string))))) string)) -(defun org-sublist (list start end) +;; This reimplements subseq from cl-subseq +(defun org-subseq (list start &optional end) "Return a section of LIST, from START to END. -Counting starts at 1." - (let (rtn (c start)) - (setq list (nthcdr (1- start) list)) - (while (and list (<= c end)) +END is optional and counting starts at 0." + (let ((c start) (end (or end (length list))) rtn) + (setq list (nthcdr start list)) + (while (and list (< c end)) (push (pop list) rtn) (setq c (1+ c))) (nreverse rtn))) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--