emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Achim Gratz <Stromeko@nexgo.de>, emacs-orgmode@gnu.org
Subject: Re: Org release 8.2.5g (minor release from maint)
Date: Sat, 01 Mar 2014 09:06:29 +0100	[thread overview]
Message-ID: <87txbi8hru.fsf@bzg.ath.cx> (raw)
In-Reply-To: <87ios0vdnr.fsf@gmail.com> (Eric Schulte's message of "Wed, 26	Feb 2014 16:23:13 -0700")

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

Hi Eric,

Eric Schulte <schulte.eric@gmail.com> 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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-subseq.patch --]
[-- Type: text/x-diff, Size: 2361 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2014-03-01  8:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 13:50 Org release 8.2.5g (minor release from maint) Bastien
2014-01-21 19:16 ` Achim Gratz
2014-01-21 19:25   ` Bastien
2014-01-21 19:30     ` Bastien
2014-01-21 19:35     ` Achim Gratz
2014-01-21 23:39   ` Bastien
2014-01-22  7:52     ` Achim Gratz
2014-01-25  7:58   ` Achim Gratz
2014-02-26 19:25     ` Achim Gratz
2014-02-26 23:23     ` Eric Schulte
2014-03-01  8:06       ` Bastien [this message]
2014-03-01  9:10       ` Achim Gratz
2014-03-01 12:53         ` Nick Dokos
2014-03-03  3:03           ` Eric Schulte
2014-03-05  1:56             ` Eric Abrahamsen
2014-03-05  3:20               ` Nick Dokos
2014-03-06 17:00                 ` Eric Schulte
2014-03-07  7:26                   ` Bastien
2014-03-07 16:05                     ` Richard Lawrence
2014-03-07 21:09                       ` Eric Schulte
2014-03-08  4:05                         ` Richard Lawrence
2014-03-13 14:55                       ` Bastien
2014-03-13 16:28                         ` Richard Lawrence
2014-03-21  8:08                           ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txbi8hru.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=Stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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