From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: line numbers in org src blocks? Date: Tue, 13 Oct 2015 09:10:10 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlzLO-0005pj-LI for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 09:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlzLI-0007bp-Up for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 09:10:18 -0400 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:36799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlzLI-0007bl-QS for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 09:10:12 -0400 Received: by qgx61 with SMTP id 61so13245918qgx.3 for ; Tue, 13 Oct 2015 06:10:12 -0700 (PDT) In-reply-to: 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: Nick Dokos Cc: emacs-orgmode@gnu.org I meant in the org-file buffer. The numbers in export are pretty straightforward. I made a partial solution here: http://kitchingroup.cheme.cmu.edu/blog/2015/10/13/Line-numbers-in-org-mode-code-blocks/ It works pretty well I think. Nick Dokos writes: > John Kitchin andrew.cmu.edu> writes: > >> >> Does anyone know if it is possible to get line numbering only in code >> blocks in an org-file? >> > > When exporting? Or in the buffer? If the latter, I don't know. If the > former, -n does that but it is position-sensitive I think: > > --8<---------------cut here---------------start------------->8--- > > * A code block for exporting with line number > > #+BEGIN_SRC python -n :exports code > import sys > > sys.exit(0) > > #+END_SRC > > #+BEGIN_EXAMPLE -n > import sys > > sys.exit(0) > #+END_EXAMPLE > --8<---------------cut here---------------end--------------->8--- > > works, but putting it at the end of the BEGIN_SRC line does not. > > See > > (info "(org) Literal examples") > > for more. -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu