emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Niels Giesen <niels.giesen@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <1316187158-7579-1-git-send-email-niels.giesen@gmail.com> (raw)

* 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

                 reply	other threads:[~2011-09-16 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1316187158-7579-1-git-send-email-niels.giesen@gmail.com \
    --to=niels.giesen@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).