mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 22:07:49 +00:00
org.texi: Updated doc for [+-]n in SRC/EXAMPLE export
* doc/org.texi (Timers): Added information about optional argument to
-n/+n line-numbering
* etc/ORG-NEWS: Added infomation for "Provide offset to [+-]n in
SRC/EXAMPLE export" (commit af8e3d8
)
This commit is contained in:
parent
3d0ade9571
commit
3179d30683
30
doc/org.texi
30
doc/org.texi
|
@ -10045,13 +10045,29 @@ shortcuts to easily insert code blocks.
|
||||||
|
|
||||||
Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
|
Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
|
||||||
switch to the end of the @code{BEGIN} line, to get the lines of the example
|
switch to the end of the @code{BEGIN} line, to get the lines of the example
|
||||||
numbered. If you use a @code{+n} switch, the numbering from the previous
|
numbered. The @code{-n} takes an optional numeric argument specifying the
|
||||||
numbered snippet will be continued in the current one. In literal examples,
|
starting line number of the block. If you use a @code{+n} switch, the
|
||||||
Org will interpret strings like @samp{(ref:name)} as labels, and use them as
|
numbering from the previous numbered snippet will be continued in the current
|
||||||
targets for special hyperlinks like @code{[[(name)]]} (i.e., the reference name
|
one. The @code{+n} can also take a numeric argument. The value of the
|
||||||
enclosed in single parenthesis). In HTML, hovering the mouse over such a
|
argument will be added to the last line of the previous block to determine
|
||||||
link will remote-highlight the corresponding code line, which is kind of
|
the starting line number.
|
||||||
cool.
|
|
||||||
|
@example
|
||||||
|
#+BEGIN_SRC emacs-lisp -n 20
|
||||||
|
;; this will export with line number 20
|
||||||
|
(message "This is line 21")
|
||||||
|
#+END_SRC
|
||||||
|
#+BEGIN_SRC emacs-lisp +n 10
|
||||||
|
;; This will be listed as line 31
|
||||||
|
(message "This is line 32")
|
||||||
|
#+END_SRC
|
||||||
|
@end example
|
||||||
|
|
||||||
|
In literal examples, Org will interpret strings like @samp{(ref:name)} as
|
||||||
|
labels, and use them as targets for special hyperlinks like @code{[[(name)]]}
|
||||||
|
(i.e., the reference name enclosed in single parenthesis). In HTML, hovering
|
||||||
|
the mouse over such a link will remote-highlight the corresponding code line,
|
||||||
|
which is kind of cool.
|
||||||
|
|
||||||
You can also add a @code{-r} switch which @i{removes} the labels from the
|
You can also add a @code{-r} switch which @i{removes} the labels from the
|
||||||
source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the
|
source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the
|
||||||
|
|
16
etc/ORG-NEWS
16
etc/ORG-NEWS
|
@ -159,6 +159,22 @@ If the block has a =#+NAME:= attribute assigned, then the HTML element
|
||||||
will have an ~id~ attribute with that name in the HTML export. This
|
will have an ~id~ attribute with that name in the HTML export. This
|
||||||
enables one to create links to these elements in other places, e.g.,
|
enables one to create links to these elements in other places, e.g.,
|
||||||
~<a href="#name">text</a>~.
|
~<a href="#name">text</a>~.
|
||||||
|
**** Line Numbering in SRC/EXAMPLE blocks support arbitrary start number
|
||||||
|
The ~-n~ option to ~SRC~ and ~EXAMPLE~ blocks can now take a numeric
|
||||||
|
argument to specify the staring line number for the source or example
|
||||||
|
block. The ~+n~ option can now take a numeric argument that will be
|
||||||
|
added to the last line number from the previous block as the starting
|
||||||
|
point for the SRC/EXAMPLE block.
|
||||||
|
#+BEGIN_SRC org
|
||||||
|
,#+BEGIN_SRC emacs-lisp -n 20
|
||||||
|
;; this will export with line number 20
|
||||||
|
(message "This is line 21")
|
||||||
|
,#+END_SRC
|
||||||
|
,#+BEGIN_SRC emacs-lisp +n 10
|
||||||
|
;; This will be listed as line 31
|
||||||
|
(message "This is line 32")
|
||||||
|
,#+END_SRC
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
*** Babel
|
*** Babel
|
||||||
**** Support for SLY in Lisp blocks
|
**** Support for SLY in Lisp blocks
|
||||||
|
|
Loading…
Reference in a new issue