Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:37:00+00:00 2026-06-11T04:37:00+00:00

Org-mode has a great feature to include source code like this: #+begin_src java -n

  • 0

Org-mode has a great feature to include source code like this:

#+begin_src java -n
    /**
     * @param foo
     */
    public static void doBar(Baz ba)
    {
        Collection<String> strings = ba.getStrings(true);
        return strings;
    }
#+end_src

The -n option shows line numbers.

There’s a +n option to have the numbering continue from the last block.

Is there any option to set the starting number? This would be useful for source code snippets where you want the line numbers to correspond to the full file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:37:01+00:00Added an answer on June 11, 2026 at 4:37 am

    This answer is out of date, see the other ones

    No implemented options that I know of.

    A very hacky solution I just tested would be to define yourself the counter org uses for +n to work.
    It goes :

    #+begin_src emacs-lisp :exports results
    ;; we need it not be a buffer-local value
    (setq-default org-export-last-code-line-counter-value 42)
    #+end_src
    

    As the result of being a dirty hack, it only works once, though, for the very first block, but I’m not sure how ±n behaves .
    It is evaluated (because of :exports results, without actually exporting anything when I tried) before numbering any other blocks, so it can be anywhere in your buffer.

    I guess it wouldn’t be very hard to implement, or that it could be done better by someone who actually knows elisp, but I hope it’ll help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I admit I'm a total emacs and org-mode newbie. It worked great for me,
I'd like to use mark-paragraph (also for movement with forward/backward-paragraph) in org-mode buffers in
I would like to read the org-mode manual in org mode... Is there a
The page 49 of org mode manual has the following comment. To limit tag
Here's the code: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> <html xmlns=http://www.w3.org/1999/xhtml >
BACKGROUND I using great htmlize.el to export my org-mode buffer contents with font hi-lock.
The org-mode manual mentions a number of properties that can control the behavior of
In Org-mode you can make comments and from Org-mode you can export to LaTeX
In org-mode, when you export HTML projects you can use templates to give all
I really love org-mode in emacs and want to customize a few things. While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.