From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niels Giesen Subject: [PATCH] Continue numbering from any previous numbered snippet with +n, even when previous numbered snippet does not immediately precede it. Date: Fri, 16 Sep 2011 17:32:38 +0200 Message-ID: <1316187158-7579-1-git-send-email-niels.giesen@gmail.com> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:33586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4aPv-0004Sb-Ja for emacs-orgmode@gnu.org; Fri, 16 Sep 2011 11:33:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4aPu-0004hW-Jl for emacs-orgmode@gnu.org; Fri, 16 Sep 2011 11:33:27 -0400 Received: from mail-ew0-f49.google.com ([209.85.215.49]:58173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4aPu-0004hS-FT for emacs-orgmode@gnu.org; Fri, 16 Sep 2011 11:33:26 -0400 Received: by ewy3 with SMTP id 3so2957991ewy.36 for ; Fri, 16 Sep 2011 08:33:25 -0700 (PDT) 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: emacs-orgmode@gnu.org * org-mode/lisp/org-exp.el (org-export-number-lines): Check whether number parameter (this is a numbered block!) is non-nil as well as whether cont is nil (this numbered block should *not* continue numbering where we left off before!) before resetting the count to zero. From the docs: If you use a `+n' switch, the numbering from the previous numbered snippet will be continued in the current one. With this change I believe the code complies with the docs. --- lisp/org-exp.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 9884a31..12590e1 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2731,7 +2731,7 @@ INDENT was the original indentation of the block." (defun org-export-number-lines (text &optional skip1 skip2 number cont replace-labels label-format) (setq skip1 (or skip1 0) skip2 (or skip2 0)) - (if (not cont) (setq org-export-last-code-line-counter-value 0)) + (if (and number (not cont)) (setq org-export-last-code-line-counter-value 0)) (with-temp-buffer (insert text) (goto-char (point-max)) -- 1.7.4.1