From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: line numbers in a code block? Date: Sat, 27 Sep 2014 16:40:43 -0400 Message-ID: <87zjdk94qc.fsf@andrew.cmu.edu> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXynM-0007Mt-9u for emacs-orgmode@gnu.org; Sat, 27 Sep 2014 16:40:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXynG-0004YH-KR for emacs-orgmode@gnu.org; Sat, 27 Sep 2014 16:40:44 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:33469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXynG-0004XB-D0 for emacs-orgmode@gnu.org; Sat, 27 Sep 2014 16:40:38 -0400 Received: by mail-qg0-f42.google.com with SMTP id z60so9137466qgd.15 for ; Sat, 27 Sep 2014 13:40:32 -0700 (PDT) Received: from HOME-OFFICE (c-24-3-17-30.hsd1.pa.comcast.net. [24.3.17.30]) by mx.google.com with ESMTPSA id 21sm7563877qgh.42.2014.09.27.13.40.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Sep 2014 13:40:31 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Sat, 27 Sep 2014 09:21:27 -0400") 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 I came up with a reasonable solution to this that I think is pretty nice. It doesn't put linenumbers on the src block, but it does something even better! The gist is to write the block to a temporary file, then run pyflakes, pep8 and pylint on it. The output of those goes into a temporary org-buffer, with links back to the positions in the code block where the errors are! The code is laid out here: http://kitchingroup.cheme.cmu.edu/blog/2014/09/27/Improved-debugging-of-Python-code-blocks-in-org-mode/ I am going to try it out with my students next week! j John Kitchin writes: > Does anyone know a way to get dedicate line numbers in an org code > block? > > I know how to get buffer code lines, but when we run a code block and > there is an error, the error line number is relative to line 1 of the > code block. Currently, we type C-c ' to get a code buffer, and navigate > to the line. I would like to see code block numbers on the right hand > side of the buffer, and only inside the code block. Any ideas? > > Thanks, -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu