* [FEATURE] On line-numbers inside Org Babel Source Blocks.
@ 2024-08-07 13:59 divya
2024-08-09 21:30 ` Divya
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: divya @ 2024-08-07 13:59 UTC (permalink / raw)
To: emacs-orgmode
Hello, Org Mode!
I've been using Org Mode for literate programming purposes, and would like to have line-numbers within `src` blocks. I am able to export the Org buffer and get the line-numbers, but I am unable to do the same with regards to just in Org buffers. I am aware of `org-edit-special`, but I would rather appreciate if I can just look at a piece of code and know how long it is. I believe a header argument can be useful in toggling this.
Since the source blocks can already implement syntax highlighting, font and other means of interacting with displaying Babel source blocks, theoretically this shouldn't be that difficult to implement? I'd be glad to help implementing this feature, if I can be slightly guided on where to refer to look for in the codebase.
Regards,
Divya Ranjan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FEATURE] On line-numbers inside Org Babel Source Blocks.
2024-08-07 13:59 [FEATURE] On line-numbers inside Org Babel Source Blocks divya
@ 2024-08-09 21:30 ` Divya
2024-08-10 15:15 ` Ihor Radchenko
2024-08-11 9:50 ` Phil Estival
2 siblings, 0 replies; 4+ messages in thread
From: Divya @ 2024-08-09 21:30 UTC (permalink / raw)
To: emacs-orgmode; +Cc: yantar92
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
On 7 August 2024 13:59:16 GMT, divya@subvertising.org wrote:
>Hello, Org Mode!
>
>I've been using Org Mode for literate programming purposes, and would like to have line-numbers within `src` blocks. I am able to export the Org buffer and get the line-numbers, but I am unable to do the same with regards to just in Org buffers. I am aware of `org-edit-special`, but I would rather appreciate if I can just look at a piece of code and know how long it is. I believe a header argument can be useful in toggling this.
>
>Since the source blocks can already implement syntax highlighting, font and other means of interacting with displaying Babel source blocks, theoretically this shouldn't be that difficult to implement? I'd be glad to help implementing this feature, if I can be slightly guided on where to refer to look for in the codebase.
>
>Regards,
>
>Divya Ranjan
>
Any suggestions, Ihor?
[-- Attachment #2: Type: text/html, Size: 1234 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FEATURE] On line-numbers inside Org Babel Source Blocks.
2024-08-07 13:59 [FEATURE] On line-numbers inside Org Babel Source Blocks divya
2024-08-09 21:30 ` Divya
@ 2024-08-10 15:15 ` Ihor Radchenko
2024-08-11 9:50 ` Phil Estival
2 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-08-10 15:15 UTC (permalink / raw)
To: divya; +Cc: emacs-orgmode
divya@subvertising.org writes:
> I've been using Org Mode for literate programming purposes, and would
> like to have line-numbers within `src` blocks. I am able to export the
> Org buffer and get the line-numbers, but I am unable to do the same
> with regards to just in Org buffers. I am aware of `org-edit-special`,
> but I would rather appreciate if I can just look at a piece of code
> and know how long it is. I believe a header argument can be useful in
> toggling this.
I agree that it would be nice to have line numbering in code blocks.
> Since the source blocks can already implement syntax highlighting,
> font and other means of interacting with displaying Babel source
> blocks, theoretically this shouldn't be that difficult to implement?
> I'd be glad to help implementing this feature, if I can be slightly
> guided on where to refer to look for in the codebase.
AFAIK, it is not very easy. Syntax highlighting is just a matter of
applying the right text properties, but not line numbers.
Native line numbering in Emacs is implemented on low level, and is not
very exposed to Elisp. There is a limited set of options available for
customization - all in `display-line-numbers' variable. See "16.24
Customization of Display" section in Emacs manual.
I do not know anything built-in that can help in our situation, with
line numbers to be applied selectively.
We may try the approach taken by the old linum-mode, except that linum
is infamous for its poor performance. So, it might be better to hack on
https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/nlinum.el?h=externals/nlinum
as suggested in lisp/obsolete/linum.el commentary.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FEATURE] On line-numbers inside Org Babel Source Blocks.
2024-08-07 13:59 [FEATURE] On line-numbers inside Org Babel Source Blocks divya
2024-08-09 21:30 ` Divya
2024-08-10 15:15 ` Ihor Radchenko
@ 2024-08-11 9:50 ` Phil Estival
2 siblings, 0 replies; 4+ messages in thread
From: Phil Estival @ 2024-08-11 9:50 UTC (permalink / raw)
To: divya, emacs-orgmode
> I've been using Org Mode for literate programming purposes, and
> would like to have line-numbers within `src` blocks. [...]
> I'd be glad to help implementing this feature, if I can be slightly
> guided on where to refer to look for in the codebase.
https://kitchingroup.cheme.cmu.edu/blog/2015/10/13/Line-numbers-in-org-mode-code-blocks/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-11 9:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 13:59 [FEATURE] On line-numbers inside Org Babel Source Blocks divya
2024-08-09 21:30 ` Divya
2024-08-10 15:15 ` Ihor Radchenko
2024-08-11 9:50 ` Phil Estival
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.