forked from mirrors/org-mode
Compare commits
227 Commits
Author | SHA1 | Date |
---|---|---|
|
959534ba11 | |
|
3232cc1619 | |
|
84945f9de0 | |
|
a0950e9432 | |
|
e24c2408e7 | |
|
3e4c89e556 | |
|
331086ebec | |
|
ea4a690c1a | |
|
9419dad48a | |
|
008e6030ac | |
|
6eab01c580 | |
|
ce350490ca | |
|
9447518c75 | |
|
4d4d59874c | |
|
bb3800f904 | |
|
2a6a0480d3 | |
|
dc2f270ac4 | |
|
9427bdedcc | |
|
0c06694666 | |
|
1cea4094fc | |
|
915e883645 | |
|
212237bdbd | |
|
6c862699a6 | |
|
96eb9f0b4a | |
|
453cb0883a | |
|
266bd1c4a0 | |
|
2f184485bf | |
|
5eb929a27c | |
|
e6c5f25c13 | |
|
55e8068d69 | |
|
bb633b6740 | |
|
51aea49462 | |
|
d08a5abb90 | |
|
04d56f757f | |
|
e804de88e4 | |
|
223cc31ec7 | |
|
589e1f38c1 | |
|
9d70929fd7 | |
|
b8497aa7fe | |
|
466c180a47 | |
|
ac1d58477a | |
|
654a68dc51 | |
|
a62f75c841 | |
|
0c8fba93fe | |
|
8c7577817c | |
|
de0df5b925 | |
|
9f6dbd8d2e | |
|
c426f49364 | |
|
4ee373cb75 | |
|
2ee94bb065 | |
|
77e77f051c | |
|
8e8e635eba | |
|
71077dedc8 | |
|
5f050580d8 | |
|
0477df8aab | |
|
671ca44df0 | |
|
9ad3360d76 | |
|
88dd2cea35 | |
|
5b8159228a | |
|
0ea4dc166c | |
|
0fd4f2e272 | |
|
a22c8b7e09 | |
|
f737e7213d | |
|
9189ccacd5 | |
|
b3aff71a65 | |
|
5fe70f2d66 | |
|
eec8ba4087 | |
|
dc485a6590 | |
|
64bb80b982 | |
|
53c39a494f | |
|
377addb5b2 | |
|
d12f8b8624 | |
|
014f85f55f | |
|
ab62bdd79f | |
|
e8fe9642b0 | |
|
5dc2b6ee75 | |
|
fb4d2b96dc | |
|
338ff105c5 | |
|
5a176d76ad | |
|
6c34fd374c | |
|
7564dfd968 | |
|
68f9abe0cd | |
|
1bff87bdb7 | |
|
5e9a60aaae | |
|
53d3fcfbe9 | |
|
d7ee5691cb | |
|
c49b8f68ca | |
|
b2b9a96192 | |
|
88ac4758a7 | |
|
0e345ecda8 | |
|
bb7473f3d3 | |
|
860d4fd169 | |
|
a7c8c9d8c2 | |
|
d5925e3e70 | |
|
cd8017e68f | |
|
525df5272d | |
|
4bd1c59d83 | |
|
d2eba8b77f | |
|
6eb4aa3e35 | |
|
f0c0dee11c | |
|
d0c29cfdf9 | |
|
d8e47abb75 | |
|
898b5c4da5 | |
|
464d668ead | |
|
0450cf0e85 | |
|
6f152d8914 | |
|
66cb45658d | |
|
09f339c9dd | |
|
a3c1a85021 | |
|
1c5492263f | |
|
0e5ac43324 | |
|
302bc6393a | |
|
895a367a67 | |
|
b2520ec52f | |
|
b26337c255 | |
|
5fcd1d9def | |
|
41c2e7af10 | |
|
8d43ab9ca9 | |
|
e6c7b0f15e | |
|
b34b5baffc | |
|
81f84ae679 | |
|
102f0a24c9 | |
|
6799350a85 | |
|
bae1b1fe70 | |
|
3f539bc3d6 | |
|
4049742044 | |
|
9a02750501 | |
|
8bea06ce93 | |
|
7ef578dd4e | |
|
0af8d7bf40 | |
|
bf71c8c597 | |
|
c0b66bf9c1 | |
|
5af0625113 | |
|
6d5fa81984 | |
|
14848726a0 | |
|
f3e306c737 | |
|
0ebb36caea | |
|
ee58259bc7 | |
|
288c7069c4 | |
|
ea8ed59c02 | |
|
b4d17c0629 | |
|
f326cd58ba | |
|
aa71facf6d | |
|
62356cb44b | |
|
fffb87174e | |
|
1a7d7a5a5b | |
|
bc51dfcb74 | |
|
db5478108c | |
|
e36a4fe20e | |
|
4131926984 | |
|
4deb06ea0a | |
|
f64c8a5a5b | |
|
071c6e986c | |
|
3bf33c0d7b | |
|
e380684c1a | |
|
31748e67f0 | |
|
c6849a2bc8 | |
|
96b3129265 | |
|
bd5665e017 | |
|
24c4a40f79 | |
|
773bba92a8 | |
|
51aff8a11b | |
|
48169da265 | |
|
c8bd2092b1 | |
|
56992b221e | |
|
24feef95e4 | |
|
288e0a11c2 | |
|
43ba00b2b1 | |
|
e09ad15a71 | |
|
0227e12605 | |
|
105dedd0d9 | |
|
edb5eaaac3 | |
|
1523e21d82 | |
|
0d24857ccf | |
|
dbea900d60 | |
|
09520a056c | |
|
2028bb15cd | |
|
5da0eb6ea7 | |
|
3d0deadf41 | |
|
1cafe3e8e4 | |
|
7cdf835c71 | |
|
fede1c9909 | |
|
55795376b6 | |
|
d8ac958836 | |
|
ac7c5c5d88 | |
|
dd12e9c763 | |
|
a2e5685e49 | |
|
646f6ec133 | |
|
c6bbde4c78 | |
|
3c01767f7e | |
|
0f0019e326 | |
|
badb09d679 | |
|
735334445f | |
|
3e11b2eb88 | |
|
89c68683f9 | |
|
a2514c97de | |
|
36a9f6f185 | |
|
e0f24a3f6d | |
|
065af4b42a | |
|
ba747598c6 | |
|
64049aaddc | |
|
fbf613ece9 | |
|
4e6fa96e26 | |
|
5a98b4c563 | |
|
f124b616d9 | |
|
e4ab416fcc | |
|
510e8f9cc8 | |
|
68d592bae4 | |
|
0e743d0bfc | |
|
252cc0be07 | |
|
9e88e1c822 | |
|
d6353b283a | |
|
80b474db00 | |
|
c6c5474b7e | |
|
ff9d00c9c3 | |
|
46e13c3ebd | |
|
1ad03e77b1 | |
|
52bde22b9d | |
|
a9275d5fd1 | |
|
dba92f72d3 | |
|
0db82ee8f8 | |
|
5b0b7f2924 | |
|
36d0928043 | |
|
769018718c | |
|
942a7320d0 | |
|
d73688faa4 | |
|
037700c411 |
|
@ -120,6 +120,16 @@ visited, i.e., where no Org built-in function have been loaded.
|
|||
Otherwise autoload Org functions will mess up the installation.
|
||||
#+end_quote
|
||||
|
||||
To avoid interference with built-in Org mode, you can use command line:
|
||||
|
||||
#+begin_src sh
|
||||
emacs -Q -batch -eval "(progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))"
|
||||
#+end_src
|
||||
|
||||
This approach has the advantage of isolating the upgrade process from
|
||||
a running Emacs session, ensuring that version conflicts can not
|
||||
arise.
|
||||
|
||||
*** Using Org's git repository
|
||||
:PROPERTIES:
|
||||
:UNNUMBERED: notoc
|
||||
|
@ -921,7 +931,9 @@ The following commands jump to other headlines in the buffer.
|
|||
Yank subtree from kill ring. This does modify the level of the
|
||||
subtree to make sure the tree fits in nicely at the yank position.
|
||||
The yank level can also be specified with a numeric prefix argument,
|
||||
or by yanking after a headline marker like =****=.
|
||||
or by yanking after a headline marker like =****=. With
|
||||
{{{kbd(C-u)}}} prefix, force inserting as a sibling. With
|
||||
{{{kbd(C-u C-u)}}} prefix argument, force inserting as a child.
|
||||
|
||||
- {{{kbd(C-y)}}} (~org-yank~) ::
|
||||
|
||||
|
@ -2344,6 +2356,17 @@ to read than the equivalent:
|
|||
|
||||
: '(substring $1 (string-to-number $2) (string-to-number $3))
|
||||
|
||||
When the formula itself contains =;= symbol, Org mode may incorrectly
|
||||
interpret everything past =;= as format specifier:
|
||||
|
||||
: '(concat $1 ";")
|
||||
|
||||
#+texinfo: @noindent
|
||||
You can put an extra tailing =;= to indicate that all the earlier
|
||||
instances of =;= belong to the formula itself:
|
||||
|
||||
: '(concat $1 ";");
|
||||
|
||||
*** Durations and time values
|
||||
:PROPERTIES:
|
||||
:DESCRIPTION: How to compute durations and time values.
|
||||
|
@ -3370,6 +3393,15 @@ Here is the full set of built-in link types:
|
|||
|
||||
Execute a shell command upon activation.
|
||||
|
||||
- =shortdoc= ::
|
||||
|
||||
Link to short documentation summary for an Emacs Lisp function group.
|
||||
[fn::You can run =M-x shortdoc-display-group= to list all known
|
||||
documentation groups.]
|
||||
|
||||
For more information, see [[info:emacs#Name Help][Name Help]]
|
||||
and [[info:elisp#Documentation Groups][Documentation Groups]].
|
||||
|
||||
|
||||
For =file:= and =id:= links, you can additionally specify a line
|
||||
number, or a text search string, separated by =::=. In Org files, you
|
||||
|
@ -3411,6 +3443,8 @@ options:
|
|||
| irc | =irc:/irc.com/#emacs/bob= |
|
||||
| help | =help:org-store-link= |
|
||||
| info | =info:org#External links= |
|
||||
| shortdoc | =shortdoc:text-properties= |
|
||||
| | =shortdoc:text-properties::#get-pos-property= |
|
||||
| shell | =shell:ls *.org= |
|
||||
| elisp | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate) |
|
||||
| | =elisp:org-agenda= (interactive Elisp command) |
|
||||
|
@ -3743,7 +3777,7 @@ replacement text. Here is an example:
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-link-abbrev-alist
|
||||
'(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
|
||||
'(("bugzilla" . "https://10.1.2.9/bugzilla/show_bug.cgi?id=")
|
||||
("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h")
|
||||
("duckduckgo" . "https://duckduckgo.com/?q=%s")
|
||||
("omap" . "https://nominatim.openstreetmap.org/search?q=%s&polygon=1")
|
||||
|
@ -6007,11 +6041,23 @@ This dynamic block has the following parameters:
|
|||
|
||||
When non-~nil~, indent each =ITEM= field according to its level.
|
||||
|
||||
- =:link= ::
|
||||
|
||||
When non-~nil~, link the =ITEM= headlines in the table to their
|
||||
origins.
|
||||
|
||||
- =:format= ::
|
||||
|
||||
Specify a column attribute (see [[*Column attributes]]) for the dynamic
|
||||
block.
|
||||
|
||||
- =:formatter= ::
|
||||
|
||||
#+cindex: @samp{formatter}, dynamic block parameter
|
||||
#+vindex: org-columns-dblock-formatter
|
||||
A function to format column view data and insert it into the buffer.
|
||||
See the option ~org-columns-dblock-formatter~.
|
||||
|
||||
The following commands insert or update the dynamic block:
|
||||
|
||||
- ~org-columns-insert-dblock~ ::
|
||||
|
@ -6142,7 +6188,7 @@ the agenda (see [[*Weekly/daily agenda]]). We distinguish:
|
|||
|
||||
#+begin_example
|
||||
,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
|
||||
<%%(diary-float t 4 2)>
|
||||
<%%(diary-float t 4 2) 22:00-23:00>
|
||||
#+end_example
|
||||
|
||||
- Time range ::
|
||||
|
@ -7010,16 +7056,16 @@ be selected:
|
|||
absolutely, or relative to the current time and may be any of these
|
||||
formats:
|
||||
|
||||
| =2007-12-31= | New year eve 2007 |
|
||||
| =2007-12= | December 2007 |
|
||||
| =2007-W50= | ISO-week 50 in 2007 |
|
||||
| =2007-Q2= | 2nd quarter in 2007 |
|
||||
| =2007= | the year 2007 |
|
||||
| =today=, =yesterday=, =today-N= | a relative day |
|
||||
| =thisweek=, =lastweek=, =thisweek-N= | a relative week |
|
||||
| =thismonth=, =lastmonth=, =thismonth-N= | a relative month |
|
||||
| =thisyear=, =lastyear=, =thisyear-N= | a relative year |
|
||||
| =untilnow=[fn:: When using ~:step~, ~untilnow~ starts from the beginning of 2003, not the beginning of time.] | all clocked time ever |
|
||||
| =2007-12-31= | New year eve 2007 |
|
||||
| =2007-12= | December 2007 |
|
||||
| =2007-W50= | ISO-week 50 in 2007 |
|
||||
| =2007-Q2= | 2nd quarter in 2007 |
|
||||
| =2007= | the year 2007 |
|
||||
| =today=, =yesterday=, =today-N= | a relative day |
|
||||
| =thisweek=, =lastweek=, =thisweek-N= | a relative week |
|
||||
| =thismonth=, =lastmonth=, =thismonth-N= | a relative month |
|
||||
| =thisyear=, =lastyear=, =thisyear-N= | a relative year |
|
||||
| =untilnow=[fn:28] | all clocked time ever |
|
||||
|
||||
#+vindex: org-clock-display-default-range
|
||||
When this option is not set, Org falls back to the value in
|
||||
|
@ -7225,7 +7271,7 @@ current clock, or applying it to another one.
|
|||
#+vindex: org-clock-x11idle-program-name
|
||||
By customizing the variable ~org-clock-idle-time~ to some integer,
|
||||
such as 10 or 15, Emacs can alert you when you get back to your
|
||||
computer after being idle for that many minutes[fn:28], and ask what
|
||||
computer after being idle for that many minutes[fn:29], and ask what
|
||||
you want to do with the idle time. There will be a question waiting
|
||||
for you when you get back, indicating how much idle time has passed
|
||||
constantly updated with the current amount, as well as a set of
|
||||
|
@ -8018,7 +8064,7 @@ Now lets look at the elements of a template definition. Each entry in
|
|||
|
||||
- =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
|
||||
|
||||
This target[fn:29] creates a heading in a date tree[fn:30] for
|
||||
This target[fn:30] creates a heading in a date tree[fn:31] for
|
||||
today's date. If the optional outline path is given, the tree
|
||||
will be built under the node it is pointing to, instead of at top
|
||||
level. Check out the ~:time-prompt~ and ~:tree-type~ properties
|
||||
|
@ -8303,8 +8349,12 @@ given here:
|
|||
|
||||
- =%\N= ::
|
||||
|
||||
Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}=, where
|
||||
{{{var(N)}}} is a number, starting from 1.
|
||||
Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}= (but not
|
||||
=%^{PROMPT}X=), where {{{var(N)}}} is a number, starting from 1.
|
||||
|
||||
- =%\*N= ::
|
||||
|
||||
Same as =%\N=, but include all the prompts.
|
||||
|
||||
- =%?= ::
|
||||
|
||||
|
@ -8327,7 +8377,7 @@ capture templates in a similar way.]:
|
|||
| | =%:date= (message date header field) |
|
||||
| | =%:date-timestamp= (date as active timestamp) |
|
||||
| | =%:date-timestamp-inactive= (date as inactive timestamp) |
|
||||
| | =%:fromto= (either "to NAME" or "from NAME")[fn:31] |
|
||||
| | =%:fromto= (either "to NAME" or "from NAME")[fn:32] |
|
||||
| gnus | =%:group=, for messages also all email fields |
|
||||
| w3, w3m | =%:url= |
|
||||
| info | =%:file=, =%:node= |
|
||||
|
@ -8993,7 +9043,7 @@ a paper agenda, showing all the tasks for the current week or day.
|
|||
#+cindex: org-agenda, command
|
||||
Compile an agenda for the current week from a list of Org files.
|
||||
The agenda shows the entries for each day. With a numeric prefix
|
||||
argument[fn:32]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
|
||||
argument[fn:33]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
|
||||
set the number of days to be displayed.
|
||||
|
||||
#+vindex: org-agenda-span
|
||||
|
@ -9677,11 +9727,11 @@ the estimated effort of an entry (see [[*Effort Estimates]]).
|
|||
#+vindex: org-agenda-effort-filter-preset
|
||||
#+vindex: org-agenda-regexp-filter-preset
|
||||
Agenda built-in or custom commands are statically defined. Agenda
|
||||
filters and limits allow to flexibly narrow down the list of agenda
|
||||
filters and limits allow flexibly narrowing down the list of agenda
|
||||
entries.
|
||||
|
||||
/Filters/ only change the visibility of items, are very fast and are
|
||||
mostly used interactively[fn:33]. You can switch quickly between
|
||||
mostly used interactively[fn:34]. You can switch quickly between
|
||||
different filters without having to recreate the agenda. /Limits/ on
|
||||
the other hand take effect before the agenda buffer is populated, so
|
||||
they are mostly useful when defined as local variables within custom
|
||||
|
@ -10767,7 +10817,7 @@ used for the matching. The example above will therefore define:
|
|||
|
||||
- {{{kbd(x)}}} ::
|
||||
|
||||
as a global search for agenda entries planned[fn:34] this week/day.
|
||||
as a global search for agenda entries planned[fn:35] this week/day.
|
||||
|
||||
- {{{kbd(y)}}} ::
|
||||
|
||||
|
@ -10953,7 +11003,7 @@ export custom agenda views as plain text, HTML[fn:: For HTML you need
|
|||
to install Hrvoje Nikšić's =htmlize.el= as an Emacs package from
|
||||
[[https://elpa.nongnu.org/][NonGNU ELPA]] or from
|
||||
[[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].],
|
||||
Postscript, PDF[fn:35], and iCalendar files. If you
|
||||
Postscript, PDF[fn:36], and iCalendar files. If you
|
||||
want to do this only occasionally, use the following command:
|
||||
|
||||
- {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
|
||||
|
@ -11231,7 +11281,17 @@ but not any simpler
|
|||
You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
|
||||
and =~code~=, and, if you must, =+strike-through+=. Text in the code
|
||||
and verbatim string is not processed for Org specific syntax; it is
|
||||
exported verbatim.
|
||||
exported verbatim. Org provides a single command as entry point for
|
||||
inserting the marker character.
|
||||
|
||||
- {{{kbd(C-c C-x C-f)}}} (~org-emphasize~) ::
|
||||
|
||||
#+kindex: C-c C-x C-f
|
||||
#+findex: org-emphasize
|
||||
Prompt for a marker character and insert or change an emphasis. If
|
||||
there is an active region, change that region to a new emphasis. If
|
||||
there is no region, just insert the marker characters and position
|
||||
the cursor between them.
|
||||
|
||||
#+vindex: org-fontify-emphasized-text
|
||||
To turn off fontification for marked up text, you can set
|
||||
|
@ -11274,15 +11334,20 @@ the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
|
|||
#+end_example
|
||||
|
||||
#+vindex: org-use-sub-superscripts
|
||||
#+vindex: org-export-with-sub-superscripts
|
||||
If you write a text where the underscore is often used in a different
|
||||
context, Org's convention to always interpret these as subscripts can
|
||||
get in your way. Configure the variable ~org-use-sub-superscripts~ to
|
||||
change this convention. For example, when setting this variable to
|
||||
~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is.
|
||||
get in your way. Configure the variable ~org-use-sub-superscripts~
|
||||
and/or ~org-export-with-sub-superscripts~ to change this convention.
|
||||
For example, when setting these variables to ~{}~, =a_b= is not
|
||||
displayed/exported[fn::The underlying markup still remains a
|
||||
sub/superscript. Only the visual display and export behavior
|
||||
changes.] as a subscript, but =a_{b}= is.
|
||||
|
||||
You can set ~org-use-sub-superscripts~ in a file using the export
|
||||
option =^:= (see [[*Export Settings][Export Settings]]). For example, =#+OPTIONS: ^:{}=
|
||||
sets ~org-use-sub-superscripts~ to ~{}~ and limits super- and
|
||||
You can set both ~org-use-sub-superscripts~
|
||||
~org-export-with-sub-superscripts~ in a file using the export option
|
||||
=^:= (see [[*Export Settings][Export Settings]]). For example,
|
||||
=#+OPTIONS: ^:{}= sets the two options to ~{}~ and limits super- and
|
||||
subscripts to the curly bracket notation.
|
||||
|
||||
You can also toggle the visual display of super- and subscripts:
|
||||
|
@ -11365,7 +11430,7 @@ converted into dashes, and =...= becomes a compact set of dots.
|
|||
|
||||
Plain ASCII is normally sufficient for almost all note taking.
|
||||
Exceptions include scientific notes, which often require mathematical
|
||||
symbols and the occasional formula. LaTeX[fn:36] is widely used to
|
||||
symbols and the occasional formula. LaTeX[fn:37] is widely used to
|
||||
typeset scientific documents. Org mode supports embedding LaTeX code
|
||||
into its files, because many academics are used to writing and reading
|
||||
LaTeX source code, and because it can be readily processed to produce
|
||||
|
@ -11387,7 +11452,7 @@ into images (see [[*Previewing LaTeX fragments]]).
|
|||
LaTeX fragments do not need any special marking at all. The following
|
||||
snippets are identified as LaTeX source code:
|
||||
|
||||
- Environments of any kind[fn:37]. The only requirement is that the
|
||||
- Environments of any kind[fn:38]. The only requirement is that the
|
||||
=\begin= statement appears on a new line, preceded by only
|
||||
whitespace.
|
||||
|
||||
|
@ -11436,7 +11501,7 @@ lines:
|
|||
|
||||
#+vindex: org-preview-latex-default-process
|
||||
If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
|
||||
=convert= installed[fn:38], LaTeX fragments can be processed to
|
||||
=convert= installed[fn:39], LaTeX fragments can be processed to
|
||||
produce images of the typeset expressions to be used for inclusion
|
||||
while exporting to HTML (see [[*LaTeX fragments]]), or for inline
|
||||
previewing within Org mode.
|
||||
|
@ -11592,9 +11657,9 @@ Here is an example
|
|||
#+vindex: org-latex-src-block-backend
|
||||
If the example is source code from a programming language, or any
|
||||
other text that can be marked up by Font Lock in Emacs, you can ask
|
||||
for the example to look like the fontified Emacs buffer[fn:39]. This
|
||||
for the example to look like the fontified Emacs buffer[fn:40]. This
|
||||
is done with the code block, where you also need to specify the name
|
||||
of the major mode that should be used to fontify the example[fn:40],
|
||||
of the major mode that should be used to fontify the example[fn:41],
|
||||
see [[*Structure Templates]] for shortcuts to easily insert code blocks.
|
||||
|
||||
#+cindex: @samp{BEGIN_SRC}
|
||||
|
@ -11608,13 +11673,15 @@ see [[*Structure Templates]] for shortcuts to easily insert code blocks.
|
|||
#+end_example
|
||||
|
||||
Both in =example= and in =src= snippets, you can add a =-n= switch to
|
||||
the end of the =#+BEGIN= line, to get the lines of the example
|
||||
numbered. The =-n= takes an optional numeric argument specifying the
|
||||
starting line number of the block. If you use a =+n= switch, the
|
||||
numbering from the previous numbered snippet is continued in the
|
||||
current one. The =+n= switch can also take a numeric argument. This
|
||||
adds the value of the argument to the last line of the previous block
|
||||
to determine the starting line number.
|
||||
the =#+BEGIN= line[fn::In the =src= snippets, switches must be placed
|
||||
right after the language name and before the [[*Structure of Code
|
||||
Blocks][header arguments]]], to get the lines of the example numbered.
|
||||
The =-n= takes an optional numeric argument specifying the starting
|
||||
line number of the block. If you use a =+n= switch, the numbering
|
||||
from the previous numbered snippet is continued in the current one.
|
||||
The =+n= switch can also take a numeric argument. This adds the value
|
||||
of the argument to the last line of the previous block to determine
|
||||
the starting line number.
|
||||
|
||||
#+begin_example
|
||||
,#+BEGIN_SRC emacs-lisp -n 20
|
||||
|
@ -11863,7 +11930,7 @@ text. Markers always start with =fn:=. For example:
|
|||
#+begin_example
|
||||
The Org website[fn:1] now looks a lot better than it used to.
|
||||
...
|
||||
[fn:49] The link is: https://orgmode.org
|
||||
[fn:50] The link is: https://orgmode.org
|
||||
#+end_example
|
||||
|
||||
Org mode extends the number-based syntax to /named/ footnotes and
|
||||
|
@ -12152,7 +12219,7 @@ global variables, include:
|
|||
Language to use for translating certain strings
|
||||
(~org-export-default-language~). With =#+LANGUAGE: fr=, for
|
||||
example, Org translates =Table of contents= to the French =Table des
|
||||
matières=[fn:41].
|
||||
matières=[fn:42].
|
||||
|
||||
- =SELECT_TAGS= ::
|
||||
|
||||
|
@ -12452,7 +12519,7 @@ keyword:
|
|||
#+cindex: excluding entries from table of contents
|
||||
#+cindex: table of contents, exclude entries
|
||||
Org includes both numbered and unnumbered headlines in the table of
|
||||
contents[fn:42]. If you need to exclude an unnumbered headline,
|
||||
contents[fn:43]. If you need to exclude an unnumbered headline,
|
||||
along with all its children, set the =UNNUMBERED= property to =notoc=
|
||||
value.
|
||||
|
||||
|
@ -12570,7 +12637,7 @@ be omitted to use the obvious defaults.
|
|||
| =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF |
|
||||
|
||||
Inclusions may specify a file-link to extract an object matched by
|
||||
~org-link-search~[fn:43] (see [[*Search Options in File Links]]). The
|
||||
~org-link-search~[fn:44] (see [[*Search Options in File Links]]). The
|
||||
ranges for =:lines= keyword are relative to the requested element.
|
||||
Therefore,
|
||||
|
||||
|
@ -12610,7 +12677,7 @@ following syntax:
|
|||
: #+MACRO: name replacement text; $1, $2 are arguments
|
||||
|
||||
#+texinfo: @noindent
|
||||
which can be referenced using ={{{name(arg1, arg2)}}}=[fn:44]. For
|
||||
which can be referenced using ={{{name(arg1, arg2)}}}=[fn:45]. For
|
||||
example
|
||||
|
||||
#+begin_example
|
||||
|
@ -13002,7 +13069,7 @@ should in principle be exportable as a Beamer presentation.
|
|||
|
||||
- Org exports a Beamer frame's objects as block environments. Org can
|
||||
enforce wrapping in special block types when =BEAMER_ENV= property
|
||||
is set[fn:45]. For valid values see
|
||||
is set[fn:46]. For valid values see
|
||||
~org-beamer-environments-default~. To add more values, see
|
||||
~org-beamer-environments-extra~.
|
||||
#+vindex: org-beamer-environments-default
|
||||
|
@ -13620,7 +13687,7 @@ different ways on HTML pages. The default is to use the
|
|||
with Org[fn:: By default, Org loads MathJax from
|
||||
[[https://www.jsdelivr.com/][jsDelivr]], as recommended in
|
||||
[[https://docs.mathjax.org/en/latest/web/start.html][Getting Started
|
||||
with MathJax Components]].][fn:46]. Some MathJax display options can
|
||||
with MathJax Components]].][fn:47]. Some MathJax display options can
|
||||
be configured via ~org-html-mathjax-options~, or in the buffer. For
|
||||
example, with the following settings,
|
||||
|
||||
|
@ -13939,7 +14006,7 @@ LaTeX export backend finds the compiler version to use from
|
|||
Org file. See the docstring for the
|
||||
~org-latex-default-packages-alist~ for loading packages with certain
|
||||
compilers. Also see ~org-latex-bibtex-compiler~ to set the
|
||||
bibliography compiler[fn:47].
|
||||
bibliography compiler[fn:48].
|
||||
|
||||
*** LaTeX specific export settings
|
||||
:PROPERTIES:
|
||||
|
@ -14747,9 +14814,11 @@ https://en.wikipedia.org/wiki/Markdown for more details.
|
|||
#+vindex: org-md-headline-style
|
||||
Based on ~org-md-headline-style~, Markdown export can generate
|
||||
headlines of both /atx/ and /setext/ types. /setext/ limits headline
|
||||
levels to two whereas /atx/ limits headline levels to six. Beyond
|
||||
these limits, the export backend converts headlines to lists. To set
|
||||
a limit to a level before the absolute limit (see [[*Export Settings]]).
|
||||
levels to two whereas /atx/ limits headline levels to six. /mixed/
|
||||
exports headline levels one and two in /setext/-style, and headline
|
||||
levels three through six as /atx/-style headlines. Beyond these
|
||||
limits, the export backend converts headlines to lists. To set a
|
||||
limit to a level before the absolute limit (see [[*Export Settings]]).
|
||||
|
||||
** OpenDocument Text Export
|
||||
:PROPERTIES:
|
||||
|
@ -16679,8 +16748,9 @@ Parse the temporary buffer, creating AST:
|
|||
property drawers, statistics cookies, timestamps, etc according
|
||||
to =#+OPTIONS= keyword (see [[*Export Settings]]);
|
||||
|
||||
- Table rows containing width and alignment markers (see [[*Column
|
||||
Width and Alignment]]);
|
||||
- Table rows containing width and alignment markers, unless the
|
||||
selected export backend changes ~:with-special-rows~ export option
|
||||
to non-nil (see [[*Column Width and Alignment]]);
|
||||
|
||||
- Table columns containing recalc marks (see [[*Advanced features]]).
|
||||
|
||||
|
@ -16711,8 +16781,8 @@ Convert the AST to text by traversing the AST nodes, depth-first:
|
|||
node contents;
|
||||
|
||||
4. Convert the nodes with children to text, passing the nodes
|
||||
themselves and their contents to the corresponding transcoders
|
||||
and then to the export filters (see [[*Filters]]).
|
||||
themselves and their exported contents to the corresponding
|
||||
transcoders and then to the export filters (see [[*Filters]]).
|
||||
|
||||
|
||||
#+texinfo: @noindent
|
||||
|
@ -17374,12 +17444,12 @@ place on the web server, and publishing images to it.
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-publish-project-alist
|
||||
'(("orgfiles"
|
||||
`(("orgfiles"
|
||||
:base-directory "~/org/"
|
||||
:base-extension "org"
|
||||
:publishing-directory "/ssh:user@host:~/html/notebook/"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:exclude "PrivatePage.org" ;; regexp
|
||||
:exclude ,(rx (or "PrivateFile.org" (seq line-start "private/"))) ;; regexp
|
||||
:headline-levels 3
|
||||
:section-numbers nil
|
||||
:with-toc nil
|
||||
|
@ -17449,30 +17519,68 @@ keywords.
|
|||
#+cindex: citation
|
||||
#+cindex: citation processor
|
||||
|
||||
The =oc.el= library provides tooling to handle citations in Org via
|
||||
"citation processors" that offer some or all of the following
|
||||
capabilities:
|
||||
While links (see [[*Hyperlinks]]) are often sufficient to refer to
|
||||
external or internal information from Org, they have their limitations
|
||||
when referring to multiple targets or typesetting printed
|
||||
publications.
|
||||
|
||||
- activate :: Fontification, tooltip preview, etc.
|
||||
- follow :: At-point actions on citations via ~org-open-at-point~.
|
||||
- insert :: Add and edit citations via ~org-cite-insert~.
|
||||
- export :: Via different libraries for different target formats.
|
||||
Org mode provides a more sophisticated markup to "cite" external
|
||||
resources. For example, consider the following Org mode snippet
|
||||
|
||||
To use a "citation processor", the user must load them; for example;
|
||||
: #+bibliography: citationdata.bib
|
||||
:
|
||||
: Org mode is used by various communities [cite:teaching: @orgteaching;
|
||||
: and TeX: @orgtex]. [cite/author/caps:@orgtex] uses Org mode to simplify
|
||||
: writing scientific publications, while [cite/author/caps:@orgteaching]
|
||||
: experiment with Org babel to improve teaching.
|
||||
:
|
||||
: #+print_bibliography:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'oc-bibtex)
|
||||
#+end_src
|
||||
Org mode will gather citation metadata from the =#+bibliography=
|
||||
database and use it to typeset the exported document in arbitrary
|
||||
formats. For example, the snippet below shows ASCII export output.
|
||||
|
||||
: Org mode is used by various communities (teaching: Birkenkrahe, Marcus,
|
||||
: 2023, and TeX: Somma, Emmanuele F, 2023). Somma, Emmanuele F uses Org
|
||||
: mode to simplify writing scientific publications, while Birkenkrahe,
|
||||
: Marcus experiment with Org babel to improve teaching.
|
||||
:
|
||||
: Birkenkrahe, Marcus (2023). /Teaching Data Science with Literate
|
||||
: Programming Tools/, MDPI.
|
||||
:
|
||||
: Somma, Emmanuele F (2023). /Simplifying LaTeX with ORG-mode in Emacs/,
|
||||
: TUGboat volume.
|
||||
|
||||
In addition to export, users can use completion to search and insert
|
||||
citations from the bibliography (via ~org-cite-insert~). Citations
|
||||
also act like ordinary links, jumping to the citation metadata when
|
||||
"following" them using ~org-open-at-point~.
|
||||
|
||||
You can customize every aspect (/capability/) of citation handling
|
||||
using built-in or external /citation processors/.
|
||||
|
||||
Org mode ships with several built-in citation processors tailored to
|
||||
work with LaTeX export and BibTeX bibliographies (=bibtex=,
|
||||
=biblatex=, and =natbib= processors), or with more generic formats
|
||||
described using [[https://citationstyles.org/][Citation Style
|
||||
Language]] (=csl= processor).
|
||||
The default citation processor is =basic= - it works with arbitrary
|
||||
export formats and recognizes both BibTeX and CSL bibliographies.
|
||||
More citation processors are distributed as Emacs packages.
|
||||
|
||||
#+vindex: org-cite-activate-processor
|
||||
#+vindex: org-cite-follow-processor
|
||||
#+vindex: org-cite-insert-processor
|
||||
#+vindex: org-cite-export-processor
|
||||
They can then configure them with ~org-cite-activate-processor~,
|
||||
~org-cite-follow-processor~, ~org-cite-insert-processor~, and
|
||||
~org-cite-export-processors~ respectively.
|
||||
Multiple citation processors can be mixed to meet your preferences.
|
||||
Configure ~org-cite-activate-processor~, ~org-cite-follow-processor~,
|
||||
~org-cite-insert-processor~, and ~org-cite-export-processors~ to
|
||||
select which processor to use for every citation capability:
|
||||
|
||||
The included "basic" processor provides all four capabilities.
|
||||
- activate :: Fontification, tooltip preview, etc.
|
||||
- follow :: At-point actions on citations via ~org-open-at-point~.
|
||||
- insert :: Add and edit citations via ~org-cite-insert~.
|
||||
- export :: Via different libraries for different target formats.
|
||||
|
||||
** Citations
|
||||
|
||||
|
@ -17526,15 +17634,16 @@ identifying a reference in the bibliography.
|
|||
|
||||
: [cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
|
||||
|
||||
When style is not specified, default style is used
|
||||
When =style= is not specified, one of the two default styles are
|
||||
used
|
||||
|
||||
+ either the default style specified in =CITE_EXPORT= keyword (see
|
||||
[[*Citation export processors]])
|
||||
+ either the default style specified in the =CITE_EXPORT= keyword
|
||||
(see [[*Citation export processors]])
|
||||
|
||||
: #+cite_export: basic numeric noauthor/bare
|
||||
: [cite:@key] is the same as [cite/noauthor/bare:@key]
|
||||
|
||||
+ or using default =nil= style
|
||||
+ or, if =CITE_EXPORT= is not set, using the default =nil= style
|
||||
|
||||
: [cite:@key] is the same as [cite/nil:@key]
|
||||
|
||||
|
@ -17556,8 +17665,10 @@ Org currently includes the following export processors:
|
|||
where backward compatibility is not a requirement and formatting
|
||||
needs are minimal;
|
||||
|
||||
- csl :: this export processor uses format files written in [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
|
||||
Style Language]] via [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
|
||||
- csl :: this export processor uses format files written in
|
||||
[[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
|
||||
Style Language]] via
|
||||
[[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
|
||||
|
||||
- In contrast, three other processors target LaTeX and LaTeX-derived
|
||||
formats exclusively:
|
||||
|
@ -17586,13 +17697,13 @@ optional)
|
|||
: #+cite_export: basic author-year author
|
||||
|
||||
#+texinfo: @noindent
|
||||
specifies the "basic" export processor with citations inserted as
|
||||
specifies the =basic= export processor with citations inserted as
|
||||
author's name and references indexed by author's names and year;
|
||||
|
||||
: #+cite_export: csl /some/path/to/vancouver-brackets.csl
|
||||
|
||||
#+texinfo: @noindent
|
||||
specifies the "csl" processor and CSL style, which in this case
|
||||
specifies the =csl= processor and CSL style, which in this case
|
||||
defines numeric citations and numeric references according to the
|
||||
=Vancouver= specification (as style used in many medical journals),
|
||||
following a typesetting variation putting citations between brackets;
|
||||
|
@ -17612,9 +17723,14 @@ your LaTeX installation, it won't export to anything but PDF.
|
|||
specifies the =biblatex= export processor with the default =numeric=
|
||||
style and the =bibtex= backend. Always define the style first and then
|
||||
the rest of load-time options for the =biblatex=
|
||||
package. Alternatively, use the ~org-cite-biblatex-options~ variable
|
||||
in your Emacs configuration. It will only export to PDF, since it
|
||||
relies on the ~biblatex~ processor of your LaTeX installation;
|
||||
package. Alternatively, you can use the ~key=val,key=val~ format for
|
||||
the options as documented in the =biblatex= package documentation:
|
||||
|
||||
: #+cite_export: biblatex backend=bibtex,style=numeric
|
||||
|
||||
The ~org-cite-biblatex-options~ variable in your Emacs configuration
|
||||
uses this format. It will only export to PDF, since it relies on the
|
||||
~biblatex~ processor of your LaTeX installation.
|
||||
|
||||
** Bibliography printing
|
||||
|
||||
|
@ -17625,8 +17741,8 @@ should be printed (note the colon):
|
|||
: #+print_bibliography:
|
||||
|
||||
The bibliography printed by the LaTeX-based export processors
|
||||
"bibtex", "natbib" and "biblatex" has a chapter or section heading by
|
||||
default, while the "basic" and "csl" processors print the list of
|
||||
=bibtex=, =natbib= and =biblatex= has a chapter or section heading by
|
||||
default, while the =basic= and =csl= processors print the list of
|
||||
bibliography entries without a heading.
|
||||
|
||||
A document may contain more than one =PRINT_BIBLIOGRAPHY= keywords.
|
||||
|
@ -17639,9 +17755,9 @@ certain category or to control formatting. The set of supported
|
|||
the different citation export processors. Some export processors do
|
||||
not support passing options.
|
||||
|
||||
*** Bibliography options in the "biblatex" and "csl" export processors
|
||||
*** Bibliography options in the =biblatex= and =csl= export processors
|
||||
|
||||
The "biblatex" and "csl" export processors support bibliography
|
||||
The =biblatex= and =csl= export processors support bibliography
|
||||
options through a property list attached to the =PRINT_BIBLIOGRAPHY=
|
||||
keyword. For example,
|
||||
|
||||
|
@ -17653,10 +17769,10 @@ commas, but without any space in-between:
|
|||
|
||||
: #+print_bibliography: :keyword "algebraic logic" :nottype article,book
|
||||
|
||||
The "biblatex" export processor accepts all options supported by
|
||||
The =biblatex= export processor accepts all options supported by
|
||||
BibLaTeX's ~\printbibliography~ command.
|
||||
|
||||
The "csl" processor accepts the following options:
|
||||
The =csl= processor accepts the following options:
|
||||
|
||||
- =:keyword <keyword(,keyword2...)>= :: Print only entries whose
|
||||
keyword field contains all given keywords.
|
||||
|
@ -18555,7 +18671,7 @@ block, collects the results, and inserts them in the buffer.
|
|||
|
||||
#+cindex: @samp{CALL}, keyword
|
||||
#+vindex: org-babel-inline-result-wrap
|
||||
By calling a named code block[fn:48] from an Org mode buffer or
|
||||
By calling a named code block[fn:49] from an Org mode buffer or
|
||||
a table. Org can call the named code blocks from the current Org mode
|
||||
buffer or from the "Library of Babel" (see [[*Library of Babel]]).
|
||||
|
||||
|
@ -18763,7 +18879,7 @@ they are mutually exclusive.
|
|||
|
||||
- =value= ::
|
||||
|
||||
Default for most Babel libraries[fn:48]. Functional mode. Org
|
||||
Default for most Babel libraries[fn:49]. Functional mode. Org
|
||||
gets the value by wrapping the code in a function definition in the
|
||||
language of the source block. That is why when using =:results
|
||||
value=, code should execute like a function and return a value. For
|
||||
|
@ -18930,6 +19046,11 @@ Choose one of the options; they are mutually exclusive. The default
|
|||
follows from the type specified above.
|
||||
|
||||
#+attr_texinfo: :sep ,
|
||||
- =raw= ::
|
||||
|
||||
Interpreted as raw Org mode. Inserted directly into the buffer.
|
||||
Aligned if it is a table. Usage example: =:results value raw=.
|
||||
|
||||
- =code= ::
|
||||
|
||||
Result enclosed in a code block. Useful for parsing. Usage
|
||||
|
@ -18937,8 +19058,9 @@ follows from the type specified above.
|
|||
|
||||
- =drawer= ::
|
||||
|
||||
Result wrapped in a =RESULTS= drawer. Useful for containing =raw=
|
||||
or =org= results for later scripting and automated processing.
|
||||
Results are added directly to the Org file as with =raw=, but are
|
||||
wrapped in a =RESULTS= drawer or results macro (for inline code
|
||||
blocks), for later scripting and automated processing.
|
||||
Usage example: =:results value drawer=.
|
||||
|
||||
- =html= ::
|
||||
|
@ -18983,10 +19105,6 @@ follows from the type specified above.
|
|||
block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
|
||||
example: =:results value pp=.
|
||||
|
||||
- =raw= ::
|
||||
|
||||
Interpreted as raw Org mode. Inserted directly into the buffer.
|
||||
Aligned if it is a table. Usage example: =:results value raw=.
|
||||
|
||||
#+cindex: @samp{wrap}, header argument
|
||||
The =wrap= header argument unconditionally marks the results block by
|
||||
|
@ -19625,7 +19743,7 @@ the second code block is expanded as
|
|||
#+end_example
|
||||
|
||||
Note that noweb expansion does not automatically carry over =:var=
|
||||
header arguments[fn:49].
|
||||
header arguments[fn:50].
|
||||
|
||||
You may also include the contents of multiple blocks sharing a common
|
||||
=noweb-ref= header argument, which can be set at the file, subtree,
|
||||
|
@ -20167,7 +20285,7 @@ in the desired amount with hard spaces and hiding leading stars.
|
|||
To display the buffer in the indented view, activate Org Indent minor
|
||||
mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not
|
||||
headlines are prefixed with virtual spaces to vertically align with
|
||||
the headline text[fn:50].
|
||||
the headline text[fn:51].
|
||||
|
||||
#+vindex: org-indent-indentation-per-level
|
||||
To make more horizontal space, the headlines are shifted by two
|
||||
|
@ -20195,7 +20313,7 @@ use =STARTUP= keyword as follows:
|
|||
|
||||
It is possible to use hard spaces to achieve the indentation instead,
|
||||
if the bare ASCII file should have the indented look also outside
|
||||
Emacs[fn:51]. With Org's support, you have to indent all lines to
|
||||
Emacs[fn:52]. With Org's support, you have to indent all lines to
|
||||
line up with the outline headers. You would use these settings[fn::
|
||||
~org-adapt-indentation~ can also be set to ='headline-data=, in which
|
||||
case only data lines below the headline will be indented.]:
|
||||
|
@ -21262,8 +21380,8 @@ adding ~:rewrites~ rules like this:
|
|||
|
||||
#+texinfo: @noindent
|
||||
Since =example.com/$= is used as a regular expression, it maps
|
||||
=http://example.com/=, =https://example.com=,
|
||||
=http://www.example.com/= and similar to
|
||||
=https://example.com/=, =https://example.com=,
|
||||
=https://www.example.com/= and similar to
|
||||
=/home/user/example/index.php=.
|
||||
|
||||
The ~:rewrites~ rules are searched as a last resort if and only if no
|
||||
|
@ -21362,7 +21480,7 @@ Tags]]) only for those set in these variables.
|
|||
|
||||
#+vindex: org-mobile-directory
|
||||
The mobile application needs access to a file directory on
|
||||
a server[fn:52] to interact with Emacs. Pass its location through
|
||||
a server[fn:53] to interact with Emacs. Pass its location through
|
||||
the ~org-mobile-directory~ variable. If you can mount that directory
|
||||
locally just set the variable to point to that directory:
|
||||
|
||||
|
@ -21406,7 +21524,7 @@ Symbolic links in ~org-directory~ need to have the same name as their
|
|||
targets.].
|
||||
|
||||
Push creates a special Org file =agendas.org= with custom agenda views
|
||||
defined by the user[fn:53].
|
||||
defined by the user[fn:54].
|
||||
|
||||
Finally, Org writes the file =index.org=, containing links to other
|
||||
files. The mobile application reads this file first from the server
|
||||
|
@ -21772,7 +21890,7 @@ of these strategies:
|
|||
To wrap a source table in LaTeX, use the =comment= environment
|
||||
provided by =comment.sty=[fn:: https://www.ctan.org/pkg/comment]. To
|
||||
activate it, put ~\usepackage{comment}~ in the document header.
|
||||
Orgtbl mode inserts a radio table skeleton[fn:54] with the command
|
||||
Orgtbl mode inserts a radio table skeleton[fn:55] with the command
|
||||
{{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table
|
||||
name. For example, if =salesfigures= is the name, the template
|
||||
inserts:
|
||||
|
@ -21792,7 +21910,7 @@ The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
|
|||
~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
|
||||
the table at the target (receive) location named =salesfigures=. Now
|
||||
the table is ready for data entry. It can even use spreadsheet
|
||||
features[fn:55]:
|
||||
features[fn:56]:
|
||||
|
||||
#+begin_example
|
||||
% BEGIN RECEIVE ORGTBL salesfigures
|
||||
|
@ -23094,7 +23212,10 @@ With =lognoterepeat=, you will also be prompted for a note.
|
|||
than 30 stars. This is a hard-coded limitation of ~lmax~ in
|
||||
~org-clock-sum~.
|
||||
|
||||
[fn:28] On computers using macOS, idleness is based on actual user
|
||||
[fn:28] When using ~:step~, ~untilnow~ starts from the beginning of
|
||||
2003, not the beginning of time.
|
||||
|
||||
[fn:29] On computers using macOS, idleness is based on actual user
|
||||
idleness, not just Emacs' idle time. For X11, you can install a
|
||||
utility program =x11idle.c=, available in the =org-contrib/=
|
||||
repository, or install the xprintidle package and set it to the
|
||||
|
@ -23102,13 +23223,13 @@ variable ~org-clock-x11idle-program-name~ if you are running Debian,
|
|||
to get the same general treatment of idleness. On other systems, idle
|
||||
time refers to Emacs idle time only.
|
||||
|
||||
[fn:29] Org used to offer four different targets for date/week tree
|
||||
[fn:30] Org used to offer four different targets for date/week tree
|
||||
capture. Now, Org automatically translates these to use
|
||||
~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
|
||||
properties. Please rewrite your date/week-tree targets using
|
||||
~file+olp+datetree~ since the older targets are now deprecated.
|
||||
|
||||
[fn:30] A date tree is an outline structure with years on the highest
|
||||
[fn:31] A date tree is an outline structure with years on the highest
|
||||
level, months or ISO weeks as sublevels and then dates on the lowest
|
||||
level.
|
||||
|
||||
|
@ -23122,15 +23243,15 @@ level.
|
|||
TODO state, priority, tags, statistics cookies, and COMMENT keywords
|
||||
are allowed in the tree structure.
|
||||
|
||||
[fn:31] This is always the other, not the user. See the variable
|
||||
[fn:32] This is always the other, not the user. See the variable
|
||||
~org-link-from-user-regexp~.
|
||||
|
||||
[fn:32] For backward compatibility, the universal prefix argument
|
||||
[fn:33] For backward compatibility, the universal prefix argument
|
||||
{{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
|
||||
This feature is deprecated, use the dedicated TODO list, or a block
|
||||
agenda instead (see [[*Block agenda]]).
|
||||
|
||||
[fn:33] Custom agenda commands can preset a filter by binding one of
|
||||
[fn:34] Custom agenda commands can preset a filter by binding one of
|
||||
the variables ~org-agenda-tag-filter-preset~,
|
||||
~org-agenda-category-filter-preset~, ~org-agenda-effort-filter-preset~
|
||||
or ~org-agenda-regexp-filter-preset~ as an option. This filter is
|
||||
|
@ -23140,72 +23261,72 @@ property of the entire agenda view---in a block agenda, you should
|
|||
only set this in the global options section, not in the section of an
|
||||
individual block.
|
||||
|
||||
[fn:34] /Planned/ means here that these entries have some planning
|
||||
[fn:35] /Planned/ means here that these entries have some planning
|
||||
information attached to them, like a timestamp, a scheduled or
|
||||
a deadline string. See ~org-agenda-entry-types~ on how to set what
|
||||
planning information is taken into account.
|
||||
|
||||
[fn:35] To create PDF output, the Ghostscript ps2pdf utility must be
|
||||
[fn:36] To create PDF output, the Ghostscript ps2pdf utility must be
|
||||
installed on the system. Selecting a PDF file also creates the
|
||||
postscript file.
|
||||
|
||||
[fn:36] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
|
||||
[fn:37] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
|
||||
system. Many of the features described here as "LaTeX" are really
|
||||
from TeX, but for simplicity I am blurring this distinction.
|
||||
|
||||
[fn:37] When MathJax is used, only the environments recognized by
|
||||
[fn:38] When MathJax is used, only the environments recognized by
|
||||
MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
|
||||
used to create images, any LaTeX environment is handled.
|
||||
|
||||
[fn:38] These are respectively available at
|
||||
[fn:39] These are respectively available at
|
||||
[[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
|
||||
and from the ImageMagick suite. Choose the converter by setting the
|
||||
variable ~org-preview-latex-default-process~ accordingly.
|
||||
|
||||
[fn:39] This works automatically for the HTML backend (it requires
|
||||
[fn:40] This works automatically for the HTML backend (it requires
|
||||
version 1.34 of the =htmlize.el= package, which you need to install).
|
||||
Fontified code chunks in LaTeX can be achieved using either the
|
||||
[[https://www.ctan.org/pkg/listings][listings]] LaTeX package, [[https://www.ctan.org/pkg/minted][minted]] LaTeX package, or by using
|
||||
[[https://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] . Refer to ~org-latex-src-block-backend~ for details.
|
||||
|
||||
[fn:40] Source code in code blocks may also be evaluated either
|
||||
[fn:41] Source code in code blocks may also be evaluated either
|
||||
interactively or on export. See [[*Working with Source Code]] for more
|
||||
information on evaluating code blocks.
|
||||
|
||||
[fn:41] For export to LaTeX format---or LaTeX-related formats such as
|
||||
[fn:42] For export to LaTeX format---or LaTeX-related formats such as
|
||||
Beamer---, the =org-latex-package-alist= variable needs further
|
||||
configuration. See [[LaTeX specific export settings]].
|
||||
|
||||
[fn:42] At the moment, some export backends do not obey this
|
||||
[fn:43] At the moment, some export backends do not obey this
|
||||
specification. For example, LaTeX export excludes every unnumbered
|
||||
headline from the table of contents.
|
||||
|
||||
[fn:43] Note that ~org-link-search-must-match-exact-headline~ is
|
||||
[fn:44] Note that ~org-link-search-must-match-exact-headline~ is
|
||||
locally bound to non-~nil~. Therefore, ~org-link-search~ only matches
|
||||
headlines and named elements.
|
||||
|
||||
[fn:44] Since commas separate the arguments, commas within arguments
|
||||
[fn:45] Since commas separate the arguments, commas within arguments
|
||||
have to be escaped with the backslash character. So only those
|
||||
backslash characters before a comma need escaping with another
|
||||
backslash character.
|
||||
|
||||
[fn:45] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
|
||||
[fn:46] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
|
||||
to make it visible. The tag serves as a visual aid and has no
|
||||
semantic relevance.
|
||||
|
||||
[fn:46] Please note that exported formulas are part of an HTML
|
||||
[fn:47] Please note that exported formulas are part of an HTML
|
||||
document, and that signs such as =<=, =>=, or =&= have special
|
||||
meanings. See [[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]].
|
||||
|
||||
[fn:47] This does not allow setting different bibliography compilers
|
||||
[fn:48] This does not allow setting different bibliography compilers
|
||||
for different files. However, "smart" LaTeX compilation systems, such
|
||||
as latexmk, can select the correct bibliography compiler.
|
||||
|
||||
[fn:48] Actually, the constructs =call_<name>()= and =src_<lang>{}=
|
||||
[fn:49] Actually, the constructs =call_<name>()= and =src_<lang>{}=
|
||||
are not evaluated when they appear in a keyword (see [[*Summary of
|
||||
In-Buffer Settings]]).
|
||||
|
||||
[fn:49] In the following example, attempting to evaluate
|
||||
[fn:50] In the following example, attempting to evaluate
|
||||
the second code block will give an error, because the variables
|
||||
defined in the first code block will not be defined in the second
|
||||
block.
|
||||
|
@ -23233,29 +23354,29 @@ values.
|
|||
,#+END_SRC
|
||||
#+end_example
|
||||
|
||||
[fn:50] Org Indent mode also sets ~wrap-prefix~ correctly for
|
||||
[fn:51] Org Indent mode also sets ~wrap-prefix~ correctly for
|
||||
indenting and wrapping long lines of headlines or text. This minor
|
||||
mode also handles Visual Line mode and directly applied settings
|
||||
through ~word-wrap~.
|
||||
|
||||
[fn:51] This works, but requires extra effort. Org Indent mode is
|
||||
[fn:52] This works, but requires extra effort. Org Indent mode is
|
||||
more convenient for most applications.
|
||||
|
||||
[fn:52] For a server to host files, consider using a WebDAV server,
|
||||
[fn:53] For a server to host files, consider using a WebDAV server,
|
||||
such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
|
||||
|
||||
[fn:53] While creating the agendas, Org mode forces =ID= properties
|
||||
[fn:54] While creating the agendas, Org mode forces =ID= properties
|
||||
on all referenced entries, so that these entries can be uniquely
|
||||
identified if Org Mobile flags them for further action. To avoid
|
||||
setting properties configure the variable
|
||||
~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies
|
||||
on outline paths, assuming they are unique.
|
||||
|
||||
[fn:54] By default this works only for LaTeX, HTML, and Texinfo.
|
||||
[fn:55] By default this works only for LaTeX, HTML, and Texinfo.
|
||||
Configure the variable ~orgtbl-radio-table-templates~ to install
|
||||
templates for other modes.
|
||||
|
||||
[fn:55] If the =TBLFM= keyword contains an odd number of dollar
|
||||
[fn:56] If the =TBLFM= keyword contains an odd number of dollar
|
||||
characters, this may cause problems with Font Lock in LaTeX mode. As
|
||||
shown in the example you can fix this by adding an extra line inside
|
||||
the =comment= environment that is used to balance the dollar
|
||||
|
|
1645
etc/ORG-NEWS
1645
etc/ORG-NEWS
File diff suppressed because it is too large
Load Diff
|
@ -66,17 +66,21 @@
|
|||
(lambda (pair)
|
||||
(let ((val (cdr pair)))
|
||||
(calc-push-list
|
||||
;; For a vector, Calc follows the format (vec 1 2 3 ...) so
|
||||
;; a matrix becomes (vec (vec 1 2 3) (vec 4 5 6) ...). See
|
||||
;; the comments in "Arithmetic routines." section of
|
||||
;; calc.el.
|
||||
(list (if (listp val)
|
||||
(cons 'vec
|
||||
(if (null (cdr val))
|
||||
(car val)
|
||||
(mapcar (lambda (x) (if (listp x) (cons 'vec x) x))
|
||||
val)))
|
||||
val))))
|
||||
(list
|
||||
(cond
|
||||
;; For a vector, Calc follows the format (vec 1 2 3 ...) so
|
||||
;; a matrix becomes (vec (vec 1 2 3) (vec 4 5 6) ...). See
|
||||
;; the comments in "Arithmetic routines." section of
|
||||
;; calc.el.
|
||||
((listp val)
|
||||
(cons 'vec
|
||||
(if (null (cdr val))
|
||||
(car val)
|
||||
(mapcar (lambda (x) (if (listp x) (cons 'vec x) x))
|
||||
val))))
|
||||
((numberp val)
|
||||
(math-read-number (number-to-string val)))
|
||||
(t val)))))
|
||||
(calc-store-into (car pair)))
|
||||
vars)
|
||||
(mapc
|
||||
|
@ -111,7 +115,7 @@
|
|||
(mapcar #'org-trim
|
||||
(split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
|
||||
(save-excursion
|
||||
(with-current-buffer (get-buffer "*Calculator*")
|
||||
(with-current-buffer "*Calculator*"
|
||||
(prog1
|
||||
(calc-eval (calc-top 1))
|
||||
(calc-pop 1)))))
|
||||
|
|
|
@ -65,7 +65,8 @@ executed inside the protection of `save-excursion' and
|
|||
"Waiting time until trying to use fallback regexp to detect prompt.
|
||||
This is useful when prompt unexpectedly changes."
|
||||
:type 'float
|
||||
:group 'org-babel)
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defun org-babel-comint--set-fallback-prompt ()
|
||||
"Swap `comint-prompt-regexp' and `org-babel-comint-prompt-regexp-old'."
|
||||
|
|
110
lisp/ob-core.el
110
lisp/ob-core.el
|
@ -893,7 +893,11 @@ guess will be made."
|
|||
(format "at position %S" (nth 5 info)))))
|
||||
(setq exec-start-time (current-time)
|
||||
result
|
||||
(let ((r (save-current-buffer (funcall cmd body params))))
|
||||
(let ((r
|
||||
;; Code block may move point in the buffer.
|
||||
;; Make sure that the point remains on the
|
||||
;; code block.
|
||||
(save-excursion (funcall cmd body params))))
|
||||
(if (and (eq (cdr (assq :result-type params)) 'value)
|
||||
(or (member "vector" result-params)
|
||||
(member "table" result-params))
|
||||
|
@ -909,7 +913,7 @@ guess will be made."
|
|||
;; insert a link to `:file'.
|
||||
(when (and result
|
||||
(not (or (member "link" result-params)
|
||||
(member "graphics" result-params))))
|
||||
(member "graphics" result-params))))
|
||||
(with-temp-file file
|
||||
(insert (org-babel-format-result
|
||||
result
|
||||
|
@ -3136,47 +3140,47 @@ block but are passed literally to the \"example-block\"."
|
|||
(with-current-buffer parent-buffer
|
||||
(buffer-chars-modified-tick)))))
|
||||
(cl-macrolet ((c-wrap
|
||||
(s)
|
||||
;; Comment string S, according to LANG mode. Return new
|
||||
;; string.
|
||||
`(unless org-babel-tangle-uncomment-comments
|
||||
(with-temp-buffer
|
||||
(funcall (org-src-get-lang-mode lang))
|
||||
(comment-region (point)
|
||||
(progn (insert ,s) (point)))
|
||||
(org-trim (buffer-string)))))
|
||||
(s)
|
||||
;; Comment string S, according to LANG mode. Return new
|
||||
;; string.
|
||||
`(unless org-babel-tangle-uncomment-comments
|
||||
(with-temp-buffer
|
||||
(funcall (org-src-get-lang-mode lang))
|
||||
(comment-region (point)
|
||||
(progn (insert ,s) (point)))
|
||||
(org-trim (buffer-string)))))
|
||||
(expand-body
|
||||
(i)
|
||||
;; Expand body of code represented by block info I.
|
||||
`(let ((b (if (org-babel-noweb-p (nth 2 ,i) :eval)
|
||||
(org-babel-expand-noweb-references ,i)
|
||||
(nth 1 ,i))))
|
||||
(if (not comment) b
|
||||
(let ((cs (org-babel-tangle-comment-links ,i)))
|
||||
(concat (c-wrap (car cs)) "\n"
|
||||
b "\n"
|
||||
(c-wrap (cadr cs)))))))
|
||||
(i)
|
||||
;; Expand body of code represented by block info I.
|
||||
`(let ((b (if (org-babel-noweb-p (nth 2 ,i) :eval)
|
||||
(org-babel-expand-noweb-references ,i)
|
||||
(nth 1 ,i))))
|
||||
(if (not comment) b
|
||||
(let ((cs (org-babel-tangle-comment-links ,i)))
|
||||
(concat (c-wrap (car cs)) "\n"
|
||||
b "\n"
|
||||
(c-wrap (cadr cs)) "\n")))))
|
||||
(expand-references
|
||||
(ref)
|
||||
`(pcase (gethash ,ref org-babel-expand-noweb-references--cache)
|
||||
(`(,last . ,previous)
|
||||
;; Ignore separator for last block.
|
||||
(let ((strings (list (expand-body last))))
|
||||
(dolist (i previous)
|
||||
(let ((parameters (nth 2 i)))
|
||||
;; Since we're operating in reverse order, first
|
||||
;; push separator, then body.
|
||||
(push (or (cdr (assq :noweb-sep parameters)) "\n")
|
||||
strings)
|
||||
(push (expand-body i) strings)))
|
||||
(mapconcat #'identity strings "")))
|
||||
;; Raise an error about missing reference, or return the
|
||||
;; empty string.
|
||||
((guard (or org-babel-noweb-error-all-langs
|
||||
(member lang org-babel-noweb-error-langs)))
|
||||
(error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
|
||||
(org-babel-noweb-wrap ,ref)))
|
||||
(_ ""))))
|
||||
(ref)
|
||||
`(pcase (gethash ,ref org-babel-expand-noweb-references--cache)
|
||||
(`(,last . ,previous)
|
||||
;; Ignore separator for last block.
|
||||
(let ((strings (list (expand-body last))))
|
||||
(dolist (i previous)
|
||||
(let ((parameters (nth 2 i)))
|
||||
;; Since we're operating in reverse order, first
|
||||
;; push separator, then body.
|
||||
(push (or (cdr (assq :noweb-sep parameters)) "\n")
|
||||
strings)
|
||||
(push (expand-body i) strings)))
|
||||
(mapconcat #'identity strings "")))
|
||||
;; Raise an error about missing reference, or return the
|
||||
;; empty string.
|
||||
((guard (or org-babel-noweb-error-all-langs
|
||||
(member lang org-babel-noweb-error-langs)))
|
||||
(error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
|
||||
(org-babel-noweb-wrap ,ref)))
|
||||
(_ ""))))
|
||||
(replace-regexp-in-string
|
||||
noweb-re
|
||||
(lambda (m)
|
||||
|
@ -3360,10 +3364,22 @@ situations in which is it not appropriate."
|
|||
(string= cell "*this*")))
|
||||
;; FIXME: Arbitrary code evaluation.
|
||||
(eval (read cell) t))
|
||||
((save-match-data
|
||||
(and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
|
||||
(not (string-match "[^\\]\"" (match-string 1 cell)))))
|
||||
(read cell))
|
||||
((let (read-val)
|
||||
(and (string-match-p
|
||||
(rx bos (0+ (any space ?\n))
|
||||
?\" (0+ anychar) ?\"
|
||||
(0+ (any space ?\n)) eos)
|
||||
cell)
|
||||
;; CELL is a single string
|
||||
(with-temp-buffer
|
||||
(insert cell)
|
||||
(goto-char 1)
|
||||
(when (setq read-val
|
||||
(ignore-errors
|
||||
(read (current-buffer))))
|
||||
(skip-chars-forward "[:space:]")
|
||||
(eobp)))
|
||||
read-val)))
|
||||
(t (org-no-properties cell))))
|
||||
|
||||
(defun org-babel--string-to-number (string)
|
||||
|
@ -3389,7 +3405,9 @@ SEPARATOR is passed to `org-table-convert-region', which see."
|
|||
;; If the file was empty, don't bother trying to
|
||||
;; convert the table.
|
||||
(when (> pmax 1)
|
||||
(org-table-convert-region (point-min) pmax separator)
|
||||
(org-table-convert-region
|
||||
(point-min) pmax
|
||||
(or separator 'babel-auto))
|
||||
(delq nil
|
||||
(mapcar (lambda (row)
|
||||
(and (not (eq row 'hline))
|
||||
|
|
|
@ -47,11 +47,12 @@
|
|||
"Execute a block of Eshell code BODY with PARAMS.
|
||||
This function is called by `org-babel-execute-src-block'.
|
||||
|
||||
The BODY can be any code which allowed executed in Eshell.
|
||||
Eshell allow to execute normal shell command and Elisp code.
|
||||
More details please reference Eshell Info.
|
||||
The BODY argument is code which can be executed in Eshell.
|
||||
Eshell allows executing normal shell command and Elisp code.
|
||||
For more details, see Info node `(eshell) Top'.
|
||||
|
||||
The PARAMS are variables assignments."
|
||||
The PARAMS argument is passed to
|
||||
`org-babel-expand-body:generic' (which see)."
|
||||
(let* ((session (org-babel-eshell-initiate-session
|
||||
(cdr (assq :session params))))
|
||||
(full-body (org-babel-expand-body:generic
|
||||
|
|
|
@ -238,7 +238,10 @@ this template."
|
|||
((not (string= replacement
|
||||
(buffer-substring begin end)))
|
||||
(delete-region begin end)
|
||||
(insert replacement))))))
|
||||
(insert replacement))
|
||||
;; Replacement is the same as the source
|
||||
;; block. Continue onwards.
|
||||
(t (goto-char end))))))
|
||||
((or `babel-call `inline-babel-call)
|
||||
(org-babel-exp-do-export
|
||||
(or (org-babel-lob-get-info element)
|
||||
|
@ -367,7 +370,7 @@ The function respects the value of the :exports header argument."
|
|||
nil))))
|
||||
|
||||
(defcustom org-babel-exp-code-template
|
||||
"#+begin_src %lang%switches%flags\n%body\n#+end_src"
|
||||
"#+begin_src %lang%switches%header-args\n%body\n#+end_src"
|
||||
"Template used to export the body of code blocks.
|
||||
This template may be customized to include additional information
|
||||
such as the code block name, or the values of particular header
|
||||
|
@ -378,17 +381,17 @@ and the following %keys may be used.
|
|||
name ------ the name of the code block
|
||||
body ------ the body of the code block
|
||||
switches -- the switches associated to the code block
|
||||
flags ----- the flags passed to the code block
|
||||
header-args the header arguments of the code block
|
||||
|
||||
In addition to the keys mentioned above, every header argument
|
||||
defined for the code block may be used as a key and will be
|
||||
replaced with its value."
|
||||
:group 'org-babel
|
||||
:type 'string
|
||||
:package-version '(Org . "9.6"))
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defcustom org-babel-exp-inline-code-template
|
||||
"src_%lang[%switches%flags]{%body}"
|
||||
"src_%lang[%switches%header-args]{%body}"
|
||||
"Template used to export the body of inline code blocks.
|
||||
This template may be customized to include additional information
|
||||
such as the code block name, or the values of particular header
|
||||
|
@ -399,15 +402,14 @@ and the following %keys may be used.
|
|||
name ------ the name of the code block
|
||||
body ------ the body of the code block
|
||||
switches -- the switches associated to the code block
|
||||
flags ----- the flags passed to the code block
|
||||
header-args the header arguments of the code block
|
||||
|
||||
In addition to the keys mentioned above, every header argument
|
||||
defined for the code block may be used as a key and will be
|
||||
replaced with its value."
|
||||
:group 'org-babel
|
||||
:type 'string
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3"))
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defun org-babel-exp-code (info type)
|
||||
"Return the original code block of TYPE defined by INFO, formatted for export."
|
||||
|
@ -432,6 +434,11 @@ replaced with its value."
|
|||
(and (org-string-nw-p f) (concat " " f))))
|
||||
("flags" . ,(let ((f (assq :flags (nth 2 info))))
|
||||
(and f (concat " " (cdr f)))))
|
||||
("header-args"
|
||||
.
|
||||
,(org-babel-exp--at-source
|
||||
(when-let ((params (org-element-property :parameters (org-element-context))))
|
||||
(concat " " params))))
|
||||
,@(mapcar (lambda (pair)
|
||||
(cons (substring (symbol-name (car pair)) 1)
|
||||
(format "%S" (cdr pair))))
|
||||
|
|
|
@ -339,7 +339,6 @@ constructs (header arguments, no-web syntax etc...) are ignored."
|
|||
(command (concat org-babel-haskell-lhs2tex-command
|
||||
" " (org-babel-process-file-name lhs-file)
|
||||
" > " (org-babel-process-file-name tex-file)))
|
||||
;; FIXME: What if src block has :preserve-indentation flag?
|
||||
(preserve-indentp org-src-preserve-indentation)
|
||||
indentation)
|
||||
;; escape haskell source-code blocks
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
(defvar org-format-latex-options) ; From org.el
|
||||
(defvar org-latex-default-packages-alist) ; From org.el
|
||||
(defvar org-latex-packages-alist) ; From org.el
|
||||
(defvar org-preview-latex-process-alist) ; From org.el
|
||||
|
||||
(defvar org-babel-default-header-args:latex
|
||||
'((:results . "latex") (:exports . "results"))
|
||||
|
@ -128,6 +129,30 @@ exporting the literal LaTeX source."
|
|||
:group 'org-babel
|
||||
:type '(repeat (string)))
|
||||
|
||||
(defcustom org-babel-latex-process-alist
|
||||
`((png :programs ("latex" "dvipng") :description "dvi > png"
|
||||
:message
|
||||
"you need to install the programs: latex and dvipng."
|
||||
:image-input-type "dvi" :image-output-type "png"
|
||||
:image-size-adjust (1.0 . 1.0) :latex-compiler
|
||||
,(if (executable-find "latexmk")
|
||||
'("latexmk -f -pdf -latex -interaction=nonstopmode -output-directory=%o %f")
|
||||
'("latex -interaction nonstopmode -output-directory %o %f"
|
||||
"latex -interaction nonstopmode -output-directory %o %f"
|
||||
"latex -interaction nonstopmode -output-directory %o %f"))
|
||||
:image-converter ("dvipng -D %D -T tight -o %O %f")
|
||||
:transparent-image-converter
|
||||
("dvipng -D %D -T tight -bg Transparent -o %O %f")))
|
||||
"Definitions of external processes for LaTeX result generation.
|
||||
See `org-preview-latex-process-alist' for more details.
|
||||
|
||||
The following process symbols are recognized:
|
||||
- `png' :: Process used to produce .png output."
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.8")
|
||||
:type '(alist :tag "LaTeX to image backends"
|
||||
:value-type (plist)))
|
||||
|
||||
(defun org-babel-expand-body:latex (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
(mapc (lambda (pair) ;; replace variables
|
||||
|
@ -169,9 +194,10 @@ This function is called by `org-babel-execute-src-block'."
|
|||
((and (string-suffix-p ".png" out-file) (not imagemagick))
|
||||
(let ((org-format-latex-header
|
||||
(concat org-format-latex-header "\n"
|
||||
(mapconcat #'identity headers "\n"))))
|
||||
(mapconcat #'identity headers "\n")))
|
||||
(org-preview-latex-process-alist org-babel-latex-process-alist))
|
||||
(org-create-formula-image
|
||||
body out-file org-format-latex-options in-buffer)))
|
||||
body out-file org-format-latex-options in-buffer 'png)))
|
||||
((string= "svg" extension)
|
||||
(with-temp-file tex-file
|
||||
(insert (concat (funcall org-babel-latex-preamble params)
|
||||
|
|
|
@ -81,6 +81,12 @@ This will typically be `lua-mode'."
|
|||
:package-version '(Org . "8.3")
|
||||
:type 'symbol)
|
||||
|
||||
(defcustom org-babel-lua-multiple-values-separator ", "
|
||||
"Separate multiple values with this string."
|
||||
:group 'org-babel
|
||||
:package-version '(Org . "9.7")
|
||||
:type 'string)
|
||||
|
||||
(defun org-babel-execute:lua (body params)
|
||||
"Execute Lua BODY according to PARAMS.
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
|
@ -251,41 +257,47 @@ function main()
|
|||
%s
|
||||
end
|
||||
|
||||
fd=io.open(\"%s\", \"w\")
|
||||
fd:write( main() )
|
||||
fd:close()")
|
||||
(defvar org-babel-lua-pp-wrapper-method
|
||||
"
|
||||
-- table to string
|
||||
function t2s(t, indent)
|
||||
function dump(it, indent)
|
||||
if indent == nil then
|
||||
indent = \"\"
|
||||
indent = ''
|
||||
end
|
||||
if type(t) == \"table\" then
|
||||
ts = \"\"
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == \"table\" then
|
||||
ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \\n\" ..
|
||||
t2s(v, indent .. \" \")
|
||||
else
|
||||
ts = ts .. indent .. t2s(k,indent .. \" \") .. \" = \" ..
|
||||
t2s(v, indent .. \" \") .. \"\\n\"
|
||||
if type(it) == 'table' and %s then
|
||||
local count = 0
|
||||
for _ in pairs(it) do
|
||||
count = count + 1
|
||||
end
|
||||
local result = ''
|
||||
if #indent ~= 0 then
|
||||
result = result .. '\\n'
|
||||
end
|
||||
for key, value in pairs(it) do
|
||||
result = result
|
||||
.. indent
|
||||
.. dump(key)
|
||||
.. ' = '
|
||||
.. dump(value, indent .. ' ')
|
||||
count = count - 1
|
||||
if count ~= 0 then
|
||||
result = result .. '\\n'
|
||||
end
|
||||
end
|
||||
return ts
|
||||
return result
|
||||
else
|
||||
return tostring(t)
|
||||
return tostring(it)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function main()
|
||||
%s
|
||||
function combine(...)
|
||||
local result = {}
|
||||
for index = 1, select('#', ...) do
|
||||
result[index] = dump(select(index, ...))
|
||||
end
|
||||
return table.concat(result, '%s')
|
||||
end
|
||||
|
||||
fd=io.open(\"%s\", \"w\")
|
||||
fd:write(t2s(main()))
|
||||
fd:close()")
|
||||
output = io.open('%s', 'w')
|
||||
output:write(combine(main()))
|
||||
output:close()")
|
||||
|
||||
(defun org-babel-lua-evaluate
|
||||
(session body &optional result-type result-params preamble)
|
||||
|
@ -319,15 +331,17 @@ PREAMBLE string is appended to BODY."
|
|||
(concat
|
||||
preamble (and preamble "\n")
|
||||
(format
|
||||
(if (member "pp" result-params)
|
||||
org-babel-lua-pp-wrapper-method
|
||||
org-babel-lua-wrapper-method)
|
||||
org-babel-lua-wrapper-method
|
||||
(mapconcat
|
||||
(lambda (line) (format "\t%s" line))
|
||||
(split-string
|
||||
(org-remove-indentation
|
||||
(org-trim body))
|
||||
"[\r\n]") "\n")
|
||||
"[\r\n]")
|
||||
"\n")
|
||||
(if (member "pp" result-params)
|
||||
"true" "false")
|
||||
org-babel-lua-multiple-values-separator
|
||||
(org-babel-process-file-name tmp-file 'noquote))))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(org-babel-result-cond result-params
|
||||
|
|
|
@ -137,13 +137,13 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(let* ((cmdline (or (cdr (assq :cmdline params)) ""))
|
||||
(batch/load (or (cdr (assq :batch params)) "batchload"))
|
||||
(cmdline (if (or (equal cmdline "") (equal batch/load "batchload"))
|
||||
;; legacy behaviour:
|
||||
;; legacy behavior:
|
||||
;; ensure that --very-quiet is on command-line by default
|
||||
(concat cmdline " " org-babel-maxima--command-arguments-default)
|
||||
;; if using an alternate loader, :cmdline overwrites default
|
||||
cmdline))
|
||||
(in-file (org-babel-temp-file "maxima-" ".max"))
|
||||
(cmd (format "%s -r %s %s"
|
||||
(cmd (format "%s -r %s %s"
|
||||
org-babel-maxima-command
|
||||
(shell-quote-argument
|
||||
;; bind linenum to 0 so the first line
|
||||
|
|
|
@ -230,7 +230,7 @@ convert them into an Emacs-lisp table. Otherwise return the
|
|||
results as a string."
|
||||
(let ((res (if (and (> (length results) 0)
|
||||
(string-equal "{" (substring results 0 1)))
|
||||
results ;don't covert dicts to elisp
|
||||
results ;don't convert dicts to elisp
|
||||
(org-babel-script-escape results))))
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (eq el 'None)
|
||||
|
|
|
@ -182,46 +182,51 @@ is true; otherwise returns the last value."
|
|||
(with-temp-buffer
|
||||
(insert (format ";; -*- geiser-scheme-implementation: %s -*-" impl))
|
||||
(newline)
|
||||
(insert code)
|
||||
(geiser-mode)
|
||||
(let ((geiser-repl-window-allow-split nil)
|
||||
(geiser-repl-use-other-window nil))
|
||||
(let ((repl-buffer (save-current-buffer
|
||||
(org-babel-scheme-get-repl impl repl host port))))
|
||||
(when (not (eq impl (org-babel-scheme-get-buffer-impl
|
||||
(let ((beg (point)))
|
||||
(insert code)
|
||||
(geiser-mode)
|
||||
(let ((geiser-repl-window-allow-split nil)
|
||||
(geiser-repl-use-other-window nil))
|
||||
(let ((repl-buffer (save-current-buffer
|
||||
(org-babel-scheme-get-repl impl repl host port))))
|
||||
(when (not (eq impl (org-babel-scheme-get-buffer-impl
|
||||
(current-buffer))))
|
||||
(message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
|
||||
(org-babel-scheme-get-buffer-impl (current-buffer))
|
||||
(symbolp (org-babel-scheme-get-buffer-impl
|
||||
(current-buffer)))))
|
||||
(setq geiser-repl--repl repl-buffer)
|
||||
(setq geiser-impl--implementation nil)
|
||||
(let ((geiser-debug-jump-to-debug-p nil)
|
||||
(geiser-debug-show-debug-p nil))
|
||||
;; `geiser-eval-region/wait' was introduced to await the
|
||||
;; result of async evaluation in geiser version 0.22.
|
||||
(let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
|
||||
#'geiser-eval-region/wait
|
||||
#'geiser-eval-region)
|
||||
(point-min)
|
||||
(point-max))))
|
||||
(let ((err (geiser-eval--retort-error ret)))
|
||||
(setq result (cond
|
||||
(output
|
||||
(or (geiser-eval--retort-output ret)
|
||||
"Geiser Interpreter produced no output"))
|
||||
(err nil)
|
||||
(t (geiser-eval--retort-result-str ret ""))))
|
||||
(when (not repl)
|
||||
(save-current-buffer (set-buffer repl-buffer)
|
||||
(geiser-repl-exit))
|
||||
(set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)
|
||||
(kill-buffer repl-buffer))
|
||||
(when err
|
||||
(let ((msg (geiser-eval--error-msg err)))
|
||||
(org-babel-eval-error-notify
|
||||
nil
|
||||
(concat (if (listp msg) (car msg) msg) "\n"))))))))))
|
||||
(message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
|
||||
(org-babel-scheme-get-buffer-impl (current-buffer))
|
||||
(symbolp (org-babel-scheme-get-buffer-impl
|
||||
(current-buffer)))))
|
||||
(setq geiser-repl--repl repl-buffer)
|
||||
(setq geiser-impl--implementation nil)
|
||||
(let ((geiser-debug-jump-to-debug-p nil)
|
||||
(geiser-debug-show-debug-p nil))
|
||||
;; `geiser-eval-region/wait' was introduced to await the
|
||||
;; result of async evaluation in geiser version 0.22.
|
||||
(let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
|
||||
#'geiser-eval-region/wait
|
||||
#'geiser-eval-region)
|
||||
;; Do not include top comment into evaluation.
|
||||
;; Apparently, mit-scheme has
|
||||
;; problems with the top comment we add:
|
||||
;; "Unexpected read restart on: #[textual-i/o-port 27 for console]"
|
||||
beg
|
||||
(point-max))))
|
||||
(let ((err (geiser-eval--retort-error ret)))
|
||||
(setq result (cond
|
||||
(output
|
||||
(or (geiser-eval--retort-output ret)
|
||||
"Geiser Interpreter produced no output"))
|
||||
(err nil)
|
||||
(t (geiser-eval--retort-result-str ret ""))))
|
||||
(when (not repl)
|
||||
(save-current-buffer (set-buffer repl-buffer)
|
||||
(geiser-repl-exit))
|
||||
(set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)
|
||||
(kill-buffer repl-buffer))
|
||||
(when err
|
||||
(let ((msg (geiser-eval--error-msg err)))
|
||||
(org-babel-eval-error-notify
|
||||
nil
|
||||
(concat (if (listp msg) (car msg) msg) "\n")))))))))))
|
||||
result))
|
||||
|
||||
(defun org-babel-scheme--table-or-string (results)
|
||||
|
|
|
@ -117,23 +117,27 @@ corresponding :engine source block header argument."
|
|||
|
||||
(defun org-babel-sql-dbstring-mysql (host port user password database)
|
||||
"Make MySQL cmd line args for database connection. Pass nil to omit that arg."
|
||||
(combine-and-quote-strings
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil
|
||||
(list (when host (concat "-h" host))
|
||||
(list (when host (concat "-h" (shell-quote-argument host)))
|
||||
(when port (format "-P%d" port))
|
||||
(when user (concat "-u" user))
|
||||
(when password (concat "-p" password))
|
||||
(when database (concat "-D" database))))))
|
||||
(when user (concat "-u" (shell-quote-argument user)))
|
||||
(when password (concat "-p" (shell-quote-argument password)))
|
||||
(when database (concat "-D" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-dbstring-postgresql (host port user database)
|
||||
"Make PostgreSQL command line args for database connection.
|
||||
Pass nil to omit that arg."
|
||||
(combine-and-quote-strings
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil
|
||||
(list (when host (concat "-h" host))
|
||||
(list (when host (concat "-h" (shell-quote-argument host)))
|
||||
(when port (format "-p%d" port))
|
||||
(when user (concat "-U" user))
|
||||
(when database (concat "-d" database))))))
|
||||
(when user (concat "-U" (shell-quote-argument user)))
|
||||
(when database (concat "-d" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-dbstring-oracle (host port user password database)
|
||||
"Make Oracle command line arguments for database connection.
|
||||
|
@ -149,8 +153,12 @@ or
|
|||
<user>/<password>@<database>
|
||||
|
||||
using its alias."
|
||||
(when user (setq user (shell-quote-argument user)))
|
||||
(when password (setq password (shell-quote-argument password)))
|
||||
(when database (setq database (shell-quote-argument database)))
|
||||
(when host (setq host (shell-quote-argument host)))
|
||||
(cond ((and user password database host port)
|
||||
(format "%s/%s@%s:%s/%s" user password host port database))
|
||||
(format "%s/%s@%s:%d/%s" user password host port database))
|
||||
((and user password database)
|
||||
(format "%s/%s@%s" user password database))
|
||||
(t (user-error "Missing information to connect to database"))))
|
||||
|
@ -161,10 +169,10 @@ using its alias."
|
|||
SQL Server on Windows and Linux platform."
|
||||
(mapconcat #'identity
|
||||
(delq nil
|
||||
(list (when host (format "-S \"%s\"" host))
|
||||
(when user (format "-U \"%s\"" user))
|
||||
(when password (format "-P \"%s\"" password))
|
||||
(when database (format "-d \"%s\"" database))))
|
||||
(list (when host (format "-S \"%s\"" (shell-quote-argument host)))
|
||||
(when user (format "-U \"%s\"" (shell-quote-argument user)))
|
||||
(when password (format "-P \"%s\"" (shell-quote-argument password)))
|
||||
(when database (format "-d \"%s\"" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-dbstring-sqsh (host user password database)
|
||||
|
@ -172,10 +180,10 @@ SQL Server on Windows and Linux platform."
|
|||
\"sqsh\" is one method to access Sybase or MS SQL via Linux platform"
|
||||
(mapconcat #'identity
|
||||
(delq nil
|
||||
(list (when host (format "-S \"%s\"" host))
|
||||
(when user (format "-U \"%s\"" user))
|
||||
(when password (format "-P \"%s\"" password))
|
||||
(when database (format "-D \"%s\"" database))))
|
||||
(list (when host (format "-S \"%s\"" (shell-quote-argument host)))
|
||||
(when user (format "-U \"%s\"" (shell-quote-argument user)))
|
||||
(when password (format "-P \"%s\"" (shell-quote-argument password)))
|
||||
(when database (format "-D \"%s\"" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-dbstring-vertica (host port user password database)
|
||||
|
@ -183,11 +191,11 @@ SQL Server on Windows and Linux platform."
|
|||
Pass nil to omit that arg."
|
||||
(mapconcat #'identity
|
||||
(delq nil
|
||||
(list (when host (format "-h %s" host))
|
||||
(list (when host (format "-h %s" (shell-quote-argument host)))
|
||||
(when port (format "-p %d" port))
|
||||
(when user (format "-U %s" user))
|
||||
(when user (format "-U %s" (shell-quote-argument user)))
|
||||
(when password (format "-w %s" (shell-quote-argument password) ))
|
||||
(when database (format "-d %s" database))))
|
||||
(when database (format "-d %s" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-dbstring-saphana (host port instance user password database)
|
||||
|
@ -195,13 +203,15 @@ Pass nil to omit that arg."
|
|||
Pass nil to omit that arg."
|
||||
(mapconcat #'identity
|
||||
(delq nil
|
||||
(list (and host port (format "-n %s:%s" host port))
|
||||
(and host (not port) (format "-n %s" host))
|
||||
(list (and host port (format "-n %s:%s"
|
||||
(shell-quote-argument host)
|
||||
port))
|
||||
(and host (not port) (format "-n %s" (shell-quote-argument host)))
|
||||
(and instance (format "-i %d" instance))
|
||||
(and user (format "-u %s" user))
|
||||
(and user (format "-u %s" (shell-quote-argument user)))
|
||||
(and password (format "-p %s"
|
||||
(shell-quote-argument password)))
|
||||
(and database (format "-d %s" database))))
|
||||
(and database (format "-d %s" (shell-quote-argument database)))))
|
||||
" "))
|
||||
|
||||
(defun org-babel-sql-convert-standard-filename (file)
|
||||
|
@ -276,21 +286,23 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(or cmdline "")
|
||||
(org-babel-process-file-name in-file)
|
||||
(org-babel-process-file-name out-file)))
|
||||
((postgresql postgres) (format
|
||||
"%s%s --set=\"ON_ERROR_STOP=1\" %s -A -P \
|
||||
((postgresql postgres)
|
||||
(format
|
||||
"%s%s --set=\"ON_ERROR_STOP=1\" %s -A -P \
|
||||
footer=off -F \"\t\" %s -f %s -o %s %s"
|
||||
(if dbpassword
|
||||
(format "PGPASSWORD=%s " dbpassword)
|
||||
"")
|
||||
(or (bound-and-true-p
|
||||
sql-postgres-program)
|
||||
"psql")
|
||||
(if colnames-p "" "-t")
|
||||
(org-babel-sql-dbstring-postgresql
|
||||
dbhost dbport dbuser database)
|
||||
(org-babel-process-file-name in-file)
|
||||
(org-babel-process-file-name out-file)
|
||||
(or cmdline "")))
|
||||
(if dbpassword
|
||||
(format "PGPASSWORD=%s "
|
||||
(shell-quote-argument dbpassword))
|
||||
"")
|
||||
(or (bound-and-true-p
|
||||
sql-postgres-program)
|
||||
"psql")
|
||||
(if colnames-p "" "-t")
|
||||
(org-babel-sql-dbstring-postgresql
|
||||
dbhost dbport dbuser database)
|
||||
(org-babel-process-file-name in-file)
|
||||
(org-babel-process-file-name out-file)
|
||||
(or cmdline "")))
|
||||
(sqsh (format "sqsh %s %s -i %s -o %s -m csv"
|
||||
(or cmdline "")
|
||||
(org-babel-sql-dbstring-sqsh
|
||||
|
|
|
@ -392,7 +392,7 @@ Did you give the decimal value %1$d by mistake?" mode)))
|
|||
(error "File mode %S not recognized as a valid format." mode))
|
||||
((string-match-p "^o0?[0-7][0-7][0-7]$" mode)
|
||||
(string-to-number (replace-regexp-in-string "^o" "" mode) 8))
|
||||
((string-match-p "^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" mode)
|
||||
((string-match-p "^[ugoa]*\\(?:[+=-][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+=-][rwxXstugo]*\\)+\\)*$" mode)
|
||||
;; Match regexp taken from `file-modes-symbolic-to-number'.
|
||||
(file-modes-symbolic-to-number mode org-babel-tangle-default-file-mode))
|
||||
((string-match-p "^[r-][w-][xs-][r-][w-][xs-][r-][w-][x-]$" mode)
|
||||
|
|
|
@ -680,7 +680,7 @@ INFO is the export state as a property list."
|
|||
INFO is the export state, as a property list."
|
||||
(and field
|
||||
(lambda (a b)
|
||||
(string-collate-lessp
|
||||
(org-string<
|
||||
(org-cite-basic--get-field field a info 'raw)
|
||||
(org-cite-basic--get-field field b info 'raw)
|
||||
nil t))))
|
||||
|
|
|
@ -190,20 +190,23 @@ INITIAL is an initial style of comma-separated options, as a string or nil.
|
|||
STYLE is the style definition as a string or nil.
|
||||
|
||||
Return a string."
|
||||
(let ((options-no-style
|
||||
(and initial
|
||||
(let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
|
||||
(seq-filter
|
||||
(lambda (option) (not (string-match re option)))
|
||||
(split-string (org-unbracket-string "[" "]" initial)
|
||||
"," t " \t")))))
|
||||
(style-options
|
||||
(cond
|
||||
((null style) nil)
|
||||
((not (string-match "/" style)) (list (concat "style=" style)))
|
||||
(t
|
||||
(list (concat "bibstyle=" (substring style nil (match-beginning 0)))
|
||||
(concat "citestyle=" (substring style (match-end 0))))))))
|
||||
(let* ((options-no-style
|
||||
(and initial
|
||||
(let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
|
||||
(seq-filter
|
||||
(lambda (option) (not (string-match re option)))
|
||||
(split-string (org-unbracket-string "[" "]" initial)
|
||||
"," t " \t")))))
|
||||
;; Check whether the string is in key=val,...
|
||||
(biblatex-options-p (and (stringp style) (string-match-p "\\`[^,=]+=[^,]+\\(,[^=]+=[^,]+\\)\\'" style)))
|
||||
(style-options
|
||||
(cond
|
||||
((null style) nil)
|
||||
;; Assume it is a valid options string for biblatex if it is in key=val,... format
|
||||
((not (string-match "/" style)) (list (if biblatex-options-p style (concat "style=" style))))
|
||||
(t
|
||||
(list (concat "bibstyle=" (substring style nil (match-beginning 0)))
|
||||
(concat "citestyle=" (substring style (match-end 0))))))))
|
||||
(if (or options-no-style style-options)
|
||||
(format "[%s]"
|
||||
(mapconcat #'identity
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
(declare-function citeproc-render-bib "ext:citeproc")
|
||||
(declare-function citeproc-hash-itemgetter-from-any "ext:citeproc")
|
||||
(declare-function citeproc-add-subbib-filters "ext:citeproc")
|
||||
(declare-function citeproc-style-cite-superscript-p "ext:citeproc")
|
||||
|
||||
(declare-function org-element-interpret-data "org-element" (data))
|
||||
(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated))
|
||||
|
@ -422,11 +423,6 @@ Label is in match group 1.")
|
|||
|
||||
|
||||
;;; Internal functions
|
||||
;; FIXME: We use `org-require-package' in other places.
|
||||
(defun org-cite-csl--barf-without-citeproc ()
|
||||
"Raise an error if Citeproc library is not loaded."
|
||||
(unless (featurep 'citeproc)
|
||||
(error "Citeproc library is not loaded")))
|
||||
|
||||
(defun org-cite-csl--note-style-p (info)
|
||||
"Non-nil when bibliography style implies wrapping citations in footnotes.
|
||||
|
@ -435,6 +431,13 @@ INFO is the export state, as a property list."
|
|||
(citeproc-proc-style
|
||||
(org-cite-csl--processor info))))
|
||||
|
||||
(defun org-cite-csl--style-cite-superscript-p (info)
|
||||
"Non-nil when bibliography style produces citations in superscript.
|
||||
INFO is the export state, as a property list."
|
||||
(citeproc-style-cite-superscript-p
|
||||
(citeproc-proc-style
|
||||
(org-cite-csl--processor info))))
|
||||
|
||||
(defun org-cite-csl--nocite-p (citation info)
|
||||
"Non-nil when CITATION object's style is nocite.
|
||||
INFO is the export state, as a property list."
|
||||
|
@ -681,6 +684,9 @@ INFO is the export state, as a property list."
|
|||
(when (and (not footnote) (org-cite-csl--note-style-p info))
|
||||
(org-cite-adjust-note citation info)
|
||||
(setq footnote (org-cite-wrap-citation citation info)))
|
||||
;; Remove white space before CITATION when it is in superscript.
|
||||
(when (org-cite-csl--style-cite-superscript-p info)
|
||||
(org-cite--set-previous-post-blank citation 0 info))
|
||||
;; Return structure.
|
||||
(apply #'citeproc-citation-create
|
||||
`(:note-index
|
||||
|
@ -802,7 +808,7 @@ INFO is the export state, as a property list."
|
|||
(defun org-cite-csl-render-citation (citation _style _backend info)
|
||||
"Export CITATION object.
|
||||
INFO is the export state, as a property list."
|
||||
(org-cite-csl--barf-without-citeproc)
|
||||
(org-require-package 'citeproc)
|
||||
(let ((output (cdr (assq citation (org-cite-csl--rendered-citations info)))))
|
||||
(if (not (eq 'org (org-cite-csl--output-format info)))
|
||||
output
|
||||
|
@ -813,7 +819,7 @@ INFO is the export state, as a property list."
|
|||
(defun org-cite-csl-render-bibliography (_keys _files _style props _backend info)
|
||||
"Export bibliography.
|
||||
INFO is the export state, as a property list."
|
||||
(org-cite-csl--barf-without-citeproc)
|
||||
(org-require-package 'citeproc)
|
||||
(pcase-let* ((format (org-cite-csl--output-format info))
|
||||
(`(,outputs ,parameters) (org-cite-csl--rendered-bibliographies info))
|
||||
(output (cdr (assoc props outputs))))
|
||||
|
@ -851,7 +857,7 @@ INFO is the export state, as a property list."
|
|||
"Add \"hanging\" package if missing from LaTeX output.
|
||||
OUTPUT is the export document, as a string. INFO is the export state, as a
|
||||
property list."
|
||||
(org-cite-csl--barf-without-citeproc)
|
||||
(org-require-package 'citeproc)
|
||||
(if (not (eq 'org-latex (org-cite-csl--output-format info)))
|
||||
output
|
||||
(with-temp-buffer
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Authors: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
;; Authors: Bastien Guerry <bzg@gnu.org>
|
||||
;; Carsten Dominik <carsten dot dominik at gmail dot com>
|
||||
;; Eric Schulte <schulte dot eric at gmail dot com>
|
||||
;; Keywords: org, wp, capture
|
||||
;; Keywords: org, text, capture
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
;;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Jan Böcker <jan.boecker at jboecker dot de>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Tassilo Horn <tassilo at member dot fsf dot org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2020-2024 Free Software Foundation, Inc.
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Maintainer: Bastien Guerry <bzg@gnu.org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
133
lisp/ol.el
133
lisp/ol.el
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2018-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -206,7 +206,7 @@ This function is intended to be used as a :set function."
|
|||
(set symbol value)
|
||||
(dolist (buf (org-buffer-list))
|
||||
(with-current-buffer buf
|
||||
(org-link-descriptive-ensure))))
|
||||
(org-restart-font-lock))))
|
||||
|
||||
(defcustom org-link-descriptive t
|
||||
"Non-nil means Org displays descriptive links.
|
||||
|
@ -369,7 +369,7 @@ another window."
|
|||
(const wl-other-frame)))))
|
||||
|
||||
(defcustom org-link-search-must-match-exact-headline 'query-to-create
|
||||
"Control fuzzy link behaviour when specific matches not found.
|
||||
"Control fuzzy link behavior when specific matches not found.
|
||||
|
||||
When nil, if a fuzzy link does not match a more specific
|
||||
target (such as a heading, named block, target, or code ref),
|
||||
|
@ -378,7 +378,7 @@ attempt a regular text search. When set to the special value
|
|||
link instead. Otherwise, signal an error rather than attempting
|
||||
a regular text search.
|
||||
|
||||
This option only affects behaviour in Org buffers. Spaces and
|
||||
This option only affects behavior in Org buffers. Spaces and
|
||||
statistics cookies are ignored during heading searches."
|
||||
:group 'org-link-follow
|
||||
:version "24.1"
|
||||
|
@ -590,9 +590,9 @@ taken to make the search successful, another function should be
|
|||
added to the companion hook `org-execute-file-search-functions',
|
||||
which see.
|
||||
|
||||
A function in this hook may also use `setq' to set the variable
|
||||
`description' to provide a suggestion for the descriptive text to
|
||||
be used for this link when it gets inserted into an Org buffer
|
||||
A function in this hook may also use `org-link-store-props' and set
|
||||
`:description' property to provide a suggestion for the descriptive
|
||||
text to be used for this link when it gets inserted into an Org buffer
|
||||
with \\[org-insert-link].")
|
||||
|
||||
(defvar org-execute-file-search-functions nil
|
||||
|
@ -649,22 +649,6 @@ exact and fuzzy text search.")
|
|||
(defvar org-link--search-failed nil
|
||||
"Non-nil when last link search failed.")
|
||||
|
||||
|
||||
(defvar-local org-link--link-folding-spec '(org-link
|
||||
(:global t)
|
||||
(:ellipsis . nil)
|
||||
(:isearch-open . t)
|
||||
(:fragile . org-link--reveal-maybe))
|
||||
"Folding spec used to hide invisible parts of links.")
|
||||
|
||||
(defvar-local org-link--description-folding-spec '(org-link-description
|
||||
(:global t)
|
||||
(:ellipsis . nil)
|
||||
(:visible . t)
|
||||
(:isearch-open . nil)
|
||||
(:fragile . org-link--reveal-maybe))
|
||||
"Folding spec used to reveal link description.")
|
||||
|
||||
|
||||
;;; Internal Functions
|
||||
|
||||
|
@ -1134,12 +1118,12 @@ The functions are defined in the `:store' property of
|
|||
INTERACTIVE? which indicates whether the user has initiated
|
||||
`org-store-link' interactively.
|
||||
|
||||
Each function will be called in turn until one returns a non-nil
|
||||
value. Each function should check if it is responsible for
|
||||
creating this link (for example by looking at the major mode).
|
||||
If not, it must exit and return nil. If yes, it should return
|
||||
a non-nil value after calling `org-link-store-props' with a list
|
||||
of properties and values. Special properties are:
|
||||
Each function will be called in turn with a single argument
|
||||
INTERACTIVE? - non-nil when user interaction is allowed. Each function
|
||||
should check if it is responsible for creating this link (for example
|
||||
by looking at the major mode). If not, it must return nil. If yes,
|
||||
it should return a non-nil value after calling `org-link-store-props'
|
||||
with a list of properties and values. Special properties are:
|
||||
|
||||
:type The link prefix, like \"http\". This must be given.
|
||||
:link The link, like \"http://www.astro.uva.nl/~dominik\".
|
||||
|
@ -1598,6 +1582,52 @@ PATH is a symbol name, as a string."
|
|||
:follow #'org-link--open-help
|
||||
:store #'org-link--store-help)
|
||||
|
||||
(defvar shortdoc--groups)
|
||||
(declare-function shortdoc-display-group "shortdoc"
|
||||
(group &optional function same-window))
|
||||
(defun org-link--open-shortdoc (path _)
|
||||
"Open a \"shortdoc\" type link.
|
||||
PATH is a group name, \"group::#function\" or \"group::search
|
||||
string\"."
|
||||
(string-match "\\`\\([^:]*\\)\\(?:::\\(.*\\)\\'\\)?" path)
|
||||
(let* ((group (match-string 1 path))
|
||||
(str (match-string 2 path))
|
||||
(fn (and str
|
||||
(eq ?# (string-to-char str))
|
||||
(intern-soft (substring str 1)))))
|
||||
(condition-case nil
|
||||
(progn
|
||||
(shortdoc-display-group group fn)
|
||||
(and str (not fn) (search-forward str nil t)))
|
||||
(error (user-error "Unknown shortdoc group or malformed link: `%s'"
|
||||
path)))))
|
||||
|
||||
(defun org-link--store-shortdoc (&optional _interactive?)
|
||||
"Store \"shortdoc\" type link."
|
||||
(when (derived-mode-p 'shortdoc-mode)
|
||||
(let* ((buffer (buffer-name))
|
||||
(group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer)
|
||||
(match-string 1 buffer))))
|
||||
(if (and group (assoc (intern-soft group) shortdoc--groups))
|
||||
(org-link-store-props :type "shortdoc"
|
||||
:link (format "shortdoc:%s" group)
|
||||
:description nil)
|
||||
(user-error "Unknown shortdoc group: %s" group)))))
|
||||
|
||||
(defun org-link--complete-shortdoc ()
|
||||
"Create a \"shortdoc\" link using completion."
|
||||
(concat "shortdoc:"
|
||||
(completing-read "Shortdoc summary for functions in: "
|
||||
(mapcar #'car shortdoc--groups))))
|
||||
|
||||
;; FIXME: Remove the condition when we drop Emacs 27 support.
|
||||
;;;; "shortdoc" link type
|
||||
(when (version<= "28.0.90" emacs-version)
|
||||
(org-link-set-parameters "shortdoc"
|
||||
:follow #'org-link--open-shortdoc
|
||||
:store #'org-link--store-shortdoc
|
||||
:complete #'org-link--complete-shortdoc))
|
||||
|
||||
;;;; "http", "https", "mailto", "ftp", and "news" link types
|
||||
(dolist (scheme '("ftp" "http" "https" "mailto" "news"))
|
||||
(org-link-set-parameters scheme
|
||||
|
@ -1679,18 +1709,12 @@ If the link is in hidden text, expose it."
|
|||
(interactive)
|
||||
(org-next-link t))
|
||||
|
||||
(defun org-link-descriptive-ensure ()
|
||||
"Toggle the literal or descriptive display of links in current buffer if needed."
|
||||
(org-fold-core-set-folding-spec-property
|
||||
(car org-link--link-folding-spec)
|
||||
:visible (not org-link-descriptive)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-toggle-link-display ()
|
||||
"Toggle the literal or descriptive display of links in current buffer."
|
||||
(interactive)
|
||||
(setq org-link-descriptive (not org-link-descriptive))
|
||||
(org-link-descriptive-ensure))
|
||||
(org-restart-font-lock))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-store-link (arg &optional interactive?)
|
||||
|
@ -1738,7 +1762,7 @@ NAME."
|
|||
;; Negate `org-context-in-file-links' when given a single universal arg.
|
||||
(let ((org-link-context-for-files (org-xor org-link-context-for-files
|
||||
(equal arg '(4))))
|
||||
link cpltxt desc search agenda-link) ;; description
|
||||
link desc search agenda-link) ;; description
|
||||
(cond
|
||||
;; Store a link using an external link type, if any function is
|
||||
;; available, unless external link types are skipped for this
|
||||
|
@ -1809,9 +1833,8 @@ NAME."
|
|||
|
||||
;; Image mode
|
||||
((eq major-mode 'image-mode)
|
||||
(setq cpltxt (concat "file:"
|
||||
(abbreviate-file-name buffer-file-name))
|
||||
link cpltxt)
|
||||
(setq link (concat "file:"
|
||||
(abbreviate-file-name buffer-file-name)))
|
||||
(org-link-store-props :type "image" :file buffer-file-name))
|
||||
|
||||
;; In dired, store a link to the file of the current line
|
||||
|
@ -1822,20 +1845,16 @@ NAME."
|
|||
(expand-file-name (dired-get-filename nil t)))
|
||||
;; Otherwise, no file so use current directory.
|
||||
default-directory))
|
||||
(setq cpltxt (concat "file:" file)
|
||||
link cpltxt)))
|
||||
(setq link (concat "file:" file))))
|
||||
|
||||
;; Try `org-create-file-search-functions`. If any are
|
||||
;; successful, create a file link to the current buffer with
|
||||
;; the provided search string. (sets `link` and `cpltxt` to
|
||||
;; the same thing; it looks like the intention originally was
|
||||
;; that cpltxt was a description, which might have been set by
|
||||
;; the search-function (removed in switch to lexical binding)).
|
||||
;; the provided search string.
|
||||
((setq search (run-hook-with-args-until-success
|
||||
'org-create-file-search-functions))
|
||||
(setq link (concat "file:" (abbreviate-file-name buffer-file-name)
|
||||
"::" search))
|
||||
(setq cpltxt (or link))) ;; description
|
||||
"::" search)
|
||||
desc (plist-get org-store-link-plist :description)))
|
||||
|
||||
;; Main logic for storing built-in link types in org-mode
|
||||
;; buffers
|
||||
|
@ -1853,22 +1872,19 @@ NAME."
|
|||
;; Avoid [[target][file:~/org/test.org::target]]
|
||||
;; links. Maybe the case of identical target and
|
||||
;; description should be handled by `org-insert-link'.
|
||||
cpltxt nil
|
||||
desc nil))
|
||||
(t
|
||||
;; Just link to current headline.
|
||||
(let ((here (org-link--file-link-to-here)))
|
||||
(setq cpltxt (car here))
|
||||
(setq desc (cdr here)))
|
||||
(setq link cpltxt)))))
|
||||
(setq link (car here))
|
||||
(setq desc (cdr here)))))))
|
||||
|
||||
;; Buffer linked to file, but not an org-mode buffer.
|
||||
((buffer-file-name (buffer-base-buffer))
|
||||
;; Just link to this file here.
|
||||
(let ((here (org-link--file-link-to-here)))
|
||||
(setq cpltxt (car here))
|
||||
(setq desc (cdr here)))
|
||||
(setq link cpltxt))
|
||||
(setq link (car here))
|
||||
(setq desc (cdr here))))
|
||||
|
||||
(interactive?
|
||||
(user-error "No method for storing a link from this buffer"))
|
||||
|
@ -1876,8 +1892,7 @@ NAME."
|
|||
(t (setq link nil)))
|
||||
|
||||
;; We're done setting link and desc, clean up
|
||||
(when (consp link) (setq cpltxt (car link) link (cdr link)))
|
||||
(setq link (or link cpltxt))
|
||||
(when (consp link) (setq link (or (cdr link) (car link))))
|
||||
(cond ((not desc))
|
||||
((equal desc "NONE") (setq desc nil))
|
||||
(t (setq desc (org-link-display-format desc))))
|
||||
|
@ -1943,7 +1958,7 @@ generate a description as described in `org-link-parameters'
|
|||
docstring. Otherwise, if `org-link-make-description-function' is
|
||||
non-nil, this function will be called with the link target, and
|
||||
the result will be the default link description. When called
|
||||
non-interactively, don't allow to edit the default description."
|
||||
non-interactively, don't allow editing the default description."
|
||||
(interactive "P")
|
||||
(let* ((wcf (current-window-configuration))
|
||||
(origbuf (current-buffer))
|
||||
|
@ -2232,7 +2247,7 @@ Also refresh fontification if needed."
|
|||
(interactive)
|
||||
(let ((old-regexp org-target-link-regexp)
|
||||
;; Some languages, e.g., Chinese, do not use spaces to
|
||||
;; separate words. Also allow to surround radio targets with
|
||||
;; separate words. Also allow surrounding radio targets with
|
||||
;; line-breakable characters.
|
||||
(before-re "\\(?:^\\|[^[:alnum:]]\\|\\c|\\)\\(")
|
||||
(after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\c|\\)")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -900,7 +900,8 @@ but not scheduled today."
|
|||
:type '(choice
|
||||
(const :tag "Never" nil)
|
||||
(const :tag "Always" t)
|
||||
(const :tag "Not when scheduled today" not-today)))
|
||||
(const :tag "Not when scheduled today" not-today))
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defcustom org-agenda-skip-timestamp-if-deadline-is-shown nil
|
||||
"Non-nil means skip timestamp line if same entry shows because of deadline.
|
||||
|
@ -1701,7 +1702,8 @@ Custom commands can bind this variable in the options section."
|
|||
(cons (const :tag "Strategy for Tags matches" tags)
|
||||
(repeat ,org-sorting-choice))
|
||||
(cons (const :tag "Strategy for search matches" search)
|
||||
(repeat ,org-sorting-choice)))))
|
||||
(repeat ,org-sorting-choice))))
|
||||
:package-version '(Org . "9.7"))
|
||||
|
||||
(defcustom org-agenda-cmp-user-defined nil
|
||||
"A function to define the comparison `user-defined'.
|
||||
|
@ -2385,8 +2387,7 @@ The following commands are available:
|
|||
org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode
|
||||
org-agenda-archives-mode org-agenda-start-with-archives-mode))
|
||||
(add-to-invisibility-spec '(org-filtered))
|
||||
(org-fold-core-initialize `(,org-link--description-folding-spec
|
||||
,org-link--link-folding-spec))
|
||||
(add-to-invisibility-spec '(org-link))
|
||||
(easy-menu-change
|
||||
'("Agenda") "Agenda Files"
|
||||
(append
|
||||
|
@ -3040,7 +3041,7 @@ Pressing `<' twice means to restrict to the current subtree or region
|
|||
(`todo-tree
|
||||
(org-check-for-org-mode)
|
||||
(org-occur (concat "^" org-outline-regexp "[ \t]*"
|
||||
(regexp-quote org-match) "\\>")))
|
||||
(regexp-quote org-match) "\\(?:[\t ]\\|$\\)")))
|
||||
(`occur-tree
|
||||
(org-check-for-org-mode)
|
||||
(org-occur org-match))
|
||||
|
@ -3899,7 +3900,7 @@ generating a new one."
|
|||
;; buffer found
|
||||
(get-buffer org-agenda-buffer-name)
|
||||
;; C-u parameter is same as last call
|
||||
(with-current-buffer (get-buffer org-agenda-buffer-name)
|
||||
(with-current-buffer org-agenda-buffer-name
|
||||
(and
|
||||
(equal current-prefix-arg
|
||||
org-agenda-last-prefix-arg)
|
||||
|
@ -5311,8 +5312,8 @@ of what a project is and how to check if it stuck, customize the variable
|
|||
(org-delete-all org-done-keywords-for-agenda
|
||||
(copy-sequence org-todo-keywords-for-agenda))))
|
||||
(todo-re (and todo
|
||||
(format "^\\*+[ \t]+\\(%s\\)\\>"
|
||||
(mapconcat #'identity todo-wds "\\|"))))
|
||||
(format "^\\*+[ \t]+\\(%s\\)\\(?:[ \t]\\|$\\)"
|
||||
(mapconcat #'regexp-quote todo-wds "\\|"))))
|
||||
(tags-re (cond ((null tags) nil)
|
||||
((member "*" tags) org-tag-line-re)
|
||||
(tags
|
||||
|
@ -5833,7 +5834,7 @@ displayed in agenda view."
|
|||
(org-encode-time ; DATE bound by calendar
|
||||
0 0 0 (nth 1 date) (car date) (nth 2 date))))
|
||||
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
|
||||
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
|
||||
"\\|\\(<%%\\(([^>\n]+)\\)\\([^\n>]*\\)>\\)"))
|
||||
timestamp-items)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward regexp nil t)
|
||||
|
@ -5934,7 +5935,7 @@ displayed in agenda view."
|
|||
level category tags timestamp org-ts-regexp habit?)))
|
||||
(org-add-props item props
|
||||
'urgency (if habit?
|
||||
(org-habit-get-urgency (org-habit-parse-todo))
|
||||
(org-habit-get-urgency (org-habit-parse-todo))
|
||||
(org-get-priority item))
|
||||
'priority (org-get-priority item)
|
||||
'org-marker (org-agenda-new-marker pos)
|
||||
|
@ -6781,10 +6782,13 @@ scheduled items with an hour specification like [h]h:mm."
|
|||
'help-echo
|
||||
(format "mouse-2 or RET jump to org file %s"
|
||||
(abbreviate-file-name buffer-file-name))))
|
||||
;; Group 1: starting date timestamp without braces
|
||||
;; Group 2: ending date timestamp without braces
|
||||
(regexp (if org-agenda-include-inactive-timestamps
|
||||
org-tr-regexp-both org-tr-regexp))
|
||||
(d0 (calendar-absolute-from-gregorian date))
|
||||
face marker hdmarker ee txt d1 d2 s1 s2 category level
|
||||
(agenda-today (calendar-absolute-from-gregorian date))
|
||||
face marker hdmarker block-list txt start-day end-day
|
||||
category level
|
||||
todo-state tags pos head donep inherited-tags effort
|
||||
effort-minutes inactive?)
|
||||
(goto-char (point-min))
|
||||
|
@ -6795,37 +6799,36 @@ scheduled items with an hour specification like [h]h:mm."
|
|||
(setq inactive? (eq ?\[ (char-after (match-beginning 0))))
|
||||
(let ((start-time (match-string 1))
|
||||
(end-time (match-string 2)))
|
||||
(setq s1 (match-string 1)
|
||||
s2 (match-string 2)
|
||||
d1 (time-to-days
|
||||
(condition-case err
|
||||
(org-time-string-to-time s1)
|
||||
(error
|
||||
(error
|
||||
"Bad timestamp %S at %d in buffer %S\nError was: %s"
|
||||
s1
|
||||
pos
|
||||
(current-buffer)
|
||||
(error-message-string err)))))
|
||||
d2 (time-to-days
|
||||
(condition-case err
|
||||
(org-time-string-to-time s2)
|
||||
(error
|
||||
(error
|
||||
"Bad timestamp %S at %d in buffer %S\nError was: %s"
|
||||
s2
|
||||
pos
|
||||
(current-buffer)
|
||||
(error-message-string err))))))
|
||||
(when (and (> (- d0 d1) -1) (> (- d2 d0) -1))
|
||||
;; Only allow days between the limits, because the normal
|
||||
(setq start-day (time-to-days
|
||||
(condition-case err
|
||||
(org-time-string-to-time start-time)
|
||||
(error
|
||||
(error
|
||||
"Bad timestamp %S at %d in buffer %S\nError was: %s"
|
||||
start-time
|
||||
pos
|
||||
(current-buffer)
|
||||
(error-message-string err)))))
|
||||
end-day (time-to-days
|
||||
(condition-case err
|
||||
(org-time-string-to-time end-time)
|
||||
(error
|
||||
(error
|
||||
"Bad timestamp %S at %d in buffer %S\nError was: %s"
|
||||
end-time
|
||||
pos
|
||||
(current-buffer)
|
||||
(error-message-string err))))))
|
||||
(when (and (> (- agenda-today start-day) -1)
|
||||
(> (- end-day agenda-today) -1))
|
||||
;; Only allow days between the limits, because the normal
|
||||
;; date stamps will catch the limits.
|
||||
(save-excursion
|
||||
(setq todo-state (org-get-todo-state))
|
||||
(setq donep (member todo-state org-done-keywords))
|
||||
(when (and donep org-agenda-skip-timestamp-if-done)
|
||||
(throw :skip t))
|
||||
(setq face (if (= d1 d2)
|
||||
(setq face (if (= start-day end-day)
|
||||
'org-agenda-calendar-event
|
||||
'org-agenda-calendar-daterange))
|
||||
(setq marker (org-agenda-new-marker (point))
|
||||
|
@ -6851,29 +6854,36 @@ scheduled items with an hour specification like [h]h:mm."
|
|||
(let ((remove-re
|
||||
(if org-agenda-remove-timeranges-from-blocks
|
||||
(concat
|
||||
"<" (regexp-quote s1) ".*?>"
|
||||
"<" (regexp-quote start-time) ".*?>"
|
||||
"--"
|
||||
"<" (regexp-quote s2) ".*?>")
|
||||
"<" (regexp-quote end-time) ".*?>")
|
||||
nil)))
|
||||
(setq txt (org-agenda-format-item
|
||||
(concat
|
||||
(when inactive? org-agenda-inactive-leader)
|
||||
(format
|
||||
(nth (if (= d1 d2) 0 1)
|
||||
org-agenda-timerange-leaders)
|
||||
(1+ (- d0 d1)) (1+ (- d2 d1))))
|
||||
(org-add-props head nil
|
||||
'effort effort
|
||||
'effort-minutes effort-minutes)
|
||||
level category tags
|
||||
(cond
|
||||
((and (= d1 d0) (= d2 d0))
|
||||
(concat "<" start-time ">--<" end-time ">"))
|
||||
((= d1 d0)
|
||||
(concat "<" start-time ">"))
|
||||
((= d2 d0)
|
||||
(concat "<" end-time ">")))
|
||||
remove-re))))
|
||||
;; `org-agenda-format-item' automatically creates a
|
||||
;; time range when
|
||||
;; `org-agenda-default-appointment-duration' is
|
||||
;; non-nil and only start/end time is given.
|
||||
;; We do not want it here, when the range spans
|
||||
;; multiple days.
|
||||
(let ((org-agenda-default-appointment-duration nil))
|
||||
(setq txt (org-agenda-format-item
|
||||
(concat
|
||||
(when inactive? org-agenda-inactive-leader)
|
||||
(format
|
||||
(nth (if (= start-day end-day) 0 1)
|
||||
org-agenda-timerange-leaders)
|
||||
(1+ (- agenda-today start-day)) (1+ (- end-day start-day))))
|
||||
(org-add-props head nil
|
||||
'effort effort
|
||||
'effort-minutes effort-minutes)
|
||||
level category tags
|
||||
(cond
|
||||
((and (= start-day agenda-today) (= end-day agenda-today))
|
||||
(concat "<" start-time ">--<" end-time ">"))
|
||||
((= start-day agenda-today)
|
||||
(concat "<" start-time ">"))
|
||||
((= end-day agenda-today)
|
||||
(concat "<" end-time ">")))
|
||||
remove-re)))))
|
||||
(org-add-props txt props
|
||||
'face face
|
||||
'org-marker marker 'org-hd-marker hdmarker
|
||||
|
@ -6883,10 +6893,10 @@ scheduled items with an hour specification like [h]h:mm."
|
|||
'todo-state todo-state
|
||||
'urgency (org-get-priority txt)
|
||||
'priority (org-get-priority txt))
|
||||
(push txt ee))))
|
||||
(push txt block-list))))
|
||||
(goto-char pos)))
|
||||
;; Sort the entries by expiration date.
|
||||
(nreverse ee)))
|
||||
(nreverse block-list)))
|
||||
|
||||
;;; Agenda presentation and sorting
|
||||
|
||||
|
@ -6975,58 +6985,71 @@ Any match of REMOVE-RE will be removed from TXT."
|
|||
(time-grid-trailing-characters (nth 2 org-agenda-time-grid))
|
||||
(extra (or (and (not habitp) extra) ""))
|
||||
time
|
||||
(ts (when dotime (concat
|
||||
(if (stringp dotime) dotime "")
|
||||
(and org-agenda-search-headline-for-time
|
||||
;; Do not search inside
|
||||
;; timestamps. They are handled
|
||||
;; separately.
|
||||
(replace-regexp-in-string
|
||||
org-ts-regexp-both ""
|
||||
txt)))))
|
||||
(time-of-day (and dotime (org-get-time-of-day ts)))
|
||||
stamp plain s0 s1 s2 rtn srp l
|
||||
(string-containing-time
|
||||
(when dotime (concat
|
||||
(if (stringp dotime) dotime "")
|
||||
(and org-agenda-search-headline-for-time
|
||||
;; Do not search inside
|
||||
;; timestamps. They are handled
|
||||
;; separately.
|
||||
(replace-regexp-in-string
|
||||
org-ts-regexp-both ""
|
||||
txt)))))
|
||||
(time-of-day (and dotime (org-get-time-of-day string-containing-time)))
|
||||
timestamp-range? plain-time? date-range-same-day?
|
||||
time-string start-time end-time rtn
|
||||
duration breadcrumbs)
|
||||
(and (derived-mode-p 'org-mode) buffer-file-name
|
||||
(add-to-list 'org-agenda-contributing-files buffer-file-name))
|
||||
(when (and dotime time-of-day)
|
||||
;; Extract starting and ending time and move them to prefix
|
||||
(when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
|
||||
(setq plain (string-match org-plain-time-of-day-regexp ts)))
|
||||
(setq s0 (match-string 0 ts)
|
||||
srp (and stamp (match-end 3))
|
||||
s1 (match-string (if plain 1 2) ts)
|
||||
s2 (match-string (if plain 8 (if srp 4 6)) ts))
|
||||
(when (or (setq timestamp-range?
|
||||
(string-match org-stamp-time-of-day-regexp
|
||||
string-containing-time))
|
||||
(setq plain-time?
|
||||
(string-match org-plain-time-of-day-regexp
|
||||
string-containing-time)))
|
||||
(setq time-string (match-string 0 string-containing-time)
|
||||
date-range-same-day? (and timestamp-range? (match-end 3))
|
||||
start-time (match-string (if plain-time? 1 2)
|
||||
string-containing-time)
|
||||
end-time (match-string (if plain-time? 8
|
||||
(if date-range-same-day? 4 6))
|
||||
string-containing-time))
|
||||
|
||||
;; If the times are in TXT (not in DOTIMES), and the prefix will list
|
||||
;; them, we might want to remove them there to avoid duplication.
|
||||
;; The user can turn this off with a variable.
|
||||
(when (and org-prefix-has-time
|
||||
org-agenda-remove-times-when-in-prefix (or stamp plain)
|
||||
(string-match (concat (regexp-quote s0) " *") txt)
|
||||
org-agenda-remove-times-when-in-prefix
|
||||
(or timestamp-range? plain-time?)
|
||||
(string-match (concat (regexp-quote time-string) " *") txt)
|
||||
(not (equal ?\] (string-to-char (substring txt (match-end 0)))))
|
||||
(if (eq org-agenda-remove-times-when-in-prefix 'beg)
|
||||
(= (match-beginning 0) 0)
|
||||
t))
|
||||
(setq txt (replace-match "" nil nil txt))))
|
||||
;; Normalize the time(s) to 24 hour.
|
||||
(when s1 (setq s1 (org-get-time-of-day s1 t)))
|
||||
(when s2 (setq s2 (org-get-time-of-day s2 t)))
|
||||
(when start-time (setq start-time (org-get-time-of-day start-time t)))
|
||||
(when end-time (setq end-time (org-get-time-of-day end-time t)))
|
||||
;; Try to set s2 if s1 and
|
||||
;; `org-agenda-default-appointment-duration' are set
|
||||
(when (and s1 (not s2) org-agenda-default-appointment-duration)
|
||||
(setq s2
|
||||
(org-duration-from-minutes
|
||||
(+ (org-duration-to-minutes s1 t)
|
||||
(when (and start-time (not end-time)
|
||||
org-agenda-default-appointment-duration)
|
||||
(setq end-time
|
||||
(org-duration-from-minutes
|
||||
(+ (org-duration-to-minutes start-time t)
|
||||
org-agenda-default-appointment-duration)
|
||||
nil t)))
|
||||
nil t)))
|
||||
;; Compute the duration
|
||||
(when s2
|
||||
(setq duration (- (org-duration-to-minutes s2)
|
||||
(org-duration-to-minutes s1))))
|
||||
(when end-time
|
||||
(setq duration (- (org-duration-to-minutes end-time)
|
||||
(org-duration-to-minutes start-time))))
|
||||
;; Format S1 and S2 for display.
|
||||
(when s1 (setq s1 (format "%5s" (org-get-time-of-day s1 'overtime))))
|
||||
(when s2 (setq s2 (org-get-time-of-day s2 'overtime))))
|
||||
(when start-time
|
||||
(setq start-time (format "%5s" (org-get-time-of-day start-time 'overtime))))
|
||||
(when end-time
|
||||
(setq end-time (org-get-time-of-day end-time 'overtime))))
|
||||
(when (string-match org-tag-group-re txt)
|
||||
;; Tags are in the string
|
||||
(if (or (eq org-agenda-remove-tags t)
|
||||
|
@ -7063,26 +7086,27 @@ Any match of REMOVE-RE will be removed from TXT."
|
|||
;; particular heading.
|
||||
"")))
|
||||
(if (equal "" s) "" (concat s org-agenda-breadcrumbs-separator))))))
|
||||
(setq time (cond (s2 (concat
|
||||
(org-agenda-time-of-day-to-ampm-maybe s1)
|
||||
"-" (org-agenda-time-of-day-to-ampm-maybe s2)
|
||||
(when org-agenda-timegrid-use-ampm " ")))
|
||||
(s1 (concat
|
||||
(org-agenda-time-of-day-to-ampm-maybe s1)
|
||||
(if org-agenda-timegrid-use-ampm
|
||||
(concat time-grid-trailing-characters " ")
|
||||
time-grid-trailing-characters)))
|
||||
(setq time (cond (end-time
|
||||
(concat
|
||||
(org-agenda-time-of-day-to-ampm-maybe start-time)
|
||||
"-" (org-agenda-time-of-day-to-ampm-maybe end-time)
|
||||
(when org-agenda-timegrid-use-ampm " ")))
|
||||
(start-time
|
||||
(concat
|
||||
(org-agenda-time-of-day-to-ampm-maybe start-time)
|
||||
(if org-agenda-timegrid-use-ampm
|
||||
(concat time-grid-trailing-characters " ")
|
||||
time-grid-trailing-characters)))
|
||||
(t ""))
|
||||
category (if (symbolp category) (symbol-name category) category)
|
||||
level (or with-level ""))
|
||||
(if (string-match org-link-bracket-re category)
|
||||
(progn
|
||||
(setq l (string-width (or (match-string 2) (match-string 1))))
|
||||
(when (< l (or org-prefix-category-length 0))
|
||||
(setq category (copy-sequence category))
|
||||
(org-add-props category nil
|
||||
(let ((link-width (string-width (or (match-string 2) (match-string 1)))))
|
||||
(when (< link-width (or org-prefix-category-length 0))
|
||||
(setq category (copy-sequence category))
|
||||
(org-add-props category nil
|
||||
'extra-space (make-string
|
||||
(- org-prefix-category-length l 1) ?\ ))))
|
||||
(- org-prefix-category-length link-width 1) ?\ ))))
|
||||
(when (and org-prefix-category-max-length
|
||||
(>= (length category) org-prefix-category-max-length))
|
||||
(setq category (substring category 0 (1- org-prefix-category-max-length)))))
|
||||
|
@ -7491,8 +7515,8 @@ The optional argument TYPE tells the agenda type."
|
|||
"Compare the string values of categories of strings A and B."
|
||||
(let ((ca (or (get-text-property (1- (length a)) 'org-category a) ""))
|
||||
(cb (or (get-text-property (1- (length b)) 'org-category b) "")))
|
||||
(cond ((string-lessp ca cb) -1)
|
||||
((string-lessp cb ca) +1))))
|
||||
(cond ((org-string< ca cb) -1)
|
||||
((org-string< cb ca) +1))))
|
||||
|
||||
(defsubst org-cmp-todo-state (a b)
|
||||
"Compare the todo states of strings A and B."
|
||||
|
@ -7538,8 +7562,8 @@ The optional argument TYPE tells the agenda type."
|
|||
(cond ((not (or ta tb)) nil)
|
||||
((not ta) +1)
|
||||
((not tb) -1)
|
||||
((string-lessp ta tb) -1)
|
||||
((string-lessp tb ta) +1))))
|
||||
((org-string< ta tb) -1)
|
||||
((org-string< tb ta) +1))))
|
||||
|
||||
(defsubst org-cmp-tag (a b)
|
||||
"Compare the string values of the first tags of A and B."
|
||||
|
@ -7548,8 +7572,8 @@ The optional argument TYPE tells the agenda type."
|
|||
(cond ((not (or ta tb)) nil)
|
||||
((not ta) +1)
|
||||
((not tb) -1)
|
||||
((string-lessp ta tb) -1)
|
||||
((string-lessp tb ta) +1))))
|
||||
((funcall (or org-tags-sort-function #'org-string<) ta tb) -1)
|
||||
((funcall (or org-tags-sort-function #'org-string<) tb ta) +1))))
|
||||
|
||||
(defsubst org-cmp-time (a b)
|
||||
"Compare the time-of-day values of strings A and B."
|
||||
|
@ -8595,6 +8619,14 @@ Negative selection means regexp must not match for selection of an entry."
|
|||
(org-agenda-redo))
|
||||
(message "Display now includes inactive timestamps as well"))
|
||||
((eq org-agenda-type 'search)
|
||||
;; Previous calls to `org-agenda-manipulate-query' could already
|
||||
;; add trailing text to the query. Prevent duplicating it.
|
||||
;; Trim the trailing spaces and +/.
|
||||
(setq org-agenda-query-string
|
||||
(replace-regexp-in-string
|
||||
(rx (or (1+ " ") (seq (1+ " ") (any "+-") (opt "{}"))) eos)
|
||||
""
|
||||
org-agenda-query-string))
|
||||
(org-add-to-string
|
||||
'org-agenda-query-string
|
||||
(if org-agenda-last-search-view-search-was-boolean
|
||||
|
@ -9215,7 +9247,8 @@ When called with a prefix argument, include all archive files as well."
|
|||
(when (and (markerp m) (marker-buffer m))
|
||||
(and org-agenda-follow-mode
|
||||
(if org-agenda-follow-indirect
|
||||
(org-agenda-tree-to-indirect-buffer nil)
|
||||
(let ((org-indirect-buffer-display 'other-window))
|
||||
(org-agenda-tree-to-indirect-buffer nil))
|
||||
(org-agenda-show)))
|
||||
(and org-agenda-show-outline-path
|
||||
(org-with-point-at m (org-display-outline-path org-agenda-show-outline-path))))))
|
||||
|
@ -9307,20 +9340,17 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
|
|||
(marker (or (org-get-at-bol 'org-marker)
|
||||
(org-agenda-error)))
|
||||
(buffer (marker-buffer marker))
|
||||
(pos (marker-position marker))
|
||||
(type (org-get-at-bol 'type))
|
||||
dbeg dend (n 0))
|
||||
(org-with-remote-undo buffer
|
||||
(with-current-buffer buffer
|
||||
(save-excursion
|
||||
(goto-char pos)
|
||||
(if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
|
||||
(setq dbeg (progn (org-back-to-heading t) (point))
|
||||
dend (org-end-of-subtree t t))
|
||||
(setq dbeg (line-beginning-position)
|
||||
dend (min (point-max) (1+ (line-end-position)))))
|
||||
(goto-char dbeg)
|
||||
(while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
|
||||
(org-with-point-at marker
|
||||
(if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
|
||||
(setq dbeg (progn (org-back-to-heading t) (point))
|
||||
dend (org-end-of-subtree t t))
|
||||
(setq dbeg (line-beginning-position)
|
||||
dend (min (point-max) (1+ (line-end-position)))))
|
||||
(goto-char dbeg)
|
||||
(while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n))))
|
||||
(when (or (eq t org-agenda-confirm-kill)
|
||||
(and (numberp org-agenda-confirm-kill)
|
||||
(> n org-agenda-confirm-kill)))
|
||||
|
@ -9337,7 +9367,7 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
|
|||
(set-window-configuration win-conf))))
|
||||
(let ((org-agenda-buffer-name bufname-orig))
|
||||
(org-remove-subtree-entries-from-agenda buffer dbeg dend))
|
||||
(with-current-buffer buffer (delete-region dbeg dend))
|
||||
(org-with-point-at marker (delete-region dbeg dend))
|
||||
(message "Agenda item and source killed")))))
|
||||
|
||||
(defvar org-archive-default-command) ; defined in org-archive.el
|
||||
|
@ -9400,26 +9430,26 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
|
|||
The subtree is the one in buffer BUF, starting at BEG and ending at END.
|
||||
If this information is not given, the function uses the tree at point."
|
||||
(let ((buf (or buf (current-buffer))) m p)
|
||||
(save-excursion
|
||||
(unless (and beg end)
|
||||
(org-back-to-heading t)
|
||||
(setq beg (point))
|
||||
(org-end-of-subtree t)
|
||||
(setq end (point)))
|
||||
(set-buffer (get-buffer org-agenda-buffer-name))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(forward-line 0)
|
||||
(while (not (bobp))
|
||||
(when (and (setq m (org-get-at-bol 'org-marker))
|
||||
(equal buf (marker-buffer m))
|
||||
(setq p (marker-position m))
|
||||
(>= p beg)
|
||||
(< p end))
|
||||
(let ((inhibit-read-only t))
|
||||
(delete-region (line-beginning-position)
|
||||
(1+ (line-end-position)))))
|
||||
(forward-line -1))))))
|
||||
(org-with-wide-buffer
|
||||
(unless (and beg end)
|
||||
(org-back-to-heading t)
|
||||
(setq beg (point))
|
||||
(org-end-of-subtree t)
|
||||
(setq end (point)))
|
||||
(set-buffer (get-buffer org-agenda-buffer-name))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(forward-line 0)
|
||||
(while (not (bobp))
|
||||
(when (and (setq m (org-get-at-bol 'org-marker))
|
||||
(equal buf (marker-buffer m))
|
||||
(setq p (marker-position m))
|
||||
(>= p beg)
|
||||
(< p end))
|
||||
(let ((inhibit-read-only t))
|
||||
(delete-region (line-beginning-position)
|
||||
(1+ (line-end-position)))))
|
||||
(forward-line -1))))))
|
||||
|
||||
(defun org-agenda-refile (&optional goto rfloc no-update)
|
||||
"Refile the item at point.
|
||||
|
@ -9688,27 +9718,6 @@ With a `\\[universal-argument]' prefix, make a separate frame for this tree, \
|
|||
i.e. don't use
|
||||
the dedicated frame."
|
||||
(interactive "P")
|
||||
(if current-prefix-arg
|
||||
(org-agenda-do-tree-to-indirect-buffer arg)
|
||||
(let ((agenda-buffer (buffer-name))
|
||||
(agenda-window (selected-window))
|
||||
(indirect-window
|
||||
(and org-last-indirect-buffer
|
||||
(get-buffer-window org-last-indirect-buffer))))
|
||||
(save-window-excursion (org-agenda-do-tree-to-indirect-buffer arg))
|
||||
(unless (or (eq org-indirect-buffer-display 'new-frame)
|
||||
(eq org-indirect-buffer-display 'dedicated-frame))
|
||||
(unwind-protect
|
||||
(unless (and indirect-window (window-live-p indirect-window))
|
||||
(setq indirect-window (split-window agenda-window)))
|
||||
(and indirect-window (select-window indirect-window))
|
||||
(switch-to-buffer org-last-indirect-buffer :norecord)
|
||||
(fit-window-to-buffer indirect-window)))
|
||||
(select-window (get-buffer-window agenda-buffer))
|
||||
(setq org-agenda-last-indirect-buffer org-last-indirect-buffer))))
|
||||
|
||||
(defun org-agenda-do-tree-to-indirect-buffer (arg)
|
||||
"Same as `org-agenda-tree-to-indirect-buffer' without saving window."
|
||||
(org-agenda-check-no-diary)
|
||||
(let* ((marker (or (org-get-at-bol 'org-marker)
|
||||
(org-agenda-error)))
|
||||
|
@ -9717,7 +9726,8 @@ the dedicated frame."
|
|||
(with-current-buffer buffer
|
||||
(save-excursion
|
||||
(goto-char pos)
|
||||
(org-tree-to-indirect-buffer arg)))))
|
||||
(org-tree-to-indirect-buffer arg))))
|
||||
(setq org-agenda-last-indirect-buffer org-last-indirect-buffer))
|
||||
|
||||
(defvar org-last-heading-marker (make-marker)
|
||||
"Marker pointing to the headline that last changed its TODO state
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -148,7 +148,7 @@ When t, store the link to original file location.
|
|||
When `file', store link to the attached file location.
|
||||
When `attached', store attach: link to the attached file."
|
||||
:group 'org-attach
|
||||
:version "24.1"
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(choice
|
||||
(const :tag "Don't store link" nil)
|
||||
(const :tag "Link to origin location" t)
|
||||
|
@ -530,7 +530,7 @@ DIR-property exists (that is different from the unset one)."
|
|||
"Turn the autotag on or (if OFF is set) off."
|
||||
(when org-attach-auto-tag
|
||||
;; FIXME: There is currently no way to set #+FILETAGS
|
||||
;; programatically. Do nothing when before first heading
|
||||
;; programmatically. Do nothing when before first heading
|
||||
;; (attaching to file) to avoid blocking error.
|
||||
(unless (org-before-first-heading-p)
|
||||
(save-excursion
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -376,8 +376,10 @@ be replaced with content and expanded:
|
|||
prompt/completions. Default value and completions as in
|
||||
%^{prompt|default|...}X are allowed.
|
||||
%? After completing the template, position cursor here.
|
||||
%\\1 ... %\\N Insert the text entered at the nth %^{prompt}, where N
|
||||
is a number, starting from 1.
|
||||
%\\1 ... %\\N Insert the text entered at the nth %^{prompt} (but not
|
||||
%^{prompt}X), where N is a number, starting from 1.
|
||||
%\\*1...%\\*N Same as \\N, but for all the prompts, including
|
||||
%^{prompt} and %^{prompt}X.
|
||||
|
||||
Apart from these general escapes, you can access information specific to
|
||||
the link type that is created. For example, calling `org-capture' in emails
|
||||
|
@ -402,7 +404,7 @@ calendar | %:type %:date
|
|||
When you need to insert a literal percent sign in the template,
|
||||
you can escape ambiguous cases with a backward slash, e.g., \\%i."
|
||||
:group 'org-capture
|
||||
:package-version '(Org . "9.6")
|
||||
:package-version '(Org . "9.7")
|
||||
:set (lambda (s v) (set-default-toplevel-value s (org-capture-upgrade-templates v)))
|
||||
:type
|
||||
(let ((file-variants '(choice :tag "Filename "
|
||||
|
@ -717,7 +719,6 @@ of the day at point (if any) or the current HH:MM time."
|
|||
(condition-case error
|
||||
(org-capture-put :template (org-capture-fill-template))
|
||||
((error quit)
|
||||
(if (get-buffer "*Capture*") (kill-buffer "*Capture*"))
|
||||
(error "Capture abort: %s" (error-message-string error))))
|
||||
|
||||
(setq org-capture-clock-keep (org-capture-get :clock-keep))
|
||||
|
@ -1198,6 +1199,8 @@ may have been stored before."
|
|||
(exact-position (org-capture-get :exact-position))
|
||||
(insert-here? (org-capture-get :insert-here))
|
||||
(level 1))
|
||||
(unless (string-match org-outline-regexp-bol template)
|
||||
(setq template (concat "* " template)))
|
||||
(org-capture-verify-tree template)
|
||||
(when exact-position (goto-char exact-position))
|
||||
(cond
|
||||
|
@ -1354,13 +1357,14 @@ may have been stored before."
|
|||
(defun org-capture-place-table-line ()
|
||||
"Place the template as a table line."
|
||||
(require 'org-table)
|
||||
(let ((text
|
||||
(pcase (org-trim (org-capture-get :template))
|
||||
((pred (string-match-p org-table-border-regexp))
|
||||
"| %?Bad template |")
|
||||
(text (concat text "\n"))))
|
||||
(table-line-pos (org-capture-get :table-line-pos))
|
||||
beg end)
|
||||
(let* ((template (org-trim (org-capture-get :template)))
|
||||
(text
|
||||
(pcase template
|
||||
((pred (string-match-p org-table-border-regexp))
|
||||
(concat "| " template))
|
||||
(text (concat text "\n"))))
|
||||
(table-line-pos (org-capture-get :table-line-pos))
|
||||
beg end)
|
||||
(cond
|
||||
((org-capture-get :exact-position)
|
||||
(org-with-point-at (org-capture-get :exact-position)
|
||||
|
@ -1675,9 +1679,12 @@ Expansion occurs in a temporary Org mode buffer."
|
|||
(org-no-properties org-clock-heading)
|
||||
""))
|
||||
(v-K (if (marker-buffer org-clock-marker)
|
||||
(org-with-point-at org-clock-marker
|
||||
(org-store-link nil nil))
|
||||
""))
|
||||
(let ((original-link-plist org-store-link-plist)
|
||||
(clocked-task-link (org-with-point-at org-clock-marker
|
||||
(org-store-link nil nil))))
|
||||
(setq org-store-link-plist original-link-plist)
|
||||
clocked-task-link)
|
||||
""))
|
||||
(v-f (or (org-capture-get :original-file-nondirectory) ""))
|
||||
(v-F (or (org-capture-get :original-file) ""))
|
||||
(org-capture--clipboards
|
||||
|
@ -1693,222 +1700,246 @@ Expansion occurs in a temporary Org mode buffer."
|
|||
(setq template "")
|
||||
(message "no template") (ding)
|
||||
(sit-for 1))
|
||||
(save-window-excursion
|
||||
(switch-to-buffer-other-window (get-buffer-create "*Capture*"))
|
||||
(erase-buffer)
|
||||
(setq buffer-file-name nil)
|
||||
(setq mark-active nil)
|
||||
(insert template)
|
||||
(org-mode)
|
||||
(goto-char (point-min))
|
||||
;; %[] insert contents of a file.
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
|
||||
(let ((filename (expand-file-name (match-string 1)))
|
||||
(beg (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0))))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region beg end)
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)
|
||||
(condition-case error
|
||||
(insert-file-contents filename)
|
||||
(error
|
||||
(insert (format "%%![could not insert %s: %s]"
|
||||
filename
|
||||
error))))))))
|
||||
;; Mark %() embedded elisp for later evaluation.
|
||||
(org-capture-expand-embedded-elisp 'mark)
|
||||
;; Expand non-interactive templates.
|
||||
(let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlLntTuUx]\\)"))
|
||||
(save-excursion
|
||||
(while (re-search-forward regexp nil t)
|
||||
;; `org-capture-escaped-%' may modify buffer and cripple
|
||||
;; match-data. Use markers instead. Ditto for other
|
||||
;; templates.
|
||||
(let ((pos (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0)))
|
||||
(value (match-string 1))
|
||||
(time-string (match-string 2)))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region pos end)
|
||||
(set-marker pos nil)
|
||||
(set-marker end nil)
|
||||
(let* ((inside-sexp? (org-capture-inside-embedded-elisp-p))
|
||||
(replacement
|
||||
(pcase (string-to-char value)
|
||||
(?< (format-time-string time-string time))
|
||||
(?:
|
||||
(or (plist-get org-store-link-plist (intern value))
|
||||
""))
|
||||
(?i
|
||||
(if inside-sexp? v-i
|
||||
;; Outside embedded Lisp, repeat leading
|
||||
;; characters before initial place holder
|
||||
;; every line.
|
||||
(let ((lead (concat "\n"
|
||||
(org-current-line-string t))))
|
||||
(replace-regexp-in-string "\n" lead v-i nil t))))
|
||||
(?a v-a)
|
||||
(?A v-A)
|
||||
(?c v-c)
|
||||
(?f v-f)
|
||||
(?F v-F)
|
||||
(?k v-k)
|
||||
(?K v-K)
|
||||
(?l v-l)
|
||||
(?L v-L)
|
||||
(?n v-n)
|
||||
(?t v-t)
|
||||
(?T v-T)
|
||||
(?u v-u)
|
||||
(?U v-U)
|
||||
(?x v-x))))
|
||||
(insert
|
||||
(if inside-sexp?
|
||||
;; Escape sensitive characters.
|
||||
(replace-regexp-in-string "[\\\"]" "\\\\\\&" replacement)
|
||||
replacement))))))))
|
||||
;; Expand %() embedded Elisp. Limit to Sexp originally marked.
|
||||
(org-capture-expand-embedded-elisp)
|
||||
;; Expand interactive templates. This is the last step so that
|
||||
;; template is mostly expanded when prompting happens. Turn on
|
||||
;; Org mode and set local variables. This is to support
|
||||
;; completion in interactive prompts.
|
||||
(let ((org-inhibit-startup t)) (org-mode))
|
||||
(org-clone-local-variables buffer "\\`org-")
|
||||
(let (strings) ; Stores interactive answers.
|
||||
(save-excursion
|
||||
(let ((regexp "%\\^\\(?:{\\([^}]*\\)}\\)?\\([CgGLptTuU]\\)?"))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(let* ((items (and (match-end 1)
|
||||
(save-match-data
|
||||
(split-string (match-string-no-properties 1)
|
||||
"|"))))
|
||||
(key (match-string 2))
|
||||
(beg (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0)))
|
||||
(prompt (nth 0 items))
|
||||
(default (nth 1 items))
|
||||
(completions (nthcdr 2 items)))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region beg end)
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)
|
||||
(pcase key
|
||||
((or "G" "g")
|
||||
(let* ((org-last-tags-completion-table
|
||||
(org-global-tags-completion-table
|
||||
(cond ((equal key "G") (org-agenda-files))
|
||||
(file (list file))
|
||||
(t nil))))
|
||||
(org-add-colon-after-tag-completion t)
|
||||
(ins (mapconcat
|
||||
#'identity
|
||||
(let ((crm-separator "[ \t]*:[ \t]*"))
|
||||
(completing-read-multiple
|
||||
(if prompt (concat prompt ": ") "Tags: ")
|
||||
org-last-tags-completion-table nil nil nil
|
||||
'org-tags-history))
|
||||
":")))
|
||||
(when (org-string-nw-p ins)
|
||||
(unless (eq (char-before) ?:) (insert ":"))
|
||||
(insert ins)
|
||||
(unless (eq (char-after) ?:) (insert ":"))
|
||||
(when (org-at-heading-p) (org-align-tags)))))
|
||||
((or "C" "L")
|
||||
(let ((insert-fun (if (equal key "C") #'insert
|
||||
(lambda (s) (org-insert-link 0 s)))))
|
||||
(pcase org-capture--clipboards
|
||||
(`nil nil)
|
||||
(`(,value) (funcall insert-fun value))
|
||||
(`(,first-value . ,_)
|
||||
(funcall insert-fun
|
||||
(read-string "Clipboard/kill value: "
|
||||
first-value
|
||||
'org-capture--clipboards
|
||||
first-value)))
|
||||
(_ (error "Invalid `org-capture--clipboards' value: %S"
|
||||
org-capture--clipboards)))))
|
||||
("p"
|
||||
;; We remove keyword properties inherited from
|
||||
;; target buffer so `org-read-property-value' has
|
||||
;; a chance to find allowed values in sub-trees
|
||||
;; from the target buffer.
|
||||
(setq-local org-keyword-properties nil)
|
||||
(let* ((origin (set-marker (make-marker)
|
||||
(org-capture-get :pos)
|
||||
(org-capture-get :buffer)))
|
||||
;; Find location from where to get allowed
|
||||
;; values. If `:target-entry-p' is
|
||||
;; non-nil, the current headline in the
|
||||
;; target buffer is going to be a parent
|
||||
;; headline, so location is fine.
|
||||
;; Otherwise, find the parent headline in
|
||||
;; the target buffer.
|
||||
(pom (if (org-capture-get :target-entry-p) origin
|
||||
(let ((level (progn
|
||||
(while (org-up-heading-safe))
|
||||
(org-current-level))))
|
||||
(org-with-point-at origin
|
||||
(let ((l (if (org-at-heading-p)
|
||||
(org-current-level)
|
||||
most-positive-fixnum)))
|
||||
(while (and l (>= l level))
|
||||
(setq l (org-up-heading-safe)))
|
||||
(if l (point-marker)
|
||||
(point-min-marker)))))))
|
||||
(value
|
||||
(org-read-property-value prompt pom default)))
|
||||
(org-set-property prompt value)))
|
||||
((or "t" "T" "u" "U")
|
||||
;; These are the date/time related ones.
|
||||
(let* ((upcase? (equal (upcase key) key))
|
||||
(org-end-time-was-given nil)
|
||||
(time (org-read-date upcase? t nil prompt)))
|
||||
(org-insert-timestamp
|
||||
time (or org-time-was-given upcase?)
|
||||
(member key '("u" "U"))
|
||||
nil nil (list org-end-time-was-given))))
|
||||
(`nil
|
||||
;; Load history list for current prompt.
|
||||
(setq org-capture--prompt-history
|
||||
(gethash prompt org-capture--prompt-history-table))
|
||||
(push (org-completing-read
|
||||
(org-format-prompt (or prompt "Enter string") default)
|
||||
completions
|
||||
nil nil nil 'org-capture--prompt-history default)
|
||||
strings)
|
||||
(insert (car strings))
|
||||
;; Save updated history list for current prompt.
|
||||
(puthash prompt org-capture--prompt-history
|
||||
org-capture--prompt-history-table))
|
||||
(_
|
||||
(error "Unknown template placeholder: \"%%^%s\""
|
||||
key))))))))
|
||||
;; Replace %n escapes with nth %^{...} string.
|
||||
(setq strings (nreverse strings))
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\\\\\([1-9][0-9]*\\)" nil t)
|
||||
(unless (org-capture-escaped-%)
|
||||
(replace-match
|
||||
(nth (1- (string-to-number (match-string 1))) strings)
|
||||
nil t)))))
|
||||
;; Make sure there are no empty lines before the text, and that
|
||||
;; it ends with a newline character or it is empty.
|
||||
(skip-chars-forward " \t\n")
|
||||
(delete-region (point-min) (line-beginning-position))
|
||||
(goto-char (point-max))
|
||||
(skip-chars-backward " \t\n")
|
||||
(if (bobp) (delete-region (point) (line-end-position))
|
||||
(end-of-line)
|
||||
(delete-region (point) (point-max))
|
||||
(insert "\n"))
|
||||
;; Return the expanded template and kill the capture buffer.
|
||||
(untabify (point-min) (point-max))
|
||||
(set-buffer-modified-p nil)
|
||||
(prog1 (buffer-substring-no-properties (point-min) (point-max))
|
||||
(kill-buffer (current-buffer))))))
|
||||
(let ((capture-tmp-buffer (generate-new-buffer "*Capture*")))
|
||||
(unwind-protect
|
||||
(save-window-excursion
|
||||
(switch-to-buffer-other-window capture-tmp-buffer)
|
||||
(erase-buffer)
|
||||
(setq buffer-file-name nil)
|
||||
(setq mark-active nil)
|
||||
(insert template)
|
||||
(org-mode)
|
||||
(goto-char (point-min))
|
||||
;; %[] insert contents of a file.
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
|
||||
(let ((filename (expand-file-name (match-string 1)))
|
||||
(beg (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0))))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region beg end)
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)
|
||||
(condition-case error
|
||||
(insert-file-contents filename)
|
||||
(error
|
||||
(insert (format "%%![could not insert %s: %s]"
|
||||
filename
|
||||
error))))))))
|
||||
;; Mark %() embedded elisp for later evaluation.
|
||||
(org-capture-expand-embedded-elisp 'mark)
|
||||
;; Expand non-interactive templates.
|
||||
(let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlLntTuUx]\\)"))
|
||||
(save-excursion
|
||||
(while (re-search-forward regexp nil t)
|
||||
;; `org-capture-escaped-%' may modify buffer and cripple
|
||||
;; match-data. Use markers instead. Ditto for other
|
||||
;; templates.
|
||||
(let ((pos (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0)))
|
||||
(value (match-string 1))
|
||||
(time-string (match-string 2)))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region pos end)
|
||||
(set-marker pos nil)
|
||||
(set-marker end nil)
|
||||
(let* ((inside-sexp? (org-capture-inside-embedded-elisp-p))
|
||||
(replacement
|
||||
(pcase (string-to-char value)
|
||||
(?< (format-time-string time-string time))
|
||||
(?:
|
||||
(or (plist-get org-store-link-plist (intern value))
|
||||
""))
|
||||
(?i
|
||||
(if inside-sexp? v-i
|
||||
;; Outside embedded Lisp, repeat leading
|
||||
;; characters before initial place holder
|
||||
;; every line.
|
||||
(let ((lead (concat "\n"
|
||||
(org-current-line-string t))))
|
||||
(replace-regexp-in-string "\n" lead v-i nil t))))
|
||||
(?a v-a)
|
||||
(?A v-A)
|
||||
(?c v-c)
|
||||
(?f v-f)
|
||||
(?F v-F)
|
||||
(?k v-k)
|
||||
(?K v-K)
|
||||
(?l v-l)
|
||||
(?L v-L)
|
||||
(?n v-n)
|
||||
(?t v-t)
|
||||
(?T v-T)
|
||||
(?u v-u)
|
||||
(?U v-U)
|
||||
(?x v-x))))
|
||||
(insert
|
||||
(if inside-sexp?
|
||||
;; Escape sensitive characters.
|
||||
(replace-regexp-in-string "[\\\"]" "\\\\\\&" replacement)
|
||||
replacement))))))))
|
||||
;; Expand %() embedded Elisp. Limit to Sexp originally marked.
|
||||
(org-capture-expand-embedded-elisp)
|
||||
;; Expand interactive templates. This is the last step so that
|
||||
;; template is mostly expanded when prompting happens. Turn on
|
||||
;; Org mode and set local variables. This is to support
|
||||
;; completion in interactive prompts.
|
||||
(let ((org-inhibit-startup t)) (org-mode))
|
||||
(org-clone-local-variables buffer "\\`org-")
|
||||
(let (strings ; Stores interactive answers.
|
||||
strings-all ; ... include %^{prompt}X answers
|
||||
)
|
||||
(save-excursion
|
||||
(let ((regexp "%\\^\\(?:{\\([^}]*\\)}\\)?\\([CgGLptTuU]\\)?"))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(let* ((items (and (match-end 1)
|
||||
(save-match-data
|
||||
(split-string (match-string-no-properties 1)
|
||||
"|"))))
|
||||
(key (match-string 2))
|
||||
(beg (copy-marker (match-beginning 0)))
|
||||
(end (copy-marker (match-end 0)))
|
||||
(prompt (nth 0 items))
|
||||
(default (nth 1 items))
|
||||
(completions (nthcdr 2 items)))
|
||||
(unless (org-capture-escaped-%)
|
||||
(delete-region beg end)
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)
|
||||
(pcase key
|
||||
((or "G" "g")
|
||||
(let* ((org-last-tags-completion-table
|
||||
(org-global-tags-completion-table
|
||||
(cond ((equal key "G") (org-agenda-files))
|
||||
(file (list file))
|
||||
(t nil))))
|
||||
(org-add-colon-after-tag-completion t)
|
||||
(ins (mapconcat
|
||||
#'identity
|
||||
(let ((crm-separator "[ \t]*:[ \t]*"))
|
||||
(completing-read-multiple
|
||||
(if prompt (concat prompt ": ") "Tags: ")
|
||||
org-last-tags-completion-table nil nil nil
|
||||
'org-tags-history))
|
||||
":")))
|
||||
(when (org-string-nw-p ins)
|
||||
(push (concat ":" ins ":") strings-all)
|
||||
(unless (eq (char-before) ?:) (insert ":"))
|
||||
(insert ins)
|
||||
(unless (eq (char-after) ?:) (insert ":"))
|
||||
(when (org-at-heading-p) (org-align-tags)))))
|
||||
((or "C" "L")
|
||||
(let ((insert-fun (if (equal key "C") #'insert
|
||||
(lambda (s) (org-insert-link 0 s)))))
|
||||
(pcase org-capture--clipboards
|
||||
(`nil nil)
|
||||
(`(,value)
|
||||
(funcall insert-fun value)
|
||||
(push value strings-all))
|
||||
(`(,first-value . ,_)
|
||||
(funcall insert-fun
|
||||
(let ((val
|
||||
(read-string "Clipboard/kill value: "
|
||||
first-value
|
||||
'org-capture--clipboards
|
||||
first-value)))
|
||||
(push val strings-all)
|
||||
val)))
|
||||
(_ (error "Invalid `org-capture--clipboards' value: %S"
|
||||
org-capture--clipboards)))))
|
||||
("p"
|
||||
;; We remove keyword properties inherited from
|
||||
;; target buffer so `org-read-property-value' has
|
||||
;; a chance to find allowed values in sub-trees
|
||||
;; from the target buffer.
|
||||
(setq-local org-keyword-properties nil)
|
||||
(let* ((origin (set-marker (make-marker)
|
||||
(org-capture-get :pos)
|
||||
(org-capture-get :buffer)))
|
||||
;; Find location from where to get allowed
|
||||
;; values. If `:target-entry-p' is
|
||||
;; non-nil, the current headline in the
|
||||
;; target buffer is going to be a parent
|
||||
;; headline, so location is fine.
|
||||
;; Otherwise, find the parent headline in
|
||||
;; the target buffer.
|
||||
(pom (if (org-capture-get :target-entry-p) origin
|
||||
(let ((level (progn
|
||||
(while (org-up-heading-safe))
|
||||
(org-current-level))))
|
||||
(org-with-point-at origin
|
||||
(let ((l (if (org-at-heading-p)
|
||||
(org-current-level)
|
||||
most-positive-fixnum)))
|
||||
(while (and l (>= l level))
|
||||
(setq l (org-up-heading-safe)))
|
||||
(if l (point-marker)
|
||||
(point-min-marker)))))))
|
||||
(value
|
||||
(org-read-property-value prompt pom default)))
|
||||
(org-set-property prompt value)
|
||||
(push value strings-all)))
|
||||
((or "t" "T" "u" "U")
|
||||
;; These are the date/time related ones.
|
||||
(let* ((upcase? (equal (upcase key) key))
|
||||
(org-end-time-was-given nil)
|
||||
(time (org-read-date upcase? t nil prompt)))
|
||||
(push
|
||||
(org-insert-timestamp
|
||||
time (or org-time-was-given upcase?)
|
||||
(member key '("u" "U"))
|
||||
nil nil (list org-end-time-was-given))
|
||||
strings-all)))
|
||||
(`nil
|
||||
;; Load history list for current prompt.
|
||||
(setq org-capture--prompt-history
|
||||
(gethash prompt org-capture--prompt-history-table))
|
||||
(push (org-completing-read
|
||||
(org-format-prompt (or prompt "Enter string") default)
|
||||
completions
|
||||
nil nil nil 'org-capture--prompt-history default)
|
||||
strings)
|
||||
(push (car strings) strings-all)
|
||||
(insert (car strings))
|
||||
;; Save updated history list for current prompt.
|
||||
(puthash prompt org-capture--prompt-history
|
||||
org-capture--prompt-history-table))
|
||||
(_
|
||||
(error "Unknown template placeholder: \"%%^%s\""
|
||||
key))))))))
|
||||
;; Replace %n escapes with nth %^{...} string.
|
||||
(setq strings (nreverse strings))
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\\\\\([1-9][0-9]*\\)" nil t)
|
||||
(unless (org-capture-escaped-%)
|
||||
(replace-match
|
||||
(nth (1- (string-to-number (match-string 1))) strings)
|
||||
nil t))))
|
||||
;; Replace %*n escapes with nth %^{...} string.
|
||||
(setq strings-all (nreverse strings-all))
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\\\\\(\\*\\([1-9][0-9]*\\)\\)" nil t)
|
||||
(unless (org-capture-escaped-%)
|
||||
(replace-match
|
||||
(nth (1- (string-to-number (match-string 2))) strings-all)
|
||||
nil t)))))
|
||||
;; Make sure there are no empty lines before the text, and that
|
||||
;; it ends with a newline character or it is empty.
|
||||
(skip-chars-forward " \t\n")
|
||||
(delete-region (point-min) (line-beginning-position))
|
||||
(goto-char (point-max))
|
||||
(skip-chars-backward " \t\n")
|
||||
(if (bobp) (delete-region (point) (line-end-position))
|
||||
(end-of-line)
|
||||
(delete-region (point) (point-max))
|
||||
(insert "\n"))
|
||||
;; Return the expanded template and kill the capture buffer.
|
||||
(untabify (point-min) (point-max))
|
||||
(buffer-substring-no-properties (point-min) (point-max)))
|
||||
(when (buffer-live-p capture-tmp-buffer)
|
||||
(with-current-buffer capture-tmp-buffer
|
||||
(set-buffer-modified-p nil)
|
||||
(kill-buffer)))))))
|
||||
|
||||
(defun org-capture-escaped-% ()
|
||||
"Non-nil if % was escaped.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -56,6 +56,8 @@
|
|||
(declare-function dbus-list-activatable-names "dbus" (&optional bus))
|
||||
(declare-function dbus-call-method "dbus" (bus service path interface method &rest args))
|
||||
(declare-function dbus-get-property "dbus" (bus service path interface property))
|
||||
(declare-function haiku-notifications-notify "haikuselect.c")
|
||||
(declare-function android-notifications-notify "androidselect.c")
|
||||
|
||||
(defvar org-frame-title-format-backup nil)
|
||||
(defvar org-state)
|
||||
|
@ -808,6 +810,7 @@ previous clocking intervals."
|
|||
60)))
|
||||
(+ currently-clocked-time (or org-clock-total-time 0))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-clock-modify-effort-estimate (&optional value)
|
||||
"Add to or set the effort estimate of the item currently being clocked.
|
||||
VALUE can be a number of minutes, or a string with format hh:mm or mm.
|
||||
|
@ -884,6 +887,18 @@ use libnotify if available, or fall back on a message."
|
|||
((stringp org-show-notification-handler)
|
||||
(start-process "emacs-timer-notification" nil
|
||||
org-show-notification-handler notification))
|
||||
((fboundp 'haiku-notifications-notify)
|
||||
;; N.B. timeouts are not available under Haiku.
|
||||
(haiku-notifications-notify :title "Org mode message"
|
||||
:body notification
|
||||
:urgency 'low))
|
||||
((fboundp 'android-notifications-notify)
|
||||
;; N.B. timeouts are not available under Haiku or Android.
|
||||
(android-notifications-notify :title "Org mode message"
|
||||
:body notification
|
||||
;; Low urgency notifications
|
||||
;; are by default hidden.
|
||||
:urgency 'normal))
|
||||
((fboundp 'w32-notification-notify)
|
||||
(let ((id (w32-notification-notify
|
||||
:title "Org mode message"
|
||||
|
@ -1414,7 +1429,7 @@ the default behavior."
|
|||
((and org-clock-in-switch-to-state
|
||||
(not (looking-at (concat org-outline-regexp "[ \t]*"
|
||||
org-clock-in-switch-to-state
|
||||
"\\>"))))
|
||||
"\\(?:[ \t]\\|$\\)"))))
|
||||
(org-todo org-clock-in-switch-to-state)))
|
||||
(setq org-clock-heading (org-clock--mode-line-heading))
|
||||
(org-clock-find-position org-clock-in-resume)
|
||||
|
@ -1824,7 +1839,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
|
|||
(concat
|
||||
org-outline-regexp "[ \t]*"
|
||||
org-clock-out-switch-to-state
|
||||
"\\>"))))
|
||||
"\\(?:[ \t]\\|$\\)"))))
|
||||
(org-todo org-clock-out-switch-to-state))))))
|
||||
(force-mode-line-update)
|
||||
(message (if remove
|
||||
|
@ -3111,8 +3126,9 @@ PROPERTIES: The list properties specified in the `:properties' parameter
|
|||
(let* ((todo (org-get-todo-state))
|
||||
(tags-list (org-get-tags))
|
||||
(org-scanner-tags tags-list)
|
||||
(org-trust-scanner-tags t))
|
||||
(funcall matcher todo tags-list nil)))))
|
||||
(org-trust-scanner-tags t)
|
||||
(level (org-current-level)))
|
||||
(funcall matcher todo tags-list level)))))
|
||||
(goto-char (point-min))
|
||||
(setq st t)
|
||||
(while (or (and (bobp) (prog1 st (setq st nil))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -123,6 +123,12 @@ in `org-columns-summary-types-default', which see."
|
|||
(function :tag "Summarize")
|
||||
(function :tag "Collect")))))
|
||||
|
||||
(defcustom org-columns-dblock-formatter #'org-columns-dblock-write-default
|
||||
"Function to format data in column view dynamic blocks.
|
||||
For more information, see `org-columns-dblock-write-default'."
|
||||
:group 'org-properties
|
||||
:package-version '(Org . "9.7")
|
||||
:type 'function)
|
||||
|
||||
|
||||
;;; Column View
|
||||
|
@ -1442,9 +1448,13 @@ that will be excluded from the resulting view. FORMAT is a
|
|||
format string for columns, or nil. When LOCAL is non-nil, only
|
||||
capture headings in current subtree.
|
||||
|
||||
This function returns a list containing the title row and all
|
||||
other rows. Each row is a list of fields, as strings, or
|
||||
`hline'."
|
||||
This function returns a list containing the title row and all other
|
||||
rows. Each row is either a list, or the symbol `hline'. The first list
|
||||
is the heading row as a list of strings with the column titles according
|
||||
to FORMAT. All subsequent lists each represent a body row as a list
|
||||
whose first element is an integer indicating the outline level of the
|
||||
entry, and whose remaining elements are strings with the contents for
|
||||
the columns according to FORMAT."
|
||||
(org-columns (not local) format)
|
||||
(goto-char org-columns-top-level-marker)
|
||||
(let ((columns (length org-columns-current-fmt-compiled))
|
||||
|
@ -1457,11 +1467,10 @@ other rows. Each row is a list of fields, as strings, or
|
|||
(dotimes (i columns)
|
||||
(let* ((col (+ (line-beginning-position) i))
|
||||
(p (get-char-property col 'org-columns-key)))
|
||||
(push (org-quote-vert
|
||||
(get-char-property col
|
||||
(if (string= p "ITEM")
|
||||
'org-columns-value
|
||||
'org-columns-value-modified)))
|
||||
(push (get-char-property col
|
||||
(if (string= p "ITEM")
|
||||
'org-columns-value
|
||||
'org-columns-value-modified))
|
||||
row)))
|
||||
(unless (or
|
||||
(and skip-empty
|
||||
|
@ -1493,7 +1502,9 @@ an inline src-block."
|
|||
'(footnote-reference inline-babel-call inline-src-block target
|
||||
radio-target statistics-cookie)
|
||||
#'org-element-extract)
|
||||
(org-no-properties (org-element-interpret-data data))))
|
||||
(org-quote-vert
|
||||
(org-no-properties
|
||||
(org-element-interpret-data data)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-dblock-write:columnview (params)
|
||||
|
@ -1545,7 +1556,17 @@ PARAMS is a property list of parameters:
|
|||
`:vlines'
|
||||
|
||||
When non-nil, make each column a column group to enforce
|
||||
vertical lines."
|
||||
vertical lines.
|
||||
|
||||
`:link'
|
||||
|
||||
Link the item headlines in the table to their origins.
|
||||
|
||||
`:formatter'
|
||||
|
||||
A function to format the data and insert it into the
|
||||
buffer. Overrides the default formatting function set in
|
||||
`org-columns-dblock-formatter'."
|
||||
(let ((table
|
||||
(let ((id (plist-get params :id))
|
||||
view-file view-pos)
|
||||
|
@ -1573,9 +1594,20 @@ PARAMS is a property list of parameters:
|
|||
(plist-get params :exclude-tags)
|
||||
(plist-get params :format)
|
||||
view-pos)))))
|
||||
(width-specs
|
||||
(mapcar (lambda (spec) (nth 2 spec))
|
||||
org-columns-current-fmt-compiled)))
|
||||
(formatter (or (plist-get params :formatter)
|
||||
org-columns-dblock-formatter
|
||||
#'org-columns-dblock-write-default)))
|
||||
(funcall formatter (point) table params)))
|
||||
|
||||
(defun org-columns-dblock-write-default (ipos table params)
|
||||
"Write out a columnview table at position IPOS in the current buffer.
|
||||
TABLE is a table with data as produced by `org-columns--capture-view'.
|
||||
PARAMS is the parameter property list obtained from the dynamic block
|
||||
definition."
|
||||
(let ((link (plist-get params :link))
|
||||
(width-specs
|
||||
(mapcar (lambda (spec) (nth 2 spec))
|
||||
org-columns-current-fmt-compiled)))
|
||||
(when table
|
||||
;; Prune level information from the table. Also normalize
|
||||
;; headings: remove stars, add indentation entities, if
|
||||
|
@ -1599,7 +1631,14 @@ PARAMS is a property list of parameters:
|
|||
(and (numberp hlines) (<= level hlines))))
|
||||
(push 'hline new-table))
|
||||
(when item-index
|
||||
(let ((item (org-columns--clean-item (nth item-index (cdr row)))))
|
||||
(let* ((raw (nth item-index (cdr row)))
|
||||
(cleaned (org-columns--clean-item raw))
|
||||
(item (if (not link) cleaned
|
||||
(let ((search (org-link-heading-search-string raw)))
|
||||
(org-link-make-string
|
||||
(if (not (buffer-file-name)) search
|
||||
(format "file:%s::%s" (buffer-file-name) search))
|
||||
cleaned)))))
|
||||
(setf (nth item-index (cdr row))
|
||||
(if (and indent (> level 1))
|
||||
(concat "\\_" (make-string (* 2 (1- level)) ?\s) item)
|
||||
|
@ -1616,6 +1655,8 @@ PARAMS is a property list of parameters:
|
|||
;; to the resulting table, adding alignment field as the first
|
||||
;; row.
|
||||
(push (mapcar (lambda (width) (when width (format "<%d>" width))) width-specs) table))
|
||||
;; now insert the table into the buffer
|
||||
(goto-char ipos)
|
||||
(let ((content-lines (org-split-string (plist-get params :content) "\n"))
|
||||
recalc)
|
||||
;; Insert affiliated keywords before the table.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -649,6 +649,29 @@ Counting starts at 1."
|
|||
(define-obsolete-variable-alias 'org-plantuml-executable-args 'org-plantuml-args
|
||||
"Org 9.6")
|
||||
|
||||
(defvar org-cached-props nil)
|
||||
(defvar org-use-property-inheritance)
|
||||
(declare-function org-entry-get "org" (epom property &optional inherit literal-nil))
|
||||
(declare-function org-entry-properties "org" (&optional epom which))
|
||||
(defun org-cached-entry-get (pom property)
|
||||
(if (or (eq t org-use-property-inheritance)
|
||||
(and (stringp org-use-property-inheritance)
|
||||
(let ((case-fold-search t))
|
||||
(string-match-p org-use-property-inheritance property)))
|
||||
(and (listp org-use-property-inheritance)
|
||||
(member-ignore-case property org-use-property-inheritance)))
|
||||
;; Caching is not possible, check it directly.
|
||||
(org-entry-get pom property 'inherit)
|
||||
;; Get all properties, so we can do complicated checks easily.
|
||||
(cdr (assoc-string property
|
||||
(or org-cached-props
|
||||
(setq org-cached-props (org-entry-properties pom)))
|
||||
t))))
|
||||
|
||||
(make-obsolete 'org-cached-entry-get
|
||||
"Performs badly. Instead use `org-entry-get' with the argument INHERIT set to `selective'"
|
||||
"9.7")
|
||||
|
||||
(defconst org-latex-line-break-safe "\\\\[0pt]"
|
||||
"Linebreak protecting the following [...].
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2007-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Paul Sexton <eeeickythump@gmail.com>
|
||||
;; Keywords: org, wp
|
||||
;; Keywords: org, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
;;
|
||||
|
@ -57,6 +57,12 @@
|
|||
;; (add-hook 'org-mode-hook
|
||||
;; (lambda ()
|
||||
;; (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive)))
|
||||
;; (with-eval-after-load "org-ctags"
|
||||
;; (org-ctags-enable))
|
||||
;;
|
||||
;; To activate the library, you need to call `org-ctags-enable' explicitly.
|
||||
;; It used to be invoked during library loading, but it was against Emacs
|
||||
;; policy and caused inconvenience of Org users who do not use `org-ctags'.
|
||||
;;
|
||||
;; By default, with org-ctags loaded, org will first try and visit the tag
|
||||
;; with the same name as the link; then, if unsuccessful, ask the user if
|
||||
|
@ -156,11 +162,29 @@ Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/
|
|||
See the ctags documentation for more information.")
|
||||
|
||||
(defcustom org-ctags-path-to-ctags
|
||||
(if (executable-find "ctags-exuberant") "ctags-exuberant" "ctags")
|
||||
(cond ((executable-find "ctags-exuberant")
|
||||
"ctags-exuberant")
|
||||
((boundp 'ctags-program-name)
|
||||
ctags-program-name)
|
||||
(t "ctags")) ; Emacs < 30
|
||||
"Name of the ctags executable file."
|
||||
:version "24.1"
|
||||
:type 'file)
|
||||
|
||||
(defconst org-ctags--open-link-functions-list
|
||||
(list
|
||||
#'org-ctags-find-tag
|
||||
#'org-ctags-ask-rebuild-tags-file-then-find-tag
|
||||
#'org-ctags-rebuild-tags-file-then-find-tag
|
||||
#'org-ctags-ask-append-topic
|
||||
#'org-ctags-append-topic
|
||||
#'org-ctags-ask-visit-buffer-or-file
|
||||
#'org-ctags-visit-buffer-or-file
|
||||
#'org-ctags-fail-silently)
|
||||
"Options for `org-open-link-functions'.
|
||||
Ensure that the user option and `unload-feature'
|
||||
use the same set of functions.")
|
||||
|
||||
(defcustom org-ctags-open-link-functions
|
||||
'(org-ctags-find-tag
|
||||
org-ctags-ask-rebuild-tags-file-then-find-tag
|
||||
|
@ -168,14 +192,7 @@ See the ctags documentation for more information.")
|
|||
"List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS by ORG-CTAGS."
|
||||
:version "24.1"
|
||||
:type 'hook
|
||||
:options '(org-ctags-find-tag
|
||||
org-ctags-ask-rebuild-tags-file-then-find-tag
|
||||
org-ctags-rebuild-tags-file-then-find-tag
|
||||
org-ctags-ask-append-topic
|
||||
org-ctags-append-topic
|
||||
org-ctags-ask-visit-buffer-or-file
|
||||
org-ctags-visit-buffer-or-file
|
||||
org-ctags-fail-silently))
|
||||
:options org-ctags--open-link-functions-list)
|
||||
|
||||
|
||||
(defvar org-ctags-tag-list nil
|
||||
|
@ -191,21 +208,21 @@ The following patterns are replaced in the string:
|
|||
:type 'string)
|
||||
|
||||
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(when (and org-ctags-enabled-p
|
||||
(buffer-file-name))
|
||||
;; Make sure this file's directory is added to default
|
||||
;; directories in which to search for tags.
|
||||
(let ((tags-filename
|
||||
(expand-file-name
|
||||
(concat (file-name-directory (buffer-file-name))
|
||||
"/TAGS"))))
|
||||
(when (file-exists-p tags-filename)
|
||||
(visit-tags-table tags-filename))))))
|
||||
(defun org-ctags--visit-tags-table ()
|
||||
"Load tags for current file.
|
||||
A function for `org-mode-hook."
|
||||
(when (and org-ctags-enabled-p
|
||||
(buffer-file-name))
|
||||
;; Make sure this file's directory is added to default
|
||||
;; directories in which to search for tags.
|
||||
(let ((tags-filename
|
||||
(expand-file-name
|
||||
(concat (file-name-directory (buffer-file-name))
|
||||
"/TAGS"))))
|
||||
(when (file-exists-p tags-filename)
|
||||
(visit-tags-table tags-filename)))))
|
||||
|
||||
|
||||
(advice-add 'visit-tags-table :after #'org--ctags-load-tag-list)
|
||||
(defun org--ctags-load-tag-list (&rest _)
|
||||
(when (and org-ctags-enabled-p tags-file-name)
|
||||
(setq-local org-ctags-tag-list
|
||||
|
@ -213,12 +230,28 @@ The following patterns are replaced in the string:
|
|||
|
||||
|
||||
(defun org-ctags-enable ()
|
||||
(add-hook 'org-mode-hook #'org-ctags--visit-tags-table)
|
||||
(advice-add 'visit-tags-table :after #'org--ctags-load-tag-list)
|
||||
(advice-add 'xref-find-definitions :before
|
||||
#'org--ctags-set-org-mark-before-finding-tag)
|
||||
|
||||
(put 'org-mode 'find-tag-default-function 'org-ctags-find-tag-at-point)
|
||||
(setq org-ctags-enabled-p t)
|
||||
(dolist (fn org-ctags-open-link-functions)
|
||||
(add-hook 'org-open-link-functions fn t)))
|
||||
|
||||
|
||||
(defun org-ctags-unload-function ()
|
||||
"Disable `org-ctags' library.
|
||||
Called by `unload-feature'."
|
||||
(put 'org-mode 'find-tag-default-function nil)
|
||||
(advice-remove 'visit-tags-table #'org--ctags-load-tag-list)
|
||||
(advice-remove 'xref-find-definitions
|
||||
#'org--ctags-set-org-mark-before-finding-tag)
|
||||
(dolist (fn org-ctags--open-link-functions-list)
|
||||
(remove-hook 'org-open-link-functions fn nil)))
|
||||
|
||||
|
||||
;;; General utility functions. ===============================================
|
||||
;; These work outside org-ctags mode.
|
||||
|
||||
|
@ -294,8 +327,6 @@ The new topic will be titled NAME (or TITLE if supplied)."
|
|||
;;;; Misc interoperability with etags system =================================
|
||||
|
||||
|
||||
(advice-add 'xref-find-definitions :before
|
||||
#'org--ctags-set-org-mark-before-finding-tag)
|
||||
(defun org--ctags-set-org-mark-before-finding-tag (&rest _)
|
||||
"Before trying to find a tag, save our current position on org mark ring."
|
||||
(save-excursion
|
||||
|
@ -477,18 +508,21 @@ function may take several seconds to finish if the directory or
|
|||
its subdirectories contain large numbers of taggable files."
|
||||
(interactive)
|
||||
(cl-assert (buffer-file-name))
|
||||
(let ((dir-name (or directory-name
|
||||
(file-name-directory (buffer-file-name))))
|
||||
(let ((dir-name (shell-quote-argument
|
||||
(expand-file-name
|
||||
(if directory-name
|
||||
(file-name-as-directory directory-name)
|
||||
(file-name-directory (buffer-file-name))))))
|
||||
(exitcode nil))
|
||||
(save-excursion
|
||||
(setq exitcode
|
||||
(shell-command
|
||||
(format (concat "%s --langdef=orgmode --langmap=orgmode:.org "
|
||||
"--regex-orgmode=\"%s\" -f \"%s\" -e -R %s")
|
||||
"--regex-orgmode=%s -f %sTAGS -e -R %s*")
|
||||
org-ctags-path-to-ctags
|
||||
org-ctags-tag-regexp
|
||||
(expand-file-name (concat dir-name "/TAGS"))
|
||||
(expand-file-name (concat (shell-quote-argument dir-name) "/*")))))
|
||||
(shell-quote-argument org-ctags-tag-regexp)
|
||||
dir-name
|
||||
dir-name)))
|
||||
(cond
|
||||
((eql 0 exitcode)
|
||||
(setq-local org-ctags-tag-list
|
||||
|
@ -523,8 +557,6 @@ a new topic."
|
|||
'org-open-link-functions tag))))))
|
||||
|
||||
|
||||
(org-ctags-enable)
|
||||
|
||||
(provide 'org-ctags)
|
||||
|
||||
;;; org-ctags.el ends here
|
||||
|
|
|
@ -633,7 +633,7 @@ With a numeric prefix, show all headlines up to that level."
|
|||
(org-cycle-content 5))
|
||||
;; `nofold' and `showall' are technically not allowed values, but
|
||||
;; they are often intuitively tried by users by analogy with
|
||||
;; #+STARTUP: nofold or #STARUP: showall.
|
||||
;; #+STARTUP: nofold or #STARTUP: showall.
|
||||
((memq org-startup-folded '(showeverything nil nofold showall))
|
||||
(org-fold-show-all)))
|
||||
(unless (eq org-startup-folded 'showeverything)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -324,109 +324,110 @@ When optional argument CANONICAL is non-nil, ignore
|
|||
`org-duration-units' and use standard time units value.
|
||||
|
||||
Raise an error if expected format is unknown."
|
||||
(pcase (or fmt org-duration-format)
|
||||
(`h:mm
|
||||
(format "%d:%02d" (/ minutes 60) (mod minutes 60)))
|
||||
(`h:mm:ss
|
||||
(let* ((whole-minutes (floor minutes))
|
||||
(seconds (mod (* 60 minutes) 60)))
|
||||
(format "%s:%02d"
|
||||
(org-duration-from-minutes whole-minutes 'h:mm)
|
||||
seconds)))
|
||||
((pred atom) (error "Invalid duration format specification: %S" fmt))
|
||||
;; Mixed format. Call recursively the function on both parts.
|
||||
((and duration-format
|
||||
(let `(special . ,(and mode (or `h:mm:ss `h:mm)))
|
||||
(assq 'special duration-format)))
|
||||
(let* ((truncated-format
|
||||
;; Remove "special" mode from duration format in order to
|
||||
;; recurse properly. Also remove units smaller or equal
|
||||
;; to an hour since H:MM part takes care of it.
|
||||
(cl-remove-if-not
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
(`(,(and unit (pred stringp)) . ,_)
|
||||
(> (org-duration--modifier unit canonical) 60))
|
||||
(_ nil)))
|
||||
duration-format))
|
||||
(min-modifier ;smallest modifier above hour
|
||||
(and truncated-format
|
||||
(apply #'min
|
||||
(mapcar (lambda (p)
|
||||
(org-duration--modifier (car p) canonical))
|
||||
truncated-format)))))
|
||||
(if (or (null min-modifier) (< minutes min-modifier))
|
||||
;; There is not unit above the hour or the smallest unit
|
||||
;; above the hour is too large for the number of minutes we
|
||||
;; need to represent. Use H:MM or H:MM:SS syntax.
|
||||
(org-duration-from-minutes minutes mode canonical)
|
||||
;; Represent minutes above hour using provided units and H:MM
|
||||
;; or H:MM:SS below.
|
||||
(let* ((units-part (* min-modifier (/ (floor minutes) min-modifier)))
|
||||
(minutes-part (- minutes units-part))
|
||||
(compact (memq 'compact duration-format)))
|
||||
(concat
|
||||
(org-duration-from-minutes units-part truncated-format canonical)
|
||||
(and (not compact) " ")
|
||||
(org-duration-from-minutes minutes-part mode))))))
|
||||
;; Units format.
|
||||
(duration-format
|
||||
(let* ((fractional
|
||||
(let ((digits (cdr (assq 'special duration-format))))
|
||||
(and digits
|
||||
(or (wholenump digits)
|
||||
(error "Unknown formatting directive: %S" digits))
|
||||
(format "%%.%df" digits))))
|
||||
(selected-units
|
||||
(sort (cl-remove-if
|
||||
;; Ignore special format cells and compact option.
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
((or `compact `(special . ,_)) t)
|
||||
(_ nil)))
|
||||
duration-format)
|
||||
(lambda (a b)
|
||||
(> (org-duration--modifier (car a) canonical)
|
||||
(org-duration--modifier (car b) canonical)))))
|
||||
(separator (if (memq 'compact duration-format) "" " ")))
|
||||
(cond
|
||||
;; Fractional duration: use first unit that is either required
|
||||
;; or smaller than MINUTES.
|
||||
(fractional
|
||||
(let* ((unit (car
|
||||
(or (cl-find-if
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
(`(,u . ,req?)
|
||||
(or req?
|
||||
(<= (org-duration--modifier u canonical)
|
||||
minutes)))))
|
||||
selected-units)
|
||||
;; Fall back to smallest unit.
|
||||
(org-last selected-units))))
|
||||
(modifier (org-duration--modifier unit canonical)))
|
||||
(concat (format fractional (/ (float minutes) modifier)) unit)))
|
||||
;; Otherwise build duration string according to available
|
||||
;; units.
|
||||
((org-string-nw-p
|
||||
(org-trim
|
||||
(mapconcat
|
||||
(lambda (units)
|
||||
(pcase-let* ((`(,unit . ,required?) units)
|
||||
(modifier (org-duration--modifier unit canonical)))
|
||||
(cond ((<= modifier minutes)
|
||||
(let ((value (floor minutes modifier)))
|
||||
(cl-decf minutes (* value modifier))
|
||||
(format "%s%d%s" separator value unit)))
|
||||
(required? (concat separator "0" unit))
|
||||
(t ""))))
|
||||
selected-units
|
||||
""))))
|
||||
;; No unit can properly represent MINUTES. Use the smallest
|
||||
;; one anyway.
|
||||
(t
|
||||
(pcase-let ((`((,unit . ,_)) (last selected-units)))
|
||||
(concat "0" unit))))))))
|
||||
(if (< minutes 0) (concat "-" (org-duration-from-minutes (abs minutes) fmt canonical))
|
||||
(pcase (or fmt org-duration-format)
|
||||
(`h:mm
|
||||
(format "%d:%02d" (/ minutes 60) (mod minutes 60)))
|
||||
(`h:mm:ss
|
||||
(let* ((whole-minutes (floor minutes))
|
||||
(seconds (mod (* 60 minutes) 60)))
|
||||
(format "%s:%02d"
|
||||
(org-duration-from-minutes whole-minutes 'h:mm)
|
||||
seconds)))
|
||||
((pred atom) (error "Invalid duration format specification: %S" fmt))
|
||||
;; Mixed format. Call recursively the function on both parts.
|
||||
((and duration-format
|
||||
(let `(special . ,(and mode (or `h:mm:ss `h:mm)))
|
||||
(assq 'special duration-format)))
|
||||
(let* ((truncated-format
|
||||
;; Remove "special" mode from duration format in order to
|
||||
;; recurse properly. Also remove units smaller or equal
|
||||
;; to an hour since H:MM part takes care of it.
|
||||
(cl-remove-if-not
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
(`(,(and unit (pred stringp)) . ,_)
|
||||
(> (org-duration--modifier unit canonical) 60))
|
||||
(_ nil)))
|
||||
duration-format))
|
||||
(min-modifier ;smallest modifier above hour
|
||||
(and truncated-format
|
||||
(apply #'min
|
||||
(mapcar (lambda (p)
|
||||
(org-duration--modifier (car p) canonical))
|
||||
truncated-format)))))
|
||||
(if (or (null min-modifier) (< minutes min-modifier))
|
||||
;; There is not unit above the hour or the smallest unit
|
||||
;; above the hour is too large for the number of minutes we
|
||||
;; need to represent. Use H:MM or H:MM:SS syntax.
|
||||
(org-duration-from-minutes minutes mode canonical)
|
||||
;; Represent minutes above hour using provided units and H:MM
|
||||
;; or H:MM:SS below.
|
||||
(let* ((units-part (* min-modifier (/ (floor minutes) min-modifier)))
|
||||
(minutes-part (- minutes units-part))
|
||||
(compact (memq 'compact duration-format)))
|
||||
(concat
|
||||
(org-duration-from-minutes units-part truncated-format canonical)
|
||||
(and (not compact) " ")
|
||||
(org-duration-from-minutes minutes-part mode))))))
|
||||
;; Units format.
|
||||
(duration-format
|
||||
(let* ((fractional
|
||||
(let ((digits (cdr (assq 'special duration-format))))
|
||||
(and digits
|
||||
(or (wholenump digits)
|
||||
(error "Unknown formatting directive: %S" digits))
|
||||
(format "%%.%df" digits))))
|
||||
(selected-units
|
||||
(sort (cl-remove-if
|
||||
;; Ignore special format cells and compact option.
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
((or `compact `(special . ,_)) t)
|
||||
(_ nil)))
|
||||
duration-format)
|
||||
(lambda (a b)
|
||||
(> (org-duration--modifier (car a) canonical)
|
||||
(org-duration--modifier (car b) canonical)))))
|
||||
(separator (if (memq 'compact duration-format) "" " ")))
|
||||
(cond
|
||||
;; Fractional duration: use first unit that is either required
|
||||
;; or smaller than MINUTES.
|
||||
(fractional
|
||||
(let* ((unit (car
|
||||
(or (cl-find-if
|
||||
(lambda (pair)
|
||||
(pcase pair
|
||||
(`(,u . ,req?)
|
||||
(or req?
|
||||
(<= (org-duration--modifier u canonical)
|
||||
minutes)))))
|
||||
selected-units)
|
||||
;; Fall back to smallest unit.
|
||||
(org-last selected-units))))
|
||||
(modifier (org-duration--modifier unit canonical)))
|
||||
(concat (format fractional (/ (float minutes) modifier)) unit)))
|
||||
;; Otherwise build duration string according to available
|
||||
;; units.
|
||||
((org-string-nw-p
|
||||
(org-trim
|
||||
(mapconcat
|
||||
(lambda (units)
|
||||
(pcase-let* ((`(,unit . ,required?) units)
|
||||
(modifier (org-duration--modifier unit canonical)))
|
||||
(cond ((<= modifier minutes)
|
||||
(let ((value (floor minutes modifier)))
|
||||
(cl-decf minutes (* value modifier))
|
||||
(format "%s%d%s" separator value unit)))
|
||||
(required? (concat separator "0" unit))
|
||||
(t ""))))
|
||||
selected-units
|
||||
""))))
|
||||
;; No unit can properly represent MINUTES. Use the smallest
|
||||
;; one anyway.
|
||||
(t
|
||||
(pcase-let ((`((,unit . ,_)) (last selected-units)))
|
||||
(concat "0" unit)))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-duration-h:mm-only-p (times)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Maintainer: Ihor Radchenko <yantar92 at posteo dot net>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -648,7 +648,7 @@ IMPORTANT: The buffer copy may also have variable `buffer-file-name'
|
|||
copied.
|
||||
|
||||
To prevent Emacs overwriting the original buffer file,
|
||||
`write-contents-functions' is set to \='(always). Do not alter this
|
||||
`write-contents-functions' is set to \\='(always). Do not alter this
|
||||
variable and do not do anything that might alter it (like calling a
|
||||
major mode) to prevent data corruption. Also, do note that Emacs may
|
||||
jump into the created buffer if the original file buffer is closed and
|
||||
|
@ -3274,7 +3274,7 @@ CONTENTS is verse block contents."
|
|||
;; object types they can contain will be specified in
|
||||
;; `org-element-object-restrictions'.
|
||||
;;
|
||||
;; Creating a new type of object requires to alter
|
||||
;; Creating a new type of object requires altering
|
||||
;; `org-element--object-regexp' and `org-element--object-lex', add the
|
||||
;; new type in `org-element-all-objects', and possibly add
|
||||
;; restrictions in `org-element-object-restrictions'.
|
||||
|
@ -3874,7 +3874,7 @@ Assume point is at the beginning of the link."
|
|||
;;
|
||||
;; Also treat any newline character and associated
|
||||
;; indentation as a single space character. This is not
|
||||
;; compatible with RFC 3986, which requires to ignore
|
||||
;; compatible with RFC 3986, which requires ignoring
|
||||
;; them altogether. However, doing so would require
|
||||
;; users to encode spaces on the fly when writing links
|
||||
;; (e.g., insert [[shell:ls%20*.org]] instead of
|
||||
|
@ -4282,7 +4282,7 @@ Assume point is at the target."
|
|||
"\\|"
|
||||
"\\(?:<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)"
|
||||
"\\|"
|
||||
"\\(?:<%%\\(?:([^>\n]+)\\)>\\)")
|
||||
"\\(?:<%%\\(?:([^>\n]+)\\)\\([^\n>]*\\)>\\)")
|
||||
"Regexp matching any timestamp type object.")
|
||||
|
||||
(defconst org-element--timestamp-raw-value-regexp
|
||||
|
@ -4300,8 +4300,8 @@ containing `:type', `:range-type', `:raw-value', `:year-start',
|
|||
`:year-end', `:month-end', `:day-end', `:hour-end', `:minute-end',
|
||||
`:repeater-type', `:repeater-value', `:repeater-unit',
|
||||
`:repeater-deadline-value', `:repeater-deadline-unit', `:warning-type',
|
||||
`:warning-value', `:warning-unit', `:begin', `:end' and `:post-blank'
|
||||
properties. Otherwise, return nil.
|
||||
`:warning-value', `:warning-unit', `:diary-sexp', `:begin', `:end' and
|
||||
`:post-blank' properties. Otherwise, return nil.
|
||||
|
||||
Assume point is at the beginning of the timestamp."
|
||||
(when (looking-at-p org-element--timestamp-regexp)
|
||||
|
@ -4312,19 +4312,29 @@ Assume point is at the beginning of the timestamp."
|
|||
(progn
|
||||
(looking-at org-element--timestamp-raw-value-regexp)
|
||||
(match-string-no-properties 0)))
|
||||
(date-start (match-string-no-properties 1))
|
||||
(date-end (match-string-no-properties 3))
|
||||
(diaryp (match-beginning 2))
|
||||
diary-sexp
|
||||
(date-start (if diaryp
|
||||
;; Only consider part after sexp for
|
||||
;; diary timestamps.
|
||||
(save-match-data
|
||||
(looking-at org-element--timestamp-regexp)
|
||||
(setq diary-sexp
|
||||
(buffer-substring-no-properties
|
||||
(+ 3 (match-beginning 0))
|
||||
(match-beginning 2)))
|
||||
(match-string 2))
|
||||
(match-string-no-properties 1)))
|
||||
(date-end (match-string-no-properties 3))
|
||||
(post-blank (progn (goto-char (match-end 0))
|
||||
(skip-chars-forward " \t")))
|
||||
(end (point))
|
||||
(time-range
|
||||
(and (not diaryp)
|
||||
(string-match
|
||||
"[012]?[0-9]:[0-5][0-9]\\(-\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)"
|
||||
date-start)
|
||||
(cons (string-to-number (match-string 2 date-start))
|
||||
(string-to-number (match-string 3 date-start)))))
|
||||
(when (string-match
|
||||
"[012]?[0-9]:[0-5][0-9]\\(-\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)"
|
||||
date-start)
|
||||
(cons (string-to-number (match-string 2 date-start))
|
||||
(string-to-number (match-string 3 date-start)))))
|
||||
(type (cond (diaryp 'diary)
|
||||
((and activep (or date-end time-range)) 'active-range)
|
||||
(activep 'active)
|
||||
|
@ -4395,6 +4405,17 @@ Assume point is at the beginning of the timestamp."
|
|||
day-end (or (nth 3 date) day-start)
|
||||
hour-end (or (nth 2 date) (car time-range) hour-start)
|
||||
minute-end (or (nth 1 date) (cdr time-range) minute-start))))
|
||||
;; Diary timestamp with time.
|
||||
(when (and diaryp
|
||||
(string-match "\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\(-\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)?" date-start))
|
||||
(setq hour-start (match-string 1 date-start)
|
||||
minute-start (match-string 2 date-start)
|
||||
hour-end (match-string 4 date-start)
|
||||
minute-end (match-string 5 date-start))
|
||||
(when hour-start (setq hour-start (string-to-number hour-start)))
|
||||
(when minute-start (setq minute-start (string-to-number minute-start)))
|
||||
(when hour-end (setq hour-end (string-to-number hour-end)))
|
||||
(when minute-end (setq minute-end (string-to-number minute-end))))
|
||||
(org-element-create
|
||||
'timestamp
|
||||
(nconc (list :type type
|
||||
|
@ -4413,137 +4434,144 @@ Assume point is at the beginning of the timestamp."
|
|||
:begin begin
|
||||
:end end
|
||||
:post-blank post-blank)
|
||||
(and diary-sexp (list :diary-sexp diary-sexp))
|
||||
repeater-props
|
||||
warning-props))))))
|
||||
|
||||
(defun org-element-timestamp-interpreter (timestamp _)
|
||||
"Interpret TIMESTAMP object as Org syntax."
|
||||
(let((type (org-element-property :type timestamp)))
|
||||
(if (member type '(active inactive inactive-range active-range))
|
||||
(let ((day-start (org-element-property :day-start timestamp))
|
||||
(month-start (org-element-property :month-start timestamp))
|
||||
(year-start (org-element-property :year-start timestamp)))
|
||||
;; Return nil when start date is not available. Could also
|
||||
;; throw an error, but the current behavior is historical.
|
||||
(when (and day-start month-start year-start)
|
||||
(let* ((repeat-string
|
||||
(concat
|
||||
(pcase (org-element-property :repeater-type timestamp)
|
||||
(`cumulate "+") (`catch-up "++") (`restart ".+"))
|
||||
(let ((val (org-element-property :repeater-value timestamp)))
|
||||
(and val (number-to-string val)))
|
||||
(pcase (org-element-property :repeater-unit timestamp)
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))
|
||||
(when-let ((repeater-deadline-value
|
||||
(org-element-property :repeater-deadline-value timestamp))
|
||||
(repeater-deadline-unit
|
||||
(org-element-property :repeater-deadline-unit timestamp)))
|
||||
(concat
|
||||
"/"
|
||||
(number-to-string repeater-deadline-value)
|
||||
(pcase repeater-deadline-unit
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))))
|
||||
(range-type (org-element-property :range-type timestamp))
|
||||
(warning-string
|
||||
(concat
|
||||
(pcase (org-element-property :warning-type timestamp)
|
||||
(`first "--") (`all "-"))
|
||||
(let ((val (org-element-property :warning-value timestamp)))
|
||||
(and val (number-to-string val)))
|
||||
(pcase (org-element-property :warning-unit timestamp)
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))
|
||||
(hour-start (org-element-property :hour-start timestamp))
|
||||
(minute-start (org-element-property :minute-start timestamp))
|
||||
(brackets
|
||||
(if (member
|
||||
type
|
||||
'(inactive inactive-range))
|
||||
(cons "[" "]")
|
||||
(cons "<" ">")))
|
||||
(timestamp-end
|
||||
(concat
|
||||
(and (org-string-nw-p repeat-string) (concat " " repeat-string))
|
||||
(and (org-string-nw-p warning-string) (concat " " warning-string))
|
||||
(cdr brackets))))
|
||||
(concat
|
||||
;; Opening backet: [ or <
|
||||
(car brackets)
|
||||
;; Starting date/time: YYYY-MM-DD DAY[ HH:MM]
|
||||
(format-time-string
|
||||
;; `org-time-stamp-formats'.
|
||||
(org-time-stamp-format
|
||||
;; Ignore time unless both HH:MM are available.
|
||||
;; Ignore means (car org-timestamp-formats).
|
||||
(and minute-start hour-start)
|
||||
'no-brackets)
|
||||
(org-encode-time
|
||||
0 (or minute-start 0) (or hour-start 0)
|
||||
day-start month-start year-start))
|
||||
;; Range: -HH:MM or TIMESTAMP-END--[YYYY-MM-DD DAY HH:MM]
|
||||
(let ((hour-end (org-element-property :hour-end timestamp))
|
||||
(minute-end (org-element-property :minute-end timestamp)))
|
||||
(pcase type
|
||||
((or `active `inactive)
|
||||
;; `org-element-timestamp-parser' uses this type
|
||||
;; when no time/date range is provided. So,
|
||||
;; should normally return nil in this clause.
|
||||
(pcase range-type
|
||||
(`nil
|
||||
;; `org-element-timestamp-parser' assigns end
|
||||
;; times for `active'/`inactive' TYPE if start
|
||||
;; time is not nil. But manually built
|
||||
;; timestamps may not contain end times, so
|
||||
;; check for end times anyway.
|
||||
(when (and hour-start hour-end minute-start minute-end
|
||||
(or (/= hour-start hour-end)
|
||||
(/= minute-start minute-end)))
|
||||
;; Could also throw an error. Return range
|
||||
;; timestamp nevertheless to preserve
|
||||
;; historical behavior.
|
||||
(format "-%02d:%02d" hour-end minute-end)))
|
||||
((or `timerange `daterange)
|
||||
(error "`:range-type' must be `nil' for `active'/`inactive' type"))))
|
||||
;; Range must be present.
|
||||
((or `active-range `inactive-range)
|
||||
(pcase range-type
|
||||
;; End time: -HH:MM.
|
||||
;; Fall back to start time if end time is not defined (arbitrary historical choice).
|
||||
;; Error will be thrown if both end and begin time is not defined.
|
||||
(`timerange (format "-%02d:%02d" (or hour-end hour-start) (or minute-end minute-start)))
|
||||
;; End date: TIMESTAMP-END--[YYYY-MM-DD DAY HH:MM
|
||||
((or `daterange
|
||||
;; Should never happen in the output of `org-element-timestamp-parser'.
|
||||
;; Treat as an equivalent of `daterange' arbitrarily.
|
||||
`nil)
|
||||
(concat
|
||||
;; repeater + warning + closing > or ]
|
||||
;; This info is duplicated in date ranges.
|
||||
timestamp-end
|
||||
"--" (car brackets)
|
||||
(format-time-string
|
||||
;; `org-time-stamp-formats'.
|
||||
(org-time-stamp-format
|
||||
;; Ignore time unless both HH:MM are available.
|
||||
;; Ignore means (car org-timestamp-formats).
|
||||
(and minute-end hour-end)
|
||||
'no-brackets)
|
||||
(org-encode-time
|
||||
;; Closing HH:MM missing is a valid scenario.
|
||||
0 (or minute-end 0) (or hour-end 0)
|
||||
;; YEAR/MONTH/DAY-END will always be present
|
||||
;; for `daterange' range-type, as parsed by
|
||||
;; `org-element-timestamp-parser'.
|
||||
;; For manually constructed timestamp
|
||||
;; object, arbitrarily fall back to starting
|
||||
;; date.
|
||||
(or (org-element-property :day-end timestamp) day-start)
|
||||
(or (org-element-property :month-end timestamp) month-start)
|
||||
(or (org-element-property :year-end timestamp) year-start)))))))))
|
||||
;; repeater + warning + closing > or ]
|
||||
;; This info is duplicated in date ranges.
|
||||
timestamp-end))))
|
||||
;; diary type.
|
||||
(org-element-property :raw-value timestamp))))
|
||||
(let ((day-start (org-element-property :day-start timestamp))
|
||||
(month-start (org-element-property :month-start timestamp))
|
||||
(year-start (org-element-property :year-start timestamp)))
|
||||
;; Return nil when start date is not available. Could also
|
||||
;; throw an error, but the current behavior is historical.
|
||||
(when (or (and day-start month-start year-start)
|
||||
(eq type 'diary))
|
||||
(let* ((repeat-string
|
||||
(concat
|
||||
(pcase (org-element-property :repeater-type timestamp)
|
||||
(`cumulate "+") (`catch-up "++") (`restart ".+"))
|
||||
(let ((val (org-element-property :repeater-value timestamp)))
|
||||
(and val (number-to-string val)))
|
||||
(pcase (org-element-property :repeater-unit timestamp)
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))
|
||||
(when-let ((repeater-deadline-value
|
||||
(org-element-property :repeater-deadline-value timestamp))
|
||||
(repeater-deadline-unit
|
||||
(org-element-property :repeater-deadline-unit timestamp)))
|
||||
(concat
|
||||
"/"
|
||||
(number-to-string repeater-deadline-value)
|
||||
(pcase repeater-deadline-unit
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))))
|
||||
(range-type (org-element-property :range-type timestamp))
|
||||
(warning-string
|
||||
(concat
|
||||
(pcase (org-element-property :warning-type timestamp)
|
||||
(`first "--") (`all "-"))
|
||||
(let ((val (org-element-property :warning-value timestamp)))
|
||||
(and val (number-to-string val)))
|
||||
(pcase (org-element-property :warning-unit timestamp)
|
||||
(`hour "h") (`day "d") (`week "w") (`month "m") (`year "y"))))
|
||||
(hour-start (org-element-property :hour-start timestamp))
|
||||
(minute-start (org-element-property :minute-start timestamp))
|
||||
(brackets
|
||||
(if (member
|
||||
type
|
||||
'(inactive inactive-range))
|
||||
(cons "[" "]")
|
||||
;; diary as well
|
||||
(cons "<" ">")))
|
||||
(timestamp-end
|
||||
(concat
|
||||
(and (org-string-nw-p repeat-string) (concat " " repeat-string))
|
||||
(and (org-string-nw-p warning-string) (concat " " warning-string))
|
||||
(cdr brackets))))
|
||||
(concat
|
||||
;; Opening bracket: [ or <
|
||||
(car brackets)
|
||||
;; Starting date/time: YYYY-MM-DD DAY[ HH:MM]
|
||||
(if (eq type 'diary)
|
||||
(concat
|
||||
"%%"
|
||||
(org-element-property :diary-sexp timestamp)
|
||||
(when (and minute-start hour-start)
|
||||
(format " %02d:%02d" hour-start minute-start)))
|
||||
(format-time-string
|
||||
;; `org-time-stamp-formats'.
|
||||
(org-time-stamp-format
|
||||
;; Ignore time unless both HH:MM are available.
|
||||
;; Ignore means (car org-timestamp-formats).
|
||||
(and minute-start hour-start)
|
||||
'no-brackets)
|
||||
(org-encode-time
|
||||
0 (or minute-start 0) (or hour-start 0)
|
||||
day-start month-start year-start)))
|
||||
;; Range: -HH:MM or TIMESTAMP-END--[YYYY-MM-DD DAY HH:MM]
|
||||
(let ((hour-end (org-element-property :hour-end timestamp))
|
||||
(minute-end (org-element-property :minute-end timestamp)))
|
||||
(pcase type
|
||||
((or `active `inactive)
|
||||
;; `org-element-timestamp-parser' uses this type
|
||||
;; when no time/date range is provided. So,
|
||||
;; should normally return nil in this clause.
|
||||
(pcase range-type
|
||||
(`nil
|
||||
;; `org-element-timestamp-parser' assigns end
|
||||
;; times for `active'/`inactive' TYPE if start
|
||||
;; time is not nil. But manually built
|
||||
;; timestamps may not contain end times, so
|
||||
;; check for end times anyway.
|
||||
(when (and hour-start hour-end minute-start minute-end
|
||||
(or (/= hour-start hour-end)
|
||||
(/= minute-start minute-end)))
|
||||
;; Could also throw an error. Return range
|
||||
;; timestamp nevertheless to preserve
|
||||
;; historical behavior.
|
||||
(format "-%02d:%02d" hour-end minute-end)))
|
||||
((or `timerange `daterange)
|
||||
(error "`:range-type' must be `nil' for `active'/`inactive' type"))))
|
||||
;; Range must be present.
|
||||
((or `active-range `inactive-range
|
||||
(and `diary (guard (eq 'timerange range-type))))
|
||||
(pcase range-type
|
||||
;; End time: -HH:MM.
|
||||
;; Fall back to start time if end time is not defined (arbitrary historical choice).
|
||||
;; Error will be thrown if both end and begin time is not defined.
|
||||
(`timerange (format "-%02d:%02d" (or hour-end hour-start) (or minute-end minute-start)))
|
||||
;; End date: TIMESTAMP-END--[YYYY-MM-DD DAY HH:MM
|
||||
((or `daterange
|
||||
;; Should never happen in the output of `org-element-timestamp-parser'.
|
||||
;; Treat as an equivalent of `daterange' arbitrarily.
|
||||
`nil)
|
||||
(concat
|
||||
;; repeater + warning + closing > or ]
|
||||
;; This info is duplicated in date ranges.
|
||||
timestamp-end
|
||||
"--" (car brackets)
|
||||
(format-time-string
|
||||
;; `org-time-stamp-formats'.
|
||||
(org-time-stamp-format
|
||||
;; Ignore time unless both HH:MM are available.
|
||||
;; Ignore means (car org-timestamp-formats).
|
||||
(and minute-end hour-end)
|
||||
'no-brackets)
|
||||
(org-encode-time
|
||||
;; Closing HH:MM missing is a valid scenario.
|
||||
0 (or minute-end 0) (or hour-end 0)
|
||||
;; YEAR/MONTH/DAY-END will always be present
|
||||
;; for `daterange' range-type, as parsed by
|
||||
;; `org-element-timestamp-parser'.
|
||||
;; For manually constructed timestamp
|
||||
;; object, arbitrarily fall back to starting
|
||||
;; date.
|
||||
(or (org-element-property :day-end timestamp) day-start)
|
||||
(or (org-element-property :month-end timestamp) month-start)
|
||||
(or (org-element-property :year-end timestamp) year-start)))))))))
|
||||
;; repeater + warning + closing > or ]
|
||||
;; This info is duplicated in date ranges.
|
||||
timestamp-end))))))
|
||||
;;;; Underline
|
||||
|
||||
(defun org-element-underline-parser ()
|
||||
|
@ -4795,8 +4823,6 @@ element it has to parse."
|
|||
(looking-at-p rule-regexp)))))))
|
||||
(org-element-table-parser limit affiliated))
|
||||
;; List.
|
||||
;; FIXME: Instead of generating regexps, we should
|
||||
;; better use a constant.
|
||||
((looking-at-p (org-item-re))
|
||||
(org-element-plain-list-parser
|
||||
limit affiliated
|
||||
|
@ -6121,11 +6147,8 @@ This function assumes `org-element--headline-cache' is a valid AVL tree."
|
|||
|
||||
;;;; Tools
|
||||
|
||||
;; FIXME: Ideally, this should be inlined to avoid overheads, but
|
||||
;; inlined functions should be declared before the code that uses them
|
||||
;; and some code above does use `org-element--cache-active-p'. Moving this
|
||||
;; declaration on top would require restructuring the whole cache
|
||||
;; section.
|
||||
;; FIXME: `org-fold-core-cycle-over-indirect-buffers' should better be
|
||||
;; taken out of org-fold-core to track indirect buffers in general.
|
||||
(defun org-element--cache-active-p (&optional called-from-cache-change-func-p)
|
||||
"Non-nil when cache is active in current buffer.
|
||||
When CALLED-FROM-CACHE-CHANGE-FUNC-P is non-nil, do not assert cache
|
||||
|
@ -7224,6 +7247,11 @@ that range. See `after-change-functions' for more information."
|
|||
(when (buffer-base-buffer)
|
||||
(setq-local org-element--cache nil)
|
||||
(setq-local org-element--headline-cache nil))
|
||||
;; Register current buffer in `org-fold-core--indirect-buffers' to
|
||||
;; be used within `org-fold-core-cycle-over-indirect-buffers'.
|
||||
;; FIXME: We should eventually factor out indirect buffer tracking
|
||||
;; from org-fold-core.
|
||||
(org-fold-core-decouple-indirect-buffer-folds)
|
||||
(add-hook 'before-change-functions
|
||||
#'org-element--cache-before-change nil t)
|
||||
;; Run `org-element--cache-after-change' early to handle cases
|
||||
|
@ -8292,8 +8320,11 @@ the cache."
|
|||
;; Reached LIMIT-COUNT. Abort.
|
||||
(when (and limit-count
|
||||
(>= count-predicate-calls-match
|
||||
limit-count))
|
||||
(cache-walk-abort)))
|
||||
limit-count))
|
||||
(cache-walk-abort))
|
||||
;; Make sure that we have a cached
|
||||
;; element at the new STAR.
|
||||
(when start (element-match-at-point)))
|
||||
;; Check if the buffer or cache has been modified.
|
||||
(unless (org-with-base-buffer nil
|
||||
(and (eq modified-tic org-element--cache-change-tic)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>,
|
||||
;; Ulf Stegemann <ulf at zeitform dot de>
|
||||
;; Keywords: outlines, calendar, wp
|
||||
;; Keywords: outlines, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -290,7 +290,7 @@ generally less error-prone with regard to third-party packages.
|
|||
|
||||
Important: This variable must be set before loading Org."
|
||||
:group 'org
|
||||
:package-version '(Org . "9.6")
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(choice
|
||||
(const :tag "Overlays" overlays)
|
||||
(const :tag "Text properties" text-properties)))
|
||||
|
@ -581,15 +581,6 @@ unless RETURN-ONLY is non-nil."
|
|||
;; would contain folding properties, which are not
|
||||
;; matching the generated `local-prop'.
|
||||
(unless (member local-prop (cdr (assq 'invisible char-property-alias-alist)))
|
||||
;; Add current buffer to the list of indirect buffers in the base buffer.
|
||||
(when (buffer-base-buffer)
|
||||
(with-current-buffer (buffer-base-buffer)
|
||||
(setq-local org-fold-core--indirect-buffers
|
||||
(let (bufs)
|
||||
(org-fold-core-cycle-over-indirect-buffers
|
||||
(push (current-buffer) bufs))
|
||||
(push buf bufs)
|
||||
(delete-dups bufs)))))
|
||||
;; Copy all the old folding properties to preserve the folding state
|
||||
(with-silent-modifications
|
||||
(dolist (old-prop (cdr (assq 'invisible char-property-alias-alist)))
|
||||
|
@ -648,6 +639,16 @@ unless RETURN-ONLY is non-nil."
|
|||
"Copy and decouple folding state in a newly created indirect buffer.
|
||||
This function is mostly intended to be used in
|
||||
`clone-indirect-buffer-hook'."
|
||||
;; Add current buffer to the list of indirect buffers in the base buffer.
|
||||
(when (buffer-base-buffer)
|
||||
(let ((new-buffer (current-buffer)))
|
||||
(with-current-buffer (buffer-base-buffer)
|
||||
(setq-local org-fold-core--indirect-buffers
|
||||
(let (bufs)
|
||||
(org-fold-core-cycle-over-indirect-buffers
|
||||
(push (current-buffer) bufs))
|
||||
(push new-buffer bufs)
|
||||
(delete-dups bufs))))))
|
||||
(when (and (buffer-base-buffer)
|
||||
(eq org-fold-core-style 'text-properties)
|
||||
(not (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers)))
|
||||
|
@ -705,7 +706,7 @@ The folding spec properties will be set to PROPERTIES (see
|
|||
(let* ((full-properties (mapcar (lambda (prop) (cons prop (cdr (assq prop properties))))
|
||||
'( :visible :ellipsis :isearch-ignore
|
||||
:global :isearch-open :front-sticky
|
||||
:rear-sticky :fragile :alias)))
|
||||
:rear-sticky :fragile :alias :font-lock)))
|
||||
(full-spec (cons spec full-properties)))
|
||||
(add-to-list 'org-fold-core--specs full-spec append)
|
||||
(mapc (lambda (prop-cons) (org-fold-core-set-folding-spec-property spec (car prop-cons) (cdr prop-cons) 'force)) full-properties)
|
||||
|
@ -1094,8 +1095,7 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
|
|||
(overlay-put o 'invisible spec)
|
||||
;; Preserve priority.
|
||||
(overlay-put o 'priority (length (member spec (org-fold-core-folding-spec-list))))
|
||||
(overlay-put o 'isearch-open-invisible #'org-fold-core--isearch-show)
|
||||
(overlay-put o 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary))
|
||||
(overlay-put o 'isearch-open-invisible #'org-fold-core--isearch-show))
|
||||
(put-text-property from to (org-fold-core--property-symbol-get-create spec) spec)
|
||||
(put-text-property from to 'isearch-open-invisible #'org-fold-core--isearch-show)
|
||||
(put-text-property from to 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary)
|
||||
|
@ -1246,7 +1246,9 @@ This function is intended to be used as `isearch-filter-predicate'."
|
|||
;; FIXME: Reveal the match (usually point, but may sometimes go beyond the region).
|
||||
(when (< beg (point) end)
|
||||
(funcall org-fold-core-isearch-open-function (point)))
|
||||
(org-fold-core-region beg end nil)))
|
||||
(if (overlayp overlay-or-region)
|
||||
(delete-overlay overlay-or-region)
|
||||
(org-fold-core-region beg end nil))))
|
||||
|
||||
(defun org-fold-core--isearch-show-temporary (region hide-p)
|
||||
"Temporarily reveal text in REGION.
|
||||
|
|
|
@ -49,8 +49,6 @@
|
|||
(require 'org-fold-core)
|
||||
|
||||
(defvar org-inlinetask-min-level)
|
||||
(defvar org-link--link-folding-spec)
|
||||
(defvar org-link--description-folding-spec)
|
||||
(defvar org-odd-levels-only)
|
||||
(defvar org-drawer-regexp)
|
||||
(defvar org-property-end-re)
|
||||
|
@ -280,9 +278,7 @@ Also, see `org-fold-catch-invisible-edits'."
|
|||
(:isearch-open . t)
|
||||
(:font-lock . t)
|
||||
(:front-sticky . t)
|
||||
(:alias . (drawer property-drawer)))
|
||||
,org-link--description-folding-spec
|
||||
,org-link--link-folding-spec)))
|
||||
(:alias . (drawer property-drawer))))))
|
||||
|
||||
;;;; Searching and examining folded text
|
||||
|
||||
|
@ -679,19 +675,12 @@ DETAIL is either nil, `minimal', `local', `ancestors',
|
|||
(org-with-point-at (car region)
|
||||
(forward-line 0)
|
||||
(let (font-lock-extend-region-functions)
|
||||
(font-lock-fontify-region (max (point-min) (1- (car region))) (cdr region))))))
|
||||
;; Unfold links.
|
||||
(let (region)
|
||||
(dolist (spec '(org-link org-link-description))
|
||||
(setq region (org-fold-get-region-at-point spec))
|
||||
(when region (org-fold-region (car region) (cdr region) nil spec)))))
|
||||
(font-lock-fontify-region (max (point-min) (1- (car region))) (cdr region)))))))
|
||||
(let (region)
|
||||
(dolist (spec (org-fold-core-folding-spec-list))
|
||||
;; Links are taken care by above.
|
||||
(unless (memq spec '(org-link org-link-description))
|
||||
(setq region (org-fold-get-region-at-point spec))
|
||||
(when region
|
||||
(org-fold-region (car region) (cdr region) nil spec))))))
|
||||
(setq region (org-fold-get-region-at-point spec))
|
||||
(when region
|
||||
(org-fold-region (car region) (cdr region) nil spec)))))
|
||||
(unless (org-before-first-heading-p)
|
||||
(org-with-limited-levels
|
||||
(cl-case detail
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -143,11 +143,12 @@ confirm Like t, but let the user edit the created value.
|
|||
an anonymous footnote.
|
||||
random Automatically generate a unique, random label."
|
||||
:group 'org-footnote
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(choice
|
||||
(const :tag "Prompt for label" nil)
|
||||
(const :tag "Create automatic [fn:N]" t)
|
||||
(const :tag "Offer automatic [fn:N] for editing" confirm)
|
||||
(const :tag "Create anoymous [fn::]" anonymous)
|
||||
(const :tag "Create anonymous [fn::]" anonymous)
|
||||
(const :tag "Create a random label" random))
|
||||
:safe #'symbolp)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: John Wiegley <johnw at gnu dot org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -760,8 +760,7 @@ command."
|
|||
|
||||
(defun org--print-speed-command (speed-command)
|
||||
"Print information about SPEED-COMMAND in help buffer.
|
||||
SPEED-COMMAND is an element of `org-speed-commands' or
|
||||
`org-speed-commands-user'."
|
||||
SPEED-COMMAND is an element of `org-speed-commands'."
|
||||
(if (> (length (car speed-command)) 1)
|
||||
(progn
|
||||
(princ "\n")
|
||||
|
@ -783,12 +782,7 @@ SPEED-COMMAND is an element of `org-speed-commands' or
|
|||
(user-error "Speed commands are not activated, customize `org-use-speed-commands'"))
|
||||
(with-output-to-temp-buffer "*Help*"
|
||||
(princ "Speed commands\n==============\n")
|
||||
(mapc #'org--print-speed-command
|
||||
;; FIXME: don't check `org-speed-commands-user' past 9.6
|
||||
(if (boundp 'org-speed-commands-user)
|
||||
(append org-speed-commands
|
||||
org-speed-commands-user)
|
||||
org-speed-commands)))
|
||||
(mapc #'org--print-speed-command org-speed-commands))
|
||||
(with-current-buffer "*Help*"
|
||||
(setq truncate-lines t)))
|
||||
|
||||
|
@ -809,12 +803,7 @@ See `org-speed-commands' for configuring them."
|
|||
(when (or (and (bolp) (looking-at org-outline-regexp))
|
||||
(and (functionp org-use-speed-commands)
|
||||
(funcall org-use-speed-commands)))
|
||||
(cdr (assoc keys
|
||||
;; FIXME: don't check `org-speed-commands-user' past 9.6
|
||||
(if (boundp 'org-speed-commands-user)
|
||||
(append org-speed-commands
|
||||
org-speed-commands-user)
|
||||
org-speed-commands)))))
|
||||
(cdr (assoc keys org-speed-commands))))
|
||||
|
||||
|
||||
;;; Babel speed keys
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2015-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -159,6 +159,16 @@ checker. Currently, two properties are supported:
|
|||
(seq-remove (lambda (c) (eq name (org-lint-checker-name c)))
|
||||
org-lint--checkers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-lint-remove-checker (name &rest names)
|
||||
"Remove checker(s) from linter.
|
||||
NAME is the unique check identifier, as a non-nil symbol. NAMES
|
||||
are additional check identifiers to be removed."
|
||||
(let ((removelist (cons name names)))
|
||||
(setq org-lint--checkers
|
||||
(seq-remove (lambda (c) (memq (org-lint-checker-name c) removelist))
|
||||
org-lint--checkers))))
|
||||
|
||||
|
||||
;;; Reports UI
|
||||
|
||||
|
@ -388,14 +398,25 @@ called with one argument, the key used for comparison."
|
|||
(dolist (e originals reports) (funcall make-report (cdr e) (car e)))))
|
||||
|
||||
(defun org-lint-misplaced-heading (ast)
|
||||
"Check for accidentally misplaced heading lines."
|
||||
"Check for accidentally misplaced heading lines.
|
||||
Example:
|
||||
** Heading 1
|
||||
** Heading 2** Oops heading 3
|
||||
** Heading 4"
|
||||
(org-with-point-at ast
|
||||
(goto-char (point-min))
|
||||
(let (result)
|
||||
;; Heuristics for 2+ level heading not at bol.
|
||||
(while (re-search-forward (rx (not (any "*\n\r ,")) ;; Not a bol; not escaped ,** heading; not " *** words"
|
||||
"*" (1+ "*") " ") nil t)
|
||||
(push (list (match-beginning 0) "Possibly misplaced heading line") result))
|
||||
;; Limit false-positive rate by only complaining about
|
||||
;; ** Heading** Heading and
|
||||
;; ** Oops heading
|
||||
;; Paragraph** Oops heading
|
||||
(when (org-element-type-p
|
||||
(org-element-at-point)
|
||||
'(paragraph headline))
|
||||
(push (list (match-beginning 0) "Possibly misplaced heading line") result)))
|
||||
result)))
|
||||
|
||||
(defun org-lint-duplicate-custom-id (ast)
|
||||
|
@ -541,7 +562,10 @@ Use :header-args: instead"
|
|||
(org-element-map ast 'src-block
|
||||
(lambda (b)
|
||||
(when-let ((lang (org-element-property :language b)))
|
||||
(unless (functionp (intern (format "org-babel-execute:%s" lang)))
|
||||
(unless (or (functionp (intern (format "org-babel-execute:%s" lang)))
|
||||
;; No babel backend, but there is corresponding
|
||||
;; major mode.
|
||||
(fboundp (org-src-get-lang-mode lang)))
|
||||
(list (org-element-property :post-affiliated b)
|
||||
(format "Unknown source block language: '%s'" lang)))))))
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Bastien Guerry <bzg@gnu.org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -2979,7 +2979,7 @@ function is being called interactively."
|
|||
(error "Missing key extractor"))))
|
||||
(sort-func
|
||||
(cond
|
||||
((= dcst ?a) #'string-collate-lessp)
|
||||
((= dcst ?a) #'org-string<)
|
||||
((= dcst ?f)
|
||||
(or compare-func
|
||||
(and interactive?
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2013-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -113,7 +113,6 @@ Version mismatch is commonly encountered in the following situations:
|
|||
(declare-function org-fold-next-visibility-change "org-fold" (&optional pos limit ignore-hidden-p previous-p))
|
||||
(declare-function org-fold-core-with-forced-fontification "org-fold" (&rest body))
|
||||
(declare-function org-fold-folded-p "org-fold" (&optional pos limit ignore-hidden-p previous-p))
|
||||
(declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
|
||||
(declare-function org-time-convert-to-list "org-compat" (time))
|
||||
(declare-function org-buffer-text-pixel-width "org-compat" ())
|
||||
|
||||
|
@ -268,6 +267,7 @@ This function is only useful when called from Agenda buffer."
|
|||
(unless modified
|
||||
(restore-buffer-modified-p nil))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro org-element-with-disabled-cache (&rest body)
|
||||
"Run BODY without active org-element-cache."
|
||||
(declare (debug (form body)) (indent 0))
|
||||
|
@ -815,7 +815,7 @@ Match at beginning of line when WITH-BOL is non-nil."
|
|||
(and (not (bobp))
|
||||
(save-excursion
|
||||
(forward-line n)
|
||||
(skip-chars-forward "[ \t]")
|
||||
(skip-chars-forward " \t")
|
||||
(eolp))))
|
||||
|
||||
(defun org-previous-line-empty-p ()
|
||||
|
@ -982,20 +982,67 @@ return nil."
|
|||
|
||||
;;; String manipulation
|
||||
|
||||
(defun org-string< (a b)
|
||||
(string-collate-lessp a b))
|
||||
(defcustom org-sort-function #'string-collate-lessp
|
||||
"Function used to compare strings when sorting.
|
||||
This function affects how Org mode sorts headlines, agenda items,
|
||||
table lines, etc.
|
||||
|
||||
(defun org-string<= (a b)
|
||||
(or (string= a b) (string-collate-lessp a b)))
|
||||
The function must accept either 2 or 4 arguments: strings to compare
|
||||
and, optionally, LOCALE and IGNORE-CASE - locale name and flag to make
|
||||
comparison case-insensitive.
|
||||
|
||||
(defun org-string>= (a b)
|
||||
(not (string-collate-lessp a b)))
|
||||
The default value uses sorting rules according to OS language. Users
|
||||
who want to make sorting language-independent, may customize the value
|
||||
to `org-sort-function-fallback'.
|
||||
|
||||
(defun org-string> (a b)
|
||||
Note that some string sorting rules are known to be not accurate on
|
||||
MacOS. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275.
|
||||
MacOS users may customize the value to
|
||||
`org-sort-function-fallback'."
|
||||
:group 'org
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(choice
|
||||
(const :tag "According to OS language" string-collate-lessp)
|
||||
(const :tag "Using string comparison" org-sort-function-fallback)
|
||||
(function :tag "Custom function")))
|
||||
|
||||
(defun org-sort-function-fallback (a b &optional _ ignore-case)
|
||||
"Return non-nil when downcased string A < string B.
|
||||
Use `compare-strings' for comparison. Honor IGNORE-CASE."
|
||||
(let ((ans (compare-strings a nil nil b nil nil ignore-case)))
|
||||
(cond
|
||||
((and (numberp ans) (< ans 0)) t)
|
||||
(t nil))))
|
||||
|
||||
(defun org-string< (a b &optional locale ignore-case)
|
||||
"Return non-nil when string A < string B.
|
||||
LOCALE is the locale name. IGNORE-CASE, when non-nil, makes comparison
|
||||
ignore case."
|
||||
(if (= 4 (cdr (func-arity org-sort-function)))
|
||||
(funcall org-sort-function a b locale ignore-case)
|
||||
(funcall org-sort-function a b)))
|
||||
|
||||
(defun org-string<= (a b &optional locale ignore-case)
|
||||
"Return non-nil when string A <= string B.
|
||||
LOCALE is the locale name. IGNORE-CASE, when non-nil, makes comparison
|
||||
ignore case."
|
||||
(or (string= a b) (org-string< a b locale ignore-case)))
|
||||
|
||||
(defun org-string>= (a b &optional locale ignore-case)
|
||||
"Return non-nil when string A >= string B.
|
||||
LOCALE is the locale name. IGNORE-CASE, when non-nil, makes comparison
|
||||
ignore case."
|
||||
(not (org-string< a b locale ignore-case)))
|
||||
|
||||
(defun org-string> (a b &optional locale ignore-case)
|
||||
"Return non-nil when string A > string B.
|
||||
LOCALE is the locale name. IGNORE-CASE, when non-nil, makes comparison
|
||||
ignore case."
|
||||
(and (not (string= a b))
|
||||
(not (string-collate-lessp a b))))
|
||||
(not (org-string< a b locale ignore-case))))
|
||||
|
||||
(defun org-string<> (a b)
|
||||
"Return non-nil when string A and string B are not equal."
|
||||
(not (string= a b)))
|
||||
|
||||
(defsubst org-trim (s &optional keep-lead)
|
||||
|
@ -1244,6 +1291,10 @@ Assumes that s is a single line, starting in column 0."
|
|||
t t s)))
|
||||
s)
|
||||
|
||||
(defun org-remove-blank-lines (s)
|
||||
"Remove blank lines in S."
|
||||
(replace-regexp-in-string (rx "\n" (1+ (0+ space) "\n")) "\n" s))
|
||||
|
||||
(defun org-wrap (string &optional width lines)
|
||||
"Wrap string to either a number of lines, or a width in characters.
|
||||
If WIDTH is non-nil, the string is wrapped to that width, however many lines
|
||||
|
@ -1744,6 +1795,23 @@ indirectly called by the latter."
|
|||
(prog1 nil
|
||||
(set-window-configuration window-configuration)))))
|
||||
|
||||
(defun org-display-buffer-in-window (buffer alist)
|
||||
"Display BUFFER in specific window.
|
||||
The window is defined according to the `window' slot in the ALIST.
|
||||
Then `same-frame' slot in the ALIST is set, only display buffer when
|
||||
window is present in the current frame.
|
||||
|
||||
This is an action function for buffer display, see Info
|
||||
node `(elisp) Buffer Display Action Functions'. It should be
|
||||
called only by `display-buffer' or a function directly or
|
||||
indirectly called by the latter."
|
||||
(let ((window (alist-get 'window alist)))
|
||||
(when (and window
|
||||
(window-live-p window)
|
||||
(or (not (alist-get 'same-frame alist))
|
||||
(eq (window-frame) (window-frame window))))
|
||||
(window--display-buffer buffer window 'reuse alist))))
|
||||
|
||||
(provide 'org-macs)
|
||||
|
||||
;; Local variables:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -1057,7 +1057,7 @@ be returned that indicates what went wrong."
|
|||
(goto-char (match-beginning 4))
|
||||
(insert new)
|
||||
(delete-region (point) (+ (point) (length current)))
|
||||
(org-align-tags))
|
||||
(when org-auto-align-tags (org-align-tags)))
|
||||
(t
|
||||
(error
|
||||
"Heading changed in the mobile device and on the computer")))))))
|
||||
|
|
|
@ -426,13 +426,14 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
|
|||
(append
|
||||
(let ((tags (org-get-tags nil t)))
|
||||
(org-mouse-keyword-menu
|
||||
(sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp)
|
||||
(sort (mapcar #'car (org-get-buffer-tags))
|
||||
(or org-tags-sort-function #'org-string<))
|
||||
(lambda (tag)
|
||||
(org-mouse-set-tags
|
||||
(sort (if (member tag tags)
|
||||
(delete tag tags)
|
||||
(cons tag tags))
|
||||
#'string-lessp)))
|
||||
(or org-tags-sort-function #'org-string<))))
|
||||
(lambda (tag) (member tag tags))
|
||||
))
|
||||
'("--"
|
||||
|
@ -473,7 +474,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
|
|||
(sort (if (member ',name ',options)
|
||||
(delete ',name ',options)
|
||||
(cons ',name ',options))
|
||||
'string-lessp)
|
||||
#'org-string<)
|
||||
" ")
|
||||
nil nil nil 1)
|
||||
(when (functionp ',function) (funcall ',function)))
|
||||
|
@ -502,7 +503,8 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
|
|||
["Check TODOs" org-show-todo-tree t]
|
||||
("Check Tags"
|
||||
,@(org-mouse-keyword-menu
|
||||
(sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp)
|
||||
(sort (mapcar #'car (org-get-buffer-tags))
|
||||
(or org-tags-sort-function #'org-string<))
|
||||
(lambda (tag) (org-tags-sparse-tree nil tag)))
|
||||
"--"
|
||||
["Custom Tag ..." org-tags-sparse-tree t])
|
||||
|
@ -512,7 +514,8 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
|
|||
["Display TODO List" org-todo-list t]
|
||||
("Display Tags"
|
||||
,@(org-mouse-keyword-menu
|
||||
(sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp)
|
||||
(sort (mapcar #'car (org-get-buffer-tags))
|
||||
(or org-tags-sort-function #'org-string<))
|
||||
(lambda (tag) (org-tags-view nil tag)))
|
||||
"--"
|
||||
["Custom Tag ..." org-tags-view t])
|
||||
|
@ -859,6 +862,10 @@ This means, between the beginning of line and the point."
|
|||
(org-mouse-in-region-p (posn-point (event-start event))))
|
||||
(mouse-drag-region event)))
|
||||
|
||||
;; This function conflicts with touch screen gestures as it relays
|
||||
;; events to `mouse-drag-region'.
|
||||
(put 'org-mouse-down-mouse 'ignored-mouse-command t)
|
||||
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(setq org-mouse-context-menu-function #'org-mouse-context-menu)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2018-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; John Wiegley <johnw at gnu dot org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; This library implementes completion support in Org mode buffers.
|
||||
;; This library implements completion support in Org mode buffers.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ FORMAT and ARGS are passed to `message'."
|
|||
"Write elisp DATA to FILE."
|
||||
;; Fsync slightly reduces the chance of an incomplete filesystem
|
||||
;; write, however on modern hardware its effectiveness is
|
||||
;; questionable and it is insufficient to garantee complete writes.
|
||||
;; questionable and it is insufficient to guarantee complete writes.
|
||||
;; Coupled with the significant performance hit if writing many
|
||||
;; small files, it simply does not make sense to use fsync here,
|
||||
;; particularly as cache corruption is only a minor inconvenience.
|
||||
|
@ -476,12 +476,17 @@ FORMAT and ARGS are passed to `message'."
|
|||
(start-time (float-time)))
|
||||
(unless (file-exists-p (file-name-directory file))
|
||||
(make-directory (file-name-directory file) t))
|
||||
(with-temp-file file
|
||||
(insert ";; -*- mode: lisp-data; -*-\n")
|
||||
(if pp
|
||||
(let ((pp-use-max-width nil)) ; Emacs bug#58687
|
||||
(pp data (current-buffer)))
|
||||
(prin1 data (current-buffer))))
|
||||
;; Force writing even when the file happens to be opened by
|
||||
;; another Emacs process.
|
||||
(cl-letf (((symbol-function #'ask-user-about-lock)
|
||||
;; FIXME: Emacs 27 does not yet have `always'.
|
||||
(lambda (&rest _) t)))
|
||||
(with-temp-file file
|
||||
(insert ";; -*- mode: lisp-data; -*-\n")
|
||||
(if pp
|
||||
(let ((pp-use-max-width nil)) ; Emacs bug#58687
|
||||
(pp data (current-buffer)))
|
||||
(prin1 data (current-buffer)))))
|
||||
(org-persist--display-time
|
||||
(- (float-time) start-time)
|
||||
"Writing to %S" file)))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
;; Sebastian Rose <sebastian_rose AT gmx DOT de>
|
||||
;; Ross Patterson <me AT rpatterson DOT net>
|
||||
;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
|
||||
;; Keywords: org, emacsclient, wp
|
||||
;; Keywords: org, emacsclient, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
;;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Bastien Guerry <bzg@gnu.org>
|
||||
;; Dan Davison <davison at stats dot ox dot ac dot uk>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -754,8 +754,6 @@ as `org-src-fontify-natively' is non-nil."
|
|||
(s (and b (make-string (* (- e b) native-tab-width) ? ))))
|
||||
(when (and b (< b e)) (add-text-properties b e `(display ,s)))
|
||||
(forward-char)))))
|
||||
;; Clear abbreviated link folding.
|
||||
(org-fold-region start end nil 'org-link)
|
||||
(add-text-properties
|
||||
start end
|
||||
'(font-lock-fontified t fontified t font-lock-multiline t))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -419,7 +419,7 @@ It is probably good to never set this variable to nil, for the sake of
|
|||
portability of tables."
|
||||
:group 'org-table-calculation
|
||||
:type '(choice
|
||||
(const :tag "Allow to cross" t)
|
||||
(const :tag "Allow crossing hline" t)
|
||||
(const :tag "Stick to hline" nil)
|
||||
(const :tag "Error on attempt to cross" error)))
|
||||
|
||||
|
@ -892,7 +892,10 @@ nil When nil, the command tries to be smart and figure out the
|
|||
separator in the following way:
|
||||
- when each line contains a TAB, assume TAB-separated material
|
||||
- when each line contains a comma, assume CSV material
|
||||
- else, assume one or more SPACE characters as separator."
|
||||
- else, assume one or more SPACE characters as separator.
|
||||
`babel-auto'
|
||||
Use the same rules as nil, but do not try any separator when
|
||||
the region contains a single line and has no commas or tabs."
|
||||
(interactive "r\nP")
|
||||
(let* ((beg (min beg0 end0))
|
||||
(end (max beg0 end0))
|
||||
|
@ -909,12 +912,15 @@ nil When nil, the command tries to be smart and figure out the
|
|||
(if (bolp) (backward-char 1) (end-of-line 1))
|
||||
(setq end (point-marker))
|
||||
;; Get the right field separator
|
||||
(unless separator
|
||||
(when (or (not separator) (eq separator 'babel-auto))
|
||||
(goto-char beg)
|
||||
(setq separator
|
||||
(cond
|
||||
((not (re-search-forward "^[^\n\t]+$" end t)) '(16))
|
||||
((not (re-search-forward "^[^\n,]+$" end t)) '(4))
|
||||
((not (save-excursion (re-search-forward "^[^\n\t]+$" end t))) '(16))
|
||||
((not (save-excursion (re-search-forward "^[^\n,]+$" end t))) '(4))
|
||||
((and (eq separator 'babel-auto)
|
||||
(= 1 (count-lines beg end)))
|
||||
(rx unmatchable))
|
||||
(t 1))))
|
||||
(goto-char beg)
|
||||
(if (equal separator '(4))
|
||||
|
@ -2881,15 +2887,15 @@ list, `literal' is for the format specifier L."
|
|||
(if lispp
|
||||
(if (eq lispp 'literal)
|
||||
elements
|
||||
(if (and (eq elements "") (not keep-empty))
|
||||
;; FIXME: This branch of `if' is never used because
|
||||
;; strings are never `eq' here. But changing to
|
||||
;; `equal' breaks tests.
|
||||
;; See
|
||||
;; https://list.orgmode.org/orgmode/20230827214320.46754-1-salutis@me.com/
|
||||
""
|
||||
(prin1-to-string
|
||||
(if numbers (string-to-number elements) elements))))
|
||||
;; Ignore KEEP-EMPTY here.
|
||||
;; When ELEMENTS="" and NUMBERS=t, (string-to-number "")
|
||||
;; returns 0 - consistent with (0) for Calc branch.
|
||||
;; When ELEMENTS="" and NUMBERS=nil, `prin1-to-string' will
|
||||
;; return "\"\"" - historical behavior that also does not
|
||||
;; leave missing arguments in formulas like (string< $1 $2)
|
||||
;; when $2 cell is empty.
|
||||
(prin1-to-string
|
||||
(if numbers (string-to-number elements) elements)))
|
||||
(if (string-match "\\S-" elements)
|
||||
(progn
|
||||
(when numbers (setq elements (number-to-string
|
||||
|
@ -3929,7 +3935,7 @@ When non-nil, return the overlay narrowing the field."
|
|||
;; Aligning table from the first row will not shrink again the
|
||||
;; second row, which was not visible initially.
|
||||
;;
|
||||
;; However, fixing it requires to check every row, which may be
|
||||
;; However, fixing it requires checking every row, which may be
|
||||
;; slow on large tables. Moreover, the hindrance of this
|
||||
;; pathological case is very limited.
|
||||
(forward-line 0)
|
||||
|
@ -4631,8 +4637,8 @@ function is being called interactively."
|
|||
(predicate
|
||||
(cl-case sorting-type
|
||||
((?n ?N ?t ?T) #'<)
|
||||
((?a ?A) (if with-case #'string-collate-lessp
|
||||
(lambda (s1 s2) (string-collate-lessp s1 s2 nil t))))
|
||||
((?a ?A) (if with-case #'org-string<
|
||||
(lambda (s1 s2) (org-string< s1 s2 nil t))))
|
||||
((?f ?F)
|
||||
(or compare-func
|
||||
(and interactive?
|
||||
|
@ -5219,7 +5225,7 @@ When LOCAL is non-nil, show references for the table at point."
|
|||
;; accident in Org mode.
|
||||
(message "Orgtbl mode is not useful in Org mode, command ignored"))
|
||||
(orgtbl-mode
|
||||
(and (orgtbl-setup) (defun orgtbl-setup () nil)) ;; FIXME: Yuck!?!
|
||||
(orgtbl-setup)
|
||||
;; Make sure we are first in minor-mode-map-alist
|
||||
(let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
|
||||
;; FIXME: maybe it should use emulation-mode-map-alists?
|
||||
|
@ -5274,92 +5280,91 @@ to execute outside of tables."
|
|||
(interactive)
|
||||
(user-error "This key has no function outside tables"))
|
||||
|
||||
;; Fill in orgtbl keymap.
|
||||
(let ((nfunc 0)
|
||||
(bindings
|
||||
'(([(meta shift left)] org-table-delete-column)
|
||||
([(meta left)] org-table-move-column-left)
|
||||
([(meta right)] org-table-move-column-right)
|
||||
([(meta shift right)] org-table-insert-column)
|
||||
([(meta shift up)] org-table-kill-row)
|
||||
([(meta shift down)] org-table-insert-row)
|
||||
([(meta up)] org-table-move-row-up)
|
||||
([(meta down)] org-table-move-row-down)
|
||||
("\C-c\C-w" org-table-cut-region)
|
||||
("\C-c\M-w" org-table-copy-region)
|
||||
("\C-c\C-y" org-table-paste-rectangle)
|
||||
("\C-c\C-w" org-table-wrap-region)
|
||||
("\C-c-" org-table-insert-hline)
|
||||
("\C-c}" org-table-toggle-coordinate-overlays)
|
||||
("\C-c{" org-table-toggle-formula-debugger)
|
||||
("\C-m" org-table-next-row)
|
||||
([(shift return)] org-table-copy-down)
|
||||
("\C-c?" org-table-field-info)
|
||||
("\C-c " org-table-blank-field)
|
||||
("\C-c+" org-table-sum)
|
||||
("\C-c=" org-table-eval-formula)
|
||||
("\C-c'" org-table-edit-formulas)
|
||||
("\C-c`" org-table-edit-field)
|
||||
("\C-c*" org-table-recalculate)
|
||||
("\C-c^" org-table-sort-lines)
|
||||
("\M-a" org-table-beginning-of-field)
|
||||
("\M-e" org-table-end-of-field)
|
||||
([(control ?#)] org-table-rotate-recalc-marks)))
|
||||
elt key fun cmd)
|
||||
(while (setq elt (pop bindings))
|
||||
(setq nfunc (1+ nfunc))
|
||||
(setq key (org-key (car elt))
|
||||
fun (nth 1 elt)
|
||||
cmd (orgtbl-make-binding fun nfunc key))
|
||||
(org-defkey orgtbl-mode-map key cmd))
|
||||
|
||||
;; Special treatment needed for TAB, RET and DEL
|
||||
(org-defkey orgtbl-mode-map [(return)]
|
||||
(orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
|
||||
(org-defkey orgtbl-mode-map "\C-m"
|
||||
(orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
|
||||
(org-defkey orgtbl-mode-map [(tab)]
|
||||
(orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
|
||||
(org-defkey orgtbl-mode-map "\C-i"
|
||||
(orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)]))
|
||||
(org-defkey orgtbl-mode-map [(shift tab)]
|
||||
(orgtbl-make-binding 'org-table-previous-field 104
|
||||
[(shift tab)] [(tab)] "\C-i"))
|
||||
(org-defkey orgtbl-mode-map [backspace]
|
||||
(orgtbl-make-binding 'org-delete-backward-char 109
|
||||
[backspace] (kbd "DEL")))
|
||||
|
||||
(org-defkey orgtbl-mode-map [S-iso-lefttab]
|
||||
(orgtbl-make-binding 'org-table-previous-field 107
|
||||
[S-iso-lefttab] [backtab] [(shift tab)]
|
||||
[(tab)] "\C-i"))
|
||||
|
||||
(org-defkey orgtbl-mode-map [backtab]
|
||||
(orgtbl-make-binding 'org-table-previous-field 108
|
||||
[backtab] [S-iso-lefttab] [(shift tab)]
|
||||
[(tab)] "\C-i"))
|
||||
|
||||
(org-defkey orgtbl-mode-map "\M-\C-m"
|
||||
(orgtbl-make-binding 'org-table-wrap-region 105
|
||||
"\M-\C-m" [(meta return)]))
|
||||
(org-defkey orgtbl-mode-map [(meta return)]
|
||||
(orgtbl-make-binding 'org-table-wrap-region 106
|
||||
[(meta return)] "\M-\C-m"))
|
||||
|
||||
(org-defkey orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c)
|
||||
(org-defkey orgtbl-mode-map "\C-c|" 'orgtbl-create-or-convert-from-region))
|
||||
|
||||
(defun orgtbl-setup ()
|
||||
"Setup orgtbl keymaps."
|
||||
(let ((nfunc 0)
|
||||
(bindings
|
||||
'(([(meta shift left)] org-table-delete-column)
|
||||
([(meta left)] org-table-move-column-left)
|
||||
([(meta right)] org-table-move-column-right)
|
||||
([(meta shift right)] org-table-insert-column)
|
||||
([(meta shift up)] org-table-kill-row)
|
||||
([(meta shift down)] org-table-insert-row)
|
||||
([(meta up)] org-table-move-row-up)
|
||||
([(meta down)] org-table-move-row-down)
|
||||
("\C-c\C-w" org-table-cut-region)
|
||||
("\C-c\M-w" org-table-copy-region)
|
||||
("\C-c\C-y" org-table-paste-rectangle)
|
||||
("\C-c\C-w" org-table-wrap-region)
|
||||
("\C-c-" org-table-insert-hline)
|
||||
("\C-c}" org-table-toggle-coordinate-overlays)
|
||||
("\C-c{" org-table-toggle-formula-debugger)
|
||||
("\C-m" org-table-next-row)
|
||||
([(shift return)] org-table-copy-down)
|
||||
("\C-c?" org-table-field-info)
|
||||
("\C-c " org-table-blank-field)
|
||||
("\C-c+" org-table-sum)
|
||||
("\C-c=" org-table-eval-formula)
|
||||
("\C-c'" org-table-edit-formulas)
|
||||
("\C-c`" org-table-edit-field)
|
||||
("\C-c*" org-table-recalculate)
|
||||
("\C-c^" org-table-sort-lines)
|
||||
("\M-a" org-table-beginning-of-field)
|
||||
("\M-e" org-table-end-of-field)
|
||||
([(control ?#)] org-table-rotate-recalc-marks)))
|
||||
elt key fun cmd)
|
||||
(while (setq elt (pop bindings))
|
||||
(setq nfunc (1+ nfunc))
|
||||
(setq key (org-key (car elt))
|
||||
fun (nth 1 elt)
|
||||
cmd (orgtbl-make-binding fun nfunc key))
|
||||
(org-defkey orgtbl-mode-map key cmd))
|
||||
|
||||
;; Special treatment needed for TAB, RET and DEL
|
||||
(org-defkey orgtbl-mode-map [(return)]
|
||||
(orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
|
||||
(org-defkey orgtbl-mode-map "\C-m"
|
||||
(orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
|
||||
(org-defkey orgtbl-mode-map [(tab)]
|
||||
(orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
|
||||
(org-defkey orgtbl-mode-map "\C-i"
|
||||
(orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)]))
|
||||
(org-defkey orgtbl-mode-map [(shift tab)]
|
||||
(orgtbl-make-binding 'org-table-previous-field 104
|
||||
[(shift tab)] [(tab)] "\C-i"))
|
||||
(org-defkey orgtbl-mode-map [backspace]
|
||||
(orgtbl-make-binding 'org-delete-backward-char 109
|
||||
[backspace] (kbd "DEL")))
|
||||
|
||||
(org-defkey orgtbl-mode-map [S-iso-lefttab]
|
||||
(orgtbl-make-binding 'org-table-previous-field 107
|
||||
[S-iso-lefttab] [backtab] [(shift tab)]
|
||||
[(tab)] "\C-i"))
|
||||
|
||||
(org-defkey orgtbl-mode-map [backtab]
|
||||
(orgtbl-make-binding 'org-table-previous-field 108
|
||||
[backtab] [S-iso-lefttab] [(shift tab)]
|
||||
[(tab)] "\C-i"))
|
||||
|
||||
(org-defkey orgtbl-mode-map "\M-\C-m"
|
||||
(orgtbl-make-binding 'org-table-wrap-region 105
|
||||
"\M-\C-m" [(meta return)]))
|
||||
(org-defkey orgtbl-mode-map [(meta return)]
|
||||
(orgtbl-make-binding 'org-table-wrap-region 106
|
||||
[(meta return)] "\M-\C-m"))
|
||||
|
||||
(org-defkey orgtbl-mode-map "\C-c\C-c" 'orgtbl-ctrl-c-ctrl-c)
|
||||
(org-defkey orgtbl-mode-map "\C-c|" 'orgtbl-create-or-convert-from-region)
|
||||
|
||||
(when orgtbl-optimized
|
||||
;; If the user wants maximum table support, we need to hijack
|
||||
;; some standard editing functions
|
||||
(org-remap orgtbl-mode-map
|
||||
'self-insert-command 'orgtbl-self-insert-command
|
||||
'delete-char 'org-delete-char
|
||||
'delete-forward-char 'org-delete-char
|
||||
'delete-backward-char 'org-delete-backward-char)
|
||||
(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
|
||||
t))
|
||||
;; If the user wants maximum table support, we need to hijack
|
||||
;; some standard editing functions
|
||||
(org-remap orgtbl-mode-map
|
||||
'self-insert-command (and orgtbl-optimized 'orgtbl-self-insert-command)
|
||||
'delete-char (and orgtbl-optimized 'org-delete-char)
|
||||
'delete-forward-char (and orgtbl-optimized 'org-delete-char)
|
||||
'delete-backward-char (and orgtbl-optimized 'org-delete-backward-char))
|
||||
(org-defkey orgtbl-mode-map "|" (and orgtbl-optimized 'org-force-self-insert)))
|
||||
|
||||
(defun orgtbl-ctrl-c-ctrl-c (arg)
|
||||
"If the cursor is inside a table, realign the table.
|
||||
|
@ -5472,14 +5477,16 @@ a radio table."
|
|||
(goto-char (org-table-begin))
|
||||
(let (rtn)
|
||||
(forward-line -1)
|
||||
(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
|
||||
(let ((name (org-no-properties (match-string 1)))
|
||||
(transform (intern (match-string 2)))
|
||||
(params (if (match-end 3)
|
||||
(read (concat "(" (match-string 3) ")")))))
|
||||
(push (list :name name :transform transform :params params)
|
||||
rtn)
|
||||
(forward-line -1)))
|
||||
(catch :bob
|
||||
(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
|
||||
(let ((name (org-no-properties (match-string 1)))
|
||||
(transform (intern (match-string 2)))
|
||||
(params (if (match-end 3)
|
||||
(read (concat "(" (match-string 3) ")")))))
|
||||
(push (list :name name :transform transform :params params)
|
||||
rtn)
|
||||
(when (bobp) (throw :bob nil))
|
||||
(forward-line -1))))
|
||||
rtn)))
|
||||
|
||||
(defun orgtbl-send-replace-tbl (name text)
|
||||
|
@ -6173,9 +6180,13 @@ supported."
|
|||
(with-temp-buffer
|
||||
(insert (orgtbl-to-orgtbl table params))
|
||||
(org-table-align)
|
||||
(replace-regexp-in-string
|
||||
"-|" "-+"
|
||||
(replace-regexp-in-string "|-" "+-" (buffer-substring 1 (buffer-size))))))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "-|" nil t)
|
||||
(replace-match "-+"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "|-" nil t)
|
||||
(replace-match "+-"))
|
||||
(buffer-string)))
|
||||
|
||||
(defun orgtbl-to-unicode (table params)
|
||||
"Convert the `orgtbl-mode' TABLE into a table with unicode characters.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Rasmus Pank Roulund <emacs at pank dot eu>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
572
lisp/org.el
572
lisp/org.el
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -954,14 +954,15 @@ channel."
|
|||
;; Only links with a description need an entry. Other are
|
||||
;; already handled in `org-ascii-link'.
|
||||
(when description
|
||||
(let ((dest (if (equal type "fuzzy")
|
||||
(org-export-resolve-fuzzy-link link info)
|
||||
;; Ignore broken links. On broken link,
|
||||
;; `org-export-resolve-id-link' will throw an
|
||||
;; error and we will return nil.
|
||||
(condition-case nil
|
||||
(org-export-resolve-id-link link info)
|
||||
(org-link-broken nil)))))
|
||||
(let ((dest
|
||||
;; Ignore broken links. On broken link,
|
||||
;; `org-export-resolve-id-link' will throw an
|
||||
;; error and we will return nil.
|
||||
(condition-case nil
|
||||
(if (equal type "fuzzy")
|
||||
(org-export-resolve-fuzzy-link link info)
|
||||
(org-export-resolve-id-link link info))
|
||||
(org-link-broken nil))))
|
||||
(when dest
|
||||
(concat
|
||||
(org-ascii--fill-string
|
||||
|
@ -1651,6 +1652,12 @@ information."
|
|||
"Transcode a PARAGRAPH element from Org to ASCII.
|
||||
CONTENTS is the contents of the paragraph, as a string. INFO is
|
||||
the plist used as a communication channel."
|
||||
;; Ensure that we do not create multiple paragraphs, when a single
|
||||
;; paragraph is expected.
|
||||
;; Multiple newlines may appear in CONTENTS, for example, when
|
||||
;; certain objects are stripped from export, leaving single newlines
|
||||
;; before and after.
|
||||
(setq contents (org-remove-blank-lines contents))
|
||||
(org-ascii--justify-element
|
||||
(let ((indented-line-width (plist-get info :ascii-indented-line-width)))
|
||||
(if (not (wholenump indented-line-width)) contents
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
|
||||
;; Nicolas Goaziou <n.goaziou AT gmail DOT com>
|
||||
;; Keywords: org, wp, tex
|
||||
;; Keywords: org, text, tex
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -118,8 +118,7 @@ open The opening template for the environment, with the following escapes
|
|||
%l the label, obtained from `org-beamer--get-label'
|
||||
close The closing string of the environment."
|
||||
:group 'org-export-beamer
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.1")
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(repeat
|
||||
(list
|
||||
(string :tag "Environment")
|
||||
|
@ -969,11 +968,10 @@ holding export options."
|
|||
"Support for editing Beamer oriented Org mode files."
|
||||
:lighter " Bm")
|
||||
|
||||
(when (fboundp 'font-lock-add-keywords)
|
||||
(font-lock-add-keywords
|
||||
'org-mode
|
||||
'((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
|
||||
'prepend))
|
||||
(font-lock-add-keywords
|
||||
'org-mode
|
||||
'((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
|
||||
'prepend)
|
||||
|
||||
(defface org-beamer-tag '((t (:box (:line-width 1 :color "grey40"))))
|
||||
"The special face for beamer tags."
|
||||
|
@ -1054,7 +1052,10 @@ will be displayed when `org-export-show-temporary-export-buffer'
|
|||
is non-nil."
|
||||
(interactive)
|
||||
(org-export-to-buffer 'beamer "*Org BEAMER Export*"
|
||||
async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode))))
|
||||
async subtreep visible-only body-only ext-plist
|
||||
(if (fboundp 'major-mode-remap)
|
||||
(major-mode-remap 'latex-mode)
|
||||
#'LaTeX-mode)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-beamer-export-to-latex
|
||||
|
|
101
lisp/ox-html.el
101
lisp/ox-html.el
|
@ -5,7 +5,7 @@
|
|||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Jambunathan K <kjambunathan at gmail dot com>
|
||||
;; Maintainer: TEC <orgmode@tec.tecosaur.net>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -1873,36 +1873,43 @@ INFO is a plist used as a communication channel."
|
|||
(pcase (org-export-collect-footnote-definitions info)
|
||||
(`nil nil)
|
||||
(definitions
|
||||
(format
|
||||
(plist-get info :html-footnotes-section)
|
||||
(org-html--translate "Footnotes" info)
|
||||
(format
|
||||
(plist-get info :html-footnotes-section)
|
||||
(org-html--translate "Footnotes" info)
|
||||
(format
|
||||
"\n%s\n"
|
||||
(mapconcat
|
||||
(lambda (definition)
|
||||
(pcase definition
|
||||
(`(,n ,_ ,def)
|
||||
;; `org-export-collect-footnote-definitions' can return
|
||||
;; two kinds of footnote definitions: inline and blocks.
|
||||
;; Since this should not make any difference in the HTML
|
||||
;; output, we wrap the inline definitions within
|
||||
;; a "footpara" class paragraph.
|
||||
(let ((inline? (not (org-element-map def org-element-all-elements
|
||||
#'identity nil t)))
|
||||
(anchor (org-html--anchor
|
||||
(format "fn.%d" n)
|
||||
n
|
||||
(format " class=\"footnum\" href=\"#fnr.%d\" role=\"doc-backlink\"" n)
|
||||
info))
|
||||
(contents (org-trim (org-export-data def info))))
|
||||
(format "<div class=\"footdef\">%s %s</div>\n"
|
||||
(format (plist-get info :html-footnote-format) anchor)
|
||||
(format "<div class=\"footpara\" role=\"doc-footnote\">%s</div>"
|
||||
(if (not inline?) contents
|
||||
(format "<p class=\"footpara\">%s</p>"
|
||||
contents))))))))
|
||||
definitions
|
||||
"\n"))))))
|
||||
"\n%s\n"
|
||||
(mapconcat
|
||||
(lambda (definition)
|
||||
(pcase definition
|
||||
(`(,n ,label ,def)
|
||||
;; Do not assign number labels as they appear in Org mode
|
||||
;; - the footnotes are re-numbered by
|
||||
;; `org-export-get-footnote-number'. If the label is not
|
||||
;; a number, keep it.
|
||||
(when (and (stringp label)
|
||||
(equal label (number-to-string (string-to-number label))))
|
||||
(setq label nil))
|
||||
;; `org-export-collect-footnote-definitions' can return
|
||||
;; two kinds of footnote definitions: inline and blocks.
|
||||
;; Since this should not make any difference in the HTML
|
||||
;; output, we wrap the inline definitions within
|
||||
;; a "footpara" class paragraph.
|
||||
(let ((inline? (not (org-element-map def org-element-all-elements
|
||||
#'identity nil t)))
|
||||
(anchor (org-html--anchor
|
||||
(format "fn.%s" (or label n))
|
||||
n
|
||||
(format " class=\"footnum\" href=\"#fnr.%s\" role=\"doc-backlink\"" (or label n))
|
||||
info))
|
||||
(contents (org-trim (org-export-data def info))))
|
||||
(format "<div class=\"footdef\">%s %s</div>\n"
|
||||
(format (plist-get info :html-footnote-format) anchor)
|
||||
(format "<div class=\"footpara\" role=\"doc-footnote\">%s</div>"
|
||||
(if (not inline?) contents
|
||||
(format "<p class=\"footpara\">%s</p>"
|
||||
contents))))))))
|
||||
definitions
|
||||
"\n"))))))
|
||||
|
||||
|
||||
;;; Template
|
||||
|
@ -2209,8 +2216,7 @@ holding export options."
|
|||
(format "%s\n"
|
||||
(format decl
|
||||
(or (and org-html-coding-system
|
||||
;; FIXME: Use Emacs 22 style here, see `coding-system-get'.
|
||||
(coding-system-get org-html-coding-system 'mime-charset))
|
||||
(coding-system-get org-html-coding-system :mime-charset))
|
||||
"iso-8859-1"))))))
|
||||
(org-html-doctype info)
|
||||
"\n"
|
||||
|
@ -2741,16 +2747,33 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(when (org-element-type-p prev 'footnote-reference)
|
||||
(plist-get info :html-footnote-separator)))
|
||||
(let* ((n (org-export-get-footnote-number footnote-reference info))
|
||||
(id (format "fnr.%d%s"
|
||||
n
|
||||
(label (org-element-property :label footnote-reference))
|
||||
;; Do not assign number labels as they appear in Org mode -
|
||||
;; the footnotes are re-numbered by
|
||||
;; `org-export-get-footnote-number'. If the label is not a
|
||||
;; number, keep it.
|
||||
(label (if (and (stringp label)
|
||||
(equal label (number-to-string (string-to-number label))))
|
||||
nil
|
||||
label))
|
||||
(id (format "fnr.%s%s"
|
||||
(or label n)
|
||||
(if (org-export-footnote-first-reference-p
|
||||
footnote-reference info)
|
||||
""
|
||||
".100"))))
|
||||
(let ((label (org-element-property :label footnote-reference)))
|
||||
(format
|
||||
".%d"
|
||||
(org-export-get-ordinal
|
||||
footnote-reference info '(footnote-reference)
|
||||
`(lambda (ref _)
|
||||
(if ,label
|
||||
(equal (org-element-property :label ref) ,label)
|
||||
(not (org-element-property :label ref)))))))))))
|
||||
(format
|
||||
(plist-get info :html-footnote-format)
|
||||
(org-html--anchor
|
||||
id n (format " class=\"footref\" href=\"#fn.%d\" role=\"doc-backlink\"" n) info)))))
|
||||
id n (format " class=\"footref\" href=\"#fn.%s\" role=\"doc-backlink\"" (or label n)) info)))))
|
||||
|
||||
;;;; Headline
|
||||
|
||||
|
@ -2897,7 +2920,7 @@ INFO arguments."
|
|||
(org-html-format-headline-default-function
|
||||
todo todo-type priority text tags info)
|
||||
(org-html-close-tag "br" nil info)
|
||||
contents))
|
||||
(or contents "")))
|
||||
|
||||
;;;; Italic
|
||||
|
||||
|
@ -3091,6 +3114,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(attributes (org-export-read-attribute :attr_html latex-environment))
|
||||
(label (org-html--reference latex-environment info t))
|
||||
(caption (and (org-html--latex-environment-numbered-p latex-environment)
|
||||
(org-html--math-environment-p latex-environment)
|
||||
(number-to-string
|
||||
(org-export-get-ordinal
|
||||
latex-environment info nil
|
||||
|
@ -3126,6 +3150,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(let ((latex-frag (org-element-property :value latex-fragment))
|
||||
(processing-type (plist-get info :with-latex)))
|
||||
(cond
|
||||
;; FIXME: Duplicated value in ‘cond’: t
|
||||
((memq processing-type '(t mathjax))
|
||||
(org-html-format-latex latex-frag 'mathjax info))
|
||||
((memq processing-type '(t html))
|
||||
|
@ -3943,7 +3968,7 @@ contextual information."
|
|||
CONTENTS is the exported HTML code. INFO is the info plist."
|
||||
(with-temp-buffer
|
||||
(insert contents)
|
||||
(set-auto-mode t)
|
||||
(delay-mode-hooks (set-auto-mode t))
|
||||
(when (plist-get info :html-indent)
|
||||
(indent-region (point-min) (point-max)))
|
||||
(buffer-substring-no-properties (point-min) (point-max))))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
||||
;; Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;; Maintainer: Jack Kamm <jackkamm@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -1142,7 +1142,13 @@ external process."
|
|||
(catch 'nextfile
|
||||
(org-check-agenda-file file)
|
||||
(with-current-buffer (org-get-agenda-file-buffer file)
|
||||
(org-icalendar-export-to-ics))))
|
||||
(condition-case err
|
||||
(org-icalendar-export-to-ics)
|
||||
(error
|
||||
(warn "Exporting %s to icalendar failed: %s"
|
||||
file
|
||||
(error-message-string err))
|
||||
(signal (car err) (cdr err)))))))
|
||||
(org-release-buffers org-agenda-new-buffers)))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
;; Viktor Rosenfeld <listuser36 AT gmail DOT com>
|
||||
;; Rasmus Pank Roulund <emacs AT pank DOT eu>
|
||||
;; Maintainer: Marco Wahl <marcowahlsoft@gmail.com>
|
||||
;; Keywords: org, wp, tex
|
||||
;; Keywords: org, text, tex
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -915,7 +915,9 @@ non-nil."
|
|||
(let (org-koma-letter-special-contents)
|
||||
(org-export-to-buffer 'koma-letter "*Org KOMA-LETTER Export*"
|
||||
async subtreep visible-only body-only ext-plist
|
||||
(lambda () (LaTeX-mode)))))
|
||||
(if (fboundp 'major-mode-remap)
|
||||
(major-mode-remap 'latex-mode)
|
||||
#'LaTeX-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-koma-letter-export-to-latex
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Maintainer: Daniel Fleischer <danflscr@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -135,6 +135,7 @@
|
|||
(:latex-default-table-environment nil nil org-latex-default-table-environment)
|
||||
(:latex-default-quote-environment nil nil org-latex-default-quote-environment)
|
||||
(:latex-default-table-mode nil nil org-latex-default-table-mode)
|
||||
(:latex-default-footnote-command "LATEX_FOOTNOTE_COMMAND" nil org-latex-default-footnote-command)
|
||||
(:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format)
|
||||
(:latex-engraved-options nil nil org-latex-engraved-options)
|
||||
(:latex-engraved-preamble nil nil org-latex-engraved-preamble)
|
||||
|
@ -667,6 +668,17 @@ The function result will be used in the section format string."
|
|||
|
||||
;;;; Footnotes
|
||||
|
||||
(defcustom org-latex-default-footnote-command "\\footnote{%s%s}"
|
||||
"Default command used to insert footnotes.
|
||||
Customize this command if the LaTeX class provides a different
|
||||
command like \"\\sidenote{%s%s}\" that you want to use.
|
||||
The value will be passed as an argument to `format' as the following
|
||||
(format org-latex-default-footnote-command
|
||||
footnote-description footnote-label)"
|
||||
:group 'org-export-latex
|
||||
:package-version '(Org . "9.7")
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-latex-footnote-separator "\\textsuperscript{,}\\,"
|
||||
"Text used to separate footnotes."
|
||||
:group 'org-export-latex
|
||||
|
@ -780,7 +792,6 @@ default we use here encompasses both."
|
|||
:group 'org-export-latex
|
||||
:type 'string)
|
||||
|
||||
|
||||
;;;; Tables
|
||||
|
||||
(defcustom org-latex-default-table-environment "tabular"
|
||||
|
@ -1519,8 +1530,7 @@ The regular expressions are used to find possible warnings in the
|
|||
log of a LaTeX-run. These warnings will be reported after
|
||||
calling `org-latex-compile'."
|
||||
:group 'org-export-latex
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3")
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(repeat
|
||||
(cons
|
||||
(regexp :tag "Regexp")
|
||||
|
@ -2239,7 +2249,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(t
|
||||
(let ((def (org-export-get-footnote-definition footnote-reference info)))
|
||||
(concat
|
||||
(format "\\footnote{%s%s}" (org-trim (org-export-data def info))
|
||||
(format (plist-get info :latex-default-footnote-command) (org-trim (org-export-data def info))
|
||||
;; Only insert a \label if there exist another
|
||||
;; reference to def.
|
||||
(cond ((not label) "")
|
||||
|
@ -3039,9 +3049,7 @@ the plist used as a communication channel."
|
|||
;; Multiple newlines may appear in CONTENTS, for example, when
|
||||
;; certain objects are stripped from export, leaving single newlines
|
||||
;; before and after.
|
||||
(replace-regexp-in-string
|
||||
(rx "\n" (1+ (0+ space) "\n")) "\n"
|
||||
contents))
|
||||
(org-remove-blank-lines contents))
|
||||
|
||||
|
||||
;;;; Plain List
|
||||
|
@ -3752,7 +3760,7 @@ CONTENTS is the contents of the object."
|
|||
;; takes care of tables with a "verbatim" mode. Otherwise, it
|
||||
;; delegates the job to either `org-latex--table.el-table',
|
||||
;; `org-latex--org-table', `org-latex--math-table' or
|
||||
;; `org-latex--org-align-string-tabbing' functions,
|
||||
;; `org-table--org-tabbing' functions,
|
||||
;; depending of the type of the table and the mode requested.
|
||||
;;
|
||||
;; `org-latex--align-string' is a subroutine used to build alignment
|
||||
|
@ -4275,7 +4283,10 @@ will be displayed when `org-export-show-temporary-export-buffer'
|
|||
is non-nil."
|
||||
(interactive)
|
||||
(org-export-to-buffer 'latex "*Org LATEX Export*"
|
||||
async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode))))
|
||||
async subtreep visible-only body-only ext-plist
|
||||
(if (fboundp 'major-mode-remap)
|
||||
(major-mode-remap 'latex-mode)
|
||||
#'LaTeX-mode)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-latex-convert-region-to-latex ()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Luis R Anaya <papoanaya aroba hot mail punto com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -293,6 +293,13 @@ This function shouldn't be used for floats. See
|
|||
"Protect minus and backslash characters in string TEXT."
|
||||
(replace-regexp-in-string "-" "\\-" text nil t))
|
||||
|
||||
(defun org-man--protect-example (text)
|
||||
"Escape necessary characters for verbatim TEXT."
|
||||
;; See man groff_man_style; \e must be used to render backslash.
|
||||
;; Note that groff's .eo (disable backslash) and .ec (re-enable
|
||||
;; backslash) cannot be used as per the same man page.
|
||||
(replace-regexp-in-string "\\\\" "\\e" text nil t))
|
||||
|
||||
|
||||
|
||||
;;; Template
|
||||
|
@ -400,7 +407,7 @@ information."
|
|||
(org-man--wrap-label
|
||||
example-block
|
||||
(format ".RS\n.nf\n%s\n.fi\n.RE"
|
||||
(org-export-format-code-default example-block info))))
|
||||
(org-man--protect-example (org-export-format-code-default example-block info)))))
|
||||
|
||||
|
||||
;;; Export Block
|
||||
|
@ -529,11 +536,11 @@ contextual information."
|
|||
(delete-file out-file)
|
||||
code-block)
|
||||
(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE\n"
|
||||
code))))
|
||||
(org-man--protect-example code)))))
|
||||
|
||||
;; Do not use a special package: transcode it verbatim.
|
||||
(t
|
||||
(concat ".RS\n.nf\n" "\\fC" "\n" code "\n"
|
||||
(concat ".RS\n.nf\n" "\\fC" "\n" (org-man--protect-example code) "\n"
|
||||
"\\fP\n.fi\n.RE\n")))))
|
||||
|
||||
|
||||
|
@ -749,7 +756,7 @@ CONTENTS holds the contents of the item. INFO is a plist holding
|
|||
contextual information."
|
||||
(if (not (plist-get info :man-source-highlight))
|
||||
(format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
|
||||
(org-export-format-code-default src-block info))
|
||||
(org-man--protect-example (org-export-format-code-default src-block info)))
|
||||
(let* ((tmpdir temporary-file-directory)
|
||||
(in-file (make-temp-name (expand-file-name "srchilite" tmpdir)))
|
||||
(out-file (make-temp-name (expand-file-name "reshilite" tmpdir)))
|
||||
|
@ -772,7 +779,7 @@ contextual information."
|
|||
(delete-file in-file)
|
||||
(delete-file out-file)
|
||||
code-block)
|
||||
(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" code)))))
|
||||
(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" (org-man--protect-example code))))))
|
||||
|
||||
|
||||
;;; Statistics Cookie
|
||||
|
@ -836,9 +843,10 @@ contextual information."
|
|||
|
||||
(format ".nf\n\\fC%s\\fP\n.fi"
|
||||
;; Re-create table, without affiliated keywords.
|
||||
(org-trim
|
||||
(org-element-interpret-data
|
||||
`(table nil ,@(org-element-contents table))))))
|
||||
(org-man--protect-example
|
||||
(org-trim
|
||||
(org-element-interpret-data
|
||||
`(table nil ,@(org-element-contents table)))))))
|
||||
;; Case 2: Standard table.
|
||||
(t (org-man-table--org-table table contents info))))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: org, wp, markdown
|
||||
;; Keywords: org, text, markdown
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -47,11 +47,15 @@
|
|||
|
||||
(defcustom org-md-headline-style 'atx
|
||||
"Style used to format headlines.
|
||||
This variable can be set to either `atx' or `setext'."
|
||||
This variable can be set to either `atx', `setext', or `mixed'.
|
||||
|
||||
Mixed style uses Setext style markup for the first two headline levels
|
||||
and uses ATX style markup for the remaining four levels."
|
||||
:group 'org-export-md
|
||||
:type '(choice
|
||||
(const :tag "Use \"atx\" style" atx)
|
||||
(const :tag "Use \"Setext\" style" setext)))
|
||||
(const :tag "Use \"Setext\" style" setext)
|
||||
(const :tag "Use \"mixed\" style" mixed)))
|
||||
|
||||
|
||||
;;;; Footnotes
|
||||
|
@ -232,7 +236,7 @@ anchor tag for the section as a string. TAGS are the tags set on
|
|||
the section."
|
||||
(let ((anchor-lines (and anchor (concat anchor "\n\n"))))
|
||||
;; Use "Setext" style
|
||||
(if (and (eq style 'setext) (< level 3))
|
||||
(if (and (memq style '(setext mixed)) (< level 3))
|
||||
(let* ((underline-char (if (= level 1) ?= ?-))
|
||||
(underline (concat (make-string (length title) underline-char)
|
||||
"\n")))
|
||||
|
@ -397,9 +401,10 @@ a communication channel."
|
|||
(cond
|
||||
;; Cannot create a headline. Fall-back to a list.
|
||||
((or (org-export-low-level-p headline info)
|
||||
(not (memq style '(atx setext)))
|
||||
(not (memq style '(atx mixed setext)))
|
||||
(and (eq style 'atx) (> level 6))
|
||||
(and (eq style 'setext) (> level 2)))
|
||||
(and (eq style 'setext) (> level 2))
|
||||
(and (eq style 'mixed) (> level 6)))
|
||||
(let ((bullet
|
||||
(if (not (org-export-numbered-headline-p headline info)) "-"
|
||||
(concat (number-to-string
|
||||
|
@ -452,7 +457,7 @@ a communication channel."
|
|||
(org-list-parents-alist struct)))))
|
||||
"."))))
|
||||
(concat bullet
|
||||
(make-string (- 4 (length bullet)) ? )
|
||||
(make-string (max 1 (- 4 (length bullet))) ? )
|
||||
(pcase (org-element-property :checkbox item)
|
||||
(`on "[X] ")
|
||||
(`trans "[-] ")
|
||||
|
@ -628,6 +633,12 @@ information."
|
|||
"Transcode PARAGRAPH element into Markdown format.
|
||||
CONTENTS is the paragraph contents. INFO is a plist used as
|
||||
a communication channel."
|
||||
;; Ensure that we do not create multiple paragraphs, when a single
|
||||
;; paragraph is expected.
|
||||
;; Multiple newlines may appear in CONTENTS, for example, when
|
||||
;; certain objects are stripped from export, leaving single newlines
|
||||
;; before and after.
|
||||
(setq contents (org-remove-blank-lines contents))
|
||||
(let ((first-object (car (org-element-contents paragraph))))
|
||||
;; If paragraph starts with a #, protect it.
|
||||
(if (and (stringp first-object) (string-prefix-p "#" first-object))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Jambunathan K <kjambunathan at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
;; URL: https://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -2253,11 +2253,11 @@ SHORT-CAPTION are strings."
|
|||
LINK is the link pointing to the inline image. INFO is a plist
|
||||
used as a communication channel."
|
||||
(cl-assert (org-element-type-p element 'link))
|
||||
(let* ((src (let* ((type (org-element-property :type element))
|
||||
(raw-path (org-element-property :path element)))
|
||||
(cl-assert (equal "file" (org-element-property :type element)))
|
||||
(let* ((src (let ((raw-path (org-element-property :path element)))
|
||||
(cond ((file-name-absolute-p raw-path)
|
||||
(expand-file-name raw-path))
|
||||
(t (concat type ":" raw-path)))))
|
||||
(t raw-path))))
|
||||
(src-expanded (if (file-name-absolute-p src) src
|
||||
(expand-file-name src (file-name-directory
|
||||
(plist-get info :input-file)))))
|
||||
|
@ -2682,8 +2682,6 @@ INFO is a plist holding contextual information. See
|
|||
(imagep (org-export-inline-image-p
|
||||
link (plist-get info :odt-inline-image-rules)))
|
||||
(path (cond
|
||||
((member type '("http" "https" "ftp" "mailto"))
|
||||
(concat type ":" raw-path))
|
||||
((string= type "file")
|
||||
(let ((path-uri (org-export-file-uri raw-path)))
|
||||
(if (string-prefix-p "file://" path-uri)
|
||||
|
@ -2693,9 +2691,10 @@ INFO is a plist holding contextual information. See
|
|||
;; archive. The directory containing the odt file
|
||||
;; is "../".
|
||||
(concat "../" path-uri))))
|
||||
(t raw-path)))
|
||||
(t (concat type ":" raw-path))))
|
||||
;; Convert & to & for correct XML representation
|
||||
(path (replace-regexp-in-string "&" "&" path)))
|
||||
(path (replace-regexp-in-string "&" "&" path))
|
||||
(raw-path (replace-regexp-in-string "&" "&" raw-path)))
|
||||
(cond
|
||||
;; Link type is handled by a special function.
|
||||
((org-export-custom-protocol-maybe link desc 'odt info))
|
||||
|
@ -2774,10 +2773,10 @@ INFO is a plist holding contextual information. See
|
|||
;; Coderef: replace link with the reference name or the
|
||||
;; equivalent line number.
|
||||
((string= type "coderef")
|
||||
(let* ((line-no (format "%d" (org-export-resolve-coderef path info)))
|
||||
(href (concat "coderef-" path)))
|
||||
(let* ((line-no (format "%d" (org-export-resolve-coderef raw-path info)))
|
||||
(href (concat "coderef-" raw-path)))
|
||||
(format
|
||||
(org-export-get-coderef-format path desc)
|
||||
(org-export-get-coderef-format raw-path desc)
|
||||
(format
|
||||
"<text:bookmark-ref text:reference-format=\"number\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
|
||||
href line-no))))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; Copyright (C) 2013-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: org, wp
|
||||
;; Keywords: org, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; Copyright (C) 2006-2024 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: David O'Toole <dto@gnu.org>
|
||||
;; Keywords: hypermedia, outlines, wp
|
||||
;; Keywords: hypermedia, outlines, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
;;
|
||||
|
@ -56,6 +56,9 @@
|
|||
"This will cache timestamps and titles for files in publishing projects.
|
||||
Blocks could hash sha1 values here.")
|
||||
|
||||
(defvar org-publish-transient-cache nil
|
||||
"This will cache information during publishing process.")
|
||||
|
||||
(defvar org-publish-after-publishing-hook nil
|
||||
"Hook run each time a file is published.
|
||||
Every function in this hook will be called with two arguments:
|
||||
|
@ -791,17 +794,14 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
|
|||
(concat (file-name-directory b)
|
||||
(org-publish-find-title b project))
|
||||
b)))
|
||||
(setq retval
|
||||
(if ignore-case
|
||||
(not (string-lessp (upcase B) (upcase A)))
|
||||
(not (string-lessp B A))))))
|
||||
(setq retval (org-string<= A B nil ignore-case))))
|
||||
((or `anti-chronologically `chronologically)
|
||||
(let* ((adate (org-publish-find-date a project))
|
||||
(bdate (org-publish-find-date b project)))
|
||||
(setq retval
|
||||
(not (if (eq sort-files 'chronologically)
|
||||
(time-less-p bdate adate)
|
||||
(time-less-p adate bdate))))))
|
||||
(time-less-p bdate adate)
|
||||
(time-less-p adate bdate))))))
|
||||
(`nil nil)
|
||||
(_ (user-error "Invalid sort value %s" sort-files)))
|
||||
;; Directory-wise wins:
|
||||
|
@ -867,7 +867,7 @@ PROPERTY, i.e. \"behavior\" parameter from `org-export-options-alist'."
|
|||
(org-no-properties
|
||||
(org-element-interpret-data parsed-title))
|
||||
(file-name-nondirectory (file-name-sans-extension file)))))
|
||||
(org-publish-cache-set-file-property file :title title)))))
|
||||
(org-publish-cache-set-file-property file :title title nil 'transient)))))
|
||||
|
||||
(defun org-publish-find-date (file project)
|
||||
"Find the date of FILE in PROJECT.
|
||||
|
@ -892,7 +892,8 @@ time in `current-time' format."
|
|||
(org-time-string-to-time value))))))
|
||||
((file-exists-p file)
|
||||
(file-attribute-modification-time (file-attributes file)))
|
||||
(t (error "No such file: \"%s\"" file)))))))))
|
||||
(t (error "No such file: \"%s\"" file)))))
|
||||
nil 'transient))))
|
||||
|
||||
(defun org-publish-sitemap-default-entry (entry style project)
|
||||
"Default format for site map ENTRY, as a string.
|
||||
|
@ -1048,7 +1049,8 @@ its CDR is a string."
|
|||
(replace-regexp-in-string
|
||||
"\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
|
||||
(org-element-property :raw-value parent)))))))))
|
||||
info))))
|
||||
info))
|
||||
nil 'transient))
|
||||
;; Return output unchanged.
|
||||
output)
|
||||
|
||||
|
@ -1251,6 +1253,9 @@ If FREE-CACHE, empty the cache."
|
|||
(error "Org publish timestamp: %s is not a directory"
|
||||
org-publish-timestamp-directory))
|
||||
|
||||
(unless org-publish-transient-cache
|
||||
(setq org-publish-transient-cache (make-hash-table :test #'equal)))
|
||||
|
||||
(unless (and org-publish-cache
|
||||
(string= (org-publish-cache-get ":project:") project-name))
|
||||
(let* ((cache-file
|
||||
|
@ -1274,6 +1279,8 @@ If FREE-CACHE, empty the cache."
|
|||
(message "%s" "Resetting org-publish-cache")
|
||||
(when (hash-table-p org-publish-cache)
|
||||
(clrhash org-publish-cache))
|
||||
(when (hash-table-p org-publish-transient-cache)
|
||||
(clrhash org-publish-transient-cache))
|
||||
(setq org-publish-cache nil))
|
||||
|
||||
(defun org-publish-cache-file-needs-publishing
|
||||
|
@ -1319,16 +1326,22 @@ the file including them will be republished as well."
|
|||
included-files-mtime))))))
|
||||
|
||||
(defun org-publish-cache-set-file-property
|
||||
(filename property value &optional project-name)
|
||||
(filename property value &optional project-name transient)
|
||||
"Set the VALUE for a PROPERTY of file FILENAME in publishing cache to VALUE.
|
||||
Use cache file of PROJECT-NAME. If the entry does not exist, it
|
||||
will be created. Return VALUE."
|
||||
will be created. Return VALUE.
|
||||
|
||||
When TRANSIENT is non-nil, store value in transient cache that is only
|
||||
maintained during the current publish process."
|
||||
;; Evtl. load the requested cache file:
|
||||
(when project-name (org-publish-initialize-cache project-name))
|
||||
(let ((pl (org-publish-cache-get filename)))
|
||||
(if pl (progn (plist-put pl property value) value)
|
||||
(org-publish-cache-get-file-property
|
||||
filename property value nil project-name))))
|
||||
(if transient
|
||||
(puthash (cons filename property) value
|
||||
org-publish-transient-cache)
|
||||
(let ((pl (org-publish-cache-get filename)))
|
||||
(if pl (progn (plist-put pl property value) value)
|
||||
(org-publish-cache-get-file-property
|
||||
filename property value nil project-name)))))
|
||||
|
||||
(defun org-publish-cache-get-file-property
|
||||
(filename property &optional default no-create project-name)
|
||||
|
@ -1337,13 +1350,14 @@ Use cache file of PROJECT-NAME. Return the value of that PROPERTY,
|
|||
or DEFAULT, if the value does not yet exist. Create the entry,
|
||||
if necessary, unless NO-CREATE is non-nil."
|
||||
(when project-name (org-publish-initialize-cache project-name))
|
||||
(let ((properties (org-publish-cache-get filename)))
|
||||
(cond ((null properties)
|
||||
(unless no-create
|
||||
(org-publish-cache-set filename (list property default)))
|
||||
default)
|
||||
((plist-member properties property) (plist-get properties property))
|
||||
(t default))))
|
||||
(or (gethash (cons filename property) org-publish-transient-cache)
|
||||
(let ((properties (org-publish-cache-get filename)))
|
||||
(cond ((null properties)
|
||||
(unless no-create
|
||||
(org-publish-cache-set filename (list property default)))
|
||||
default)
|
||||
((plist-member properties property) (plist-get properties property))
|
||||
(t default)))))
|
||||
|
||||
(defun org-publish-cache-get (key)
|
||||
"Return the value stored in `org-publish-cache' for key KEY.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -1517,7 +1517,12 @@ information."
|
|||
"Transcode a PARAGRAPH element from Org to Texinfo.
|
||||
CONTENTS is the contents of the paragraph, as a string. INFO is
|
||||
the plist used as a communication channel."
|
||||
contents)
|
||||
;; Ensure that we do not create multiple paragraphs, when a single
|
||||
;; paragraph is expected.
|
||||
;; Multiple newlines may appear in CONTENTS, for example, when
|
||||
;; certain objects are stripped from export, leaving single newlines
|
||||
;; before and after.
|
||||
(org-remove-blank-lines contents))
|
||||
|
||||
;;;; Plain List
|
||||
|
||||
|
|
102
lisp/ox.el
102
lisp/ox.el
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;; Maintainer: Ihor Radchenko <yantar92 at posteo dot net>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Keywords: outlines, hypermedia, calendar, text
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -185,7 +185,7 @@ All these properties should be backend agnostic. Backend
|
|||
specific properties are set through `org-export-define-backend'.
|
||||
Properties redefined there have precedence over these.")
|
||||
|
||||
(defconst org-export-filters-alist
|
||||
(defvar org-export-filters-alist
|
||||
'((:filter-body . org-export-filter-body-functions)
|
||||
(:filter-bold . org-export-filter-bold-functions)
|
||||
(:filter-babel-call . org-export-filter-babel-call-functions)
|
||||
|
@ -684,31 +684,14 @@ e.g. \"stat:nil\""
|
|||
"Non-nil means interpret \"_\" and \"^\" for export.
|
||||
|
||||
If you want to control how Org displays those characters, see
|
||||
`org-use-sub-superscripts'. `org-export-with-sub-superscripts'
|
||||
used to be an alias for `org-use-sub-superscripts' in Org <8.0,
|
||||
it is not anymore.
|
||||
`org-use-sub-superscripts'.
|
||||
|
||||
When this option is turned on, you can use TeX-like syntax for
|
||||
sub- and superscripts and see them exported correctly.
|
||||
|
||||
You can also set the option with #+OPTIONS: ^:t
|
||||
|
||||
Several characters after \"_\" or \"^\" will be considered as a
|
||||
single item - so grouping with {} is normally not needed. For
|
||||
example, the following things will be parsed as single sub- or
|
||||
superscripts:
|
||||
|
||||
10^24 or 10^tau several digits will be considered 1 item.
|
||||
10^-12 or 10^-tau a leading sign with digits or a word
|
||||
x^2-y^3 will be read as x^2 - y^3, because items are
|
||||
terminated by almost any nonword/nondigit char.
|
||||
x_{i^2} or x^(2-i) braces or parenthesis do grouping.
|
||||
|
||||
Still, ambiguity is possible. So when in doubt, use {} to enclose
|
||||
the sub/superscript. If you set this variable to the symbol `{}',
|
||||
the braces are *required* in order to trigger interpretations as
|
||||
sub/superscript. This can be helpful in documents that need \"_\"
|
||||
frequently in plain text."
|
||||
See `org-use-sub-superscripts' docstring for more details."
|
||||
:group 'org-export-general
|
||||
:version "24.4"
|
||||
:package-version '(Org . "8.0")
|
||||
|
@ -1897,6 +1880,38 @@ INFO is a plist containing export directives."
|
|||
(let ((transcoder (cdr (assq type (plist-get info :translate-alist)))))
|
||||
(and (functionp transcoder) transcoder)))))
|
||||
|
||||
(defun org-export--keep-spaces (data info)
|
||||
"Non-nil, when post-blank spaces after removing DATA should be preserved.
|
||||
INFO is the info channel.
|
||||
|
||||
This function returns nil, when previous exported element already has
|
||||
trailing spaces or when DATA does not have non-zero non-nil
|
||||
`:post-blank' property.
|
||||
|
||||
When the return value is non-nil, it is a string containing the trailing
|
||||
spaces."
|
||||
;; When DATA is an object, interpret this as if DATA should be
|
||||
;; ignored (see `org-export--prune-tree'). Keep spaces in place of
|
||||
;; removed element, if necessary. Example: "Foo.[10%] Bar" would
|
||||
;; become "Foo.Bar" if we do not keep spaces. Another example: "A
|
||||
;; space@@ascii:*@@ character." should become "A space character"
|
||||
;; in non-ASCII export.
|
||||
(let ((post-blank (org-element-post-blank data)))
|
||||
(unless (or (not post-blank)
|
||||
(zerop post-blank)
|
||||
(eq 'element (org-element-class data)))
|
||||
(let ((previous (org-export-get-previous-element data info)))
|
||||
(unless (or (not previous)
|
||||
(pcase (org-element-type previous)
|
||||
(`plain-text
|
||||
(string-match-p
|
||||
(rx (any " \t\r\n") eos) previous))
|
||||
(_ (org-element-post-blank previous))))
|
||||
;; When previous element does not have
|
||||
;; trailing spaces, keep the trailing
|
||||
;; spaces from DATA.
|
||||
(make-string post-blank ?\s))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-export-data (data info)
|
||||
"Convert DATA into current backend format.
|
||||
|
@ -1917,7 +1932,7 @@ Return a string."
|
|||
(progn ,@body)
|
||||
(org-link-broken
|
||||
(pcase (plist-get info :with-broken-links)
|
||||
(`nil (user-error "Unable to resolve link: %S" (nth 1 err)))
|
||||
(`nil (user-error "Org export aborted. Unable to resolve link: %S\nSee `org-export-with-broken-links'." (nth 1 err)))
|
||||
(`mark (org-export-data
|
||||
(format "[BROKEN LINK: %s]" (nth 1 err)) info))
|
||||
(_ nil))))))
|
||||
|
@ -1947,15 +1962,11 @@ Return a string."
|
|||
(eq (plist-get info :with-archived-trees) 'headline)
|
||||
(org-element-property :archivedp data)))
|
||||
(let ((transcoder (org-export-transcoder data info)))
|
||||
(or (and (functionp transcoder)
|
||||
(if (eq type 'link)
|
||||
(broken-link-handler
|
||||
(funcall transcoder data nil info))
|
||||
(funcall transcoder data nil info)))
|
||||
;; Export snippets never return a nil value so
|
||||
;; that white spaces following them are never
|
||||
;; ignored.
|
||||
(and (eq type 'export-snippet) ""))))
|
||||
(and (functionp transcoder)
|
||||
(if (eq type 'link)
|
||||
(broken-link-handler
|
||||
(funcall transcoder data nil info))
|
||||
(funcall transcoder data nil info)))))
|
||||
;; Element/Object with contents.
|
||||
(t
|
||||
(let ((transcoder (org-export-transcoder data info)))
|
||||
|
@ -1996,8 +2007,8 @@ Return a string."
|
|||
(puthash
|
||||
data
|
||||
(cond
|
||||
((not results) "")
|
||||
((memq type '(nil org-data plain-text raw)) results)
|
||||
((not results) (or (org-export--keep-spaces data info) ""))
|
||||
((memq type '(nil org-data plain-text raw)) results)
|
||||
;; Append the same white space between elements or objects
|
||||
;; as in the original buffer, and call appropriate filters.
|
||||
(t
|
||||
|
@ -2658,24 +2669,13 @@ from tree."
|
|||
(let ((type (org-element-type data)))
|
||||
(if (org-export--skip-p data info selected excluded)
|
||||
(if (memq type '(table-cell table-row)) (push data ignore)
|
||||
(let ((post-blank (org-element-post-blank data)))
|
||||
(if (or (not post-blank) (zerop post-blank)
|
||||
(eq 'element (org-element-class data)))
|
||||
(org-element-extract data)
|
||||
(if-let ((keep-spaces (org-export--keep-spaces data info)))
|
||||
;; Keep spaces in place of removed
|
||||
;; element, if necessary.
|
||||
;; Example: "Foo.[10%] Bar" would become
|
||||
;; "Foo.Bar" if we do not keep spaces.
|
||||
(let ((previous (org-export-get-previous-element data info)))
|
||||
(if (or (not previous)
|
||||
(pcase (org-element-type previous)
|
||||
(`plain-text
|
||||
(string-match-p
|
||||
(rx whitespace eos) previous))
|
||||
(_ (org-element-post-blank previous))))
|
||||
;; Previous object ends with whitespace already.
|
||||
(org-element-extract data)
|
||||
(org-element-set data (make-string post-blank ?\s)))))))
|
||||
(org-element-set data keep-spaces)
|
||||
(org-element-extract data)))
|
||||
(if (and (eq type 'headline)
|
||||
(eq (plist-get info :with-archived-trees)
|
||||
'headline)
|
||||
|
@ -6254,7 +6254,7 @@ them."
|
|||
("no" :default "Illustrasjon")
|
||||
("nb" :default "Illustrasjon")
|
||||
("nn" :default "Illustrasjon")
|
||||
("pl" :default "Obrazek") ; alternativly "Rysunek"
|
||||
("pl" :default "Obrazek") ; alternatively "Rysunek"
|
||||
("pt_BR" :default "Figura")
|
||||
("ro" :default "Imaginea")
|
||||
("ru" :html "Рисунок" :utf-8 "Рисунок")
|
||||
|
@ -6277,7 +6277,7 @@ them."
|
|||
("no" :default "Illustrasjon %d")
|
||||
("nb" :default "Illustrasjon %d")
|
||||
("nn" :default "Illustrasjon %d")
|
||||
("pl" :default "Obrazek %d") ; alternativly "Rysunek %d"
|
||||
("pl" :default "Obrazek %d") ; alternatively "Rysunek %d"
|
||||
("pt_BR" :default "Figura %d:")
|
||||
("ro" :default "Imaginea %d:")
|
||||
("ru" :html "Рис. %d.:" :utf-8 "Рис. %d.:")
|
||||
|
@ -6438,7 +6438,7 @@ them."
|
|||
("nl" :default "Zie figuur %s"
|
||||
:html "Zie figuur %s" :latex "Zie figuur~%s")
|
||||
("nn" :default "Sjå figur %s")
|
||||
("pl" :default "Patrz obrazek %s") ; alternativly "Patrz rysunek %s"
|
||||
("pl" :default "Patrz obrazek %s") ; alternatively "Patrz rysunek %s"
|
||||
("pt_BR" :default "Veja a figura %s")
|
||||
("ro" :default "Vezi figura %s")
|
||||
("sl" :default "Glej sliko %s")
|
||||
|
@ -6769,7 +6769,7 @@ use it to set a major mode there, e.g.,
|
|||
(interactive)
|
||||
(org-export-to-buffer \\='latex \"*Org LATEX Export*\"
|
||||
async subtreep visible-only body-only ext-plist
|
||||
#\\='LaTeX-mode))
|
||||
(major-mode-remap \\='latex-mode)))
|
||||
|
||||
When expressed as an anonymous function, using `lambda',
|
||||
POST-PROCESS needs to be quoted.
|
||||
|
|
|
@ -13,7 +13,7 @@ ifneq ($(wildcard .git),)
|
|||
# Use the org.el header.
|
||||
ORGVERSION := $(patsubst %-dev,%,$(shell $(BATCH) --eval "(require 'lisp-mnt)" \
|
||||
--visit lisp/org.el --eval '(princ (lm-header "version"))'))
|
||||
GITVERSION := $(shell git describe --match release\* --abbrev=6 HEAD 2>/dev/null || echo "release_N/A-N/A-$(shell git describe --match release\* --abbrev=6 --always HEAD)")
|
||||
GITVERSION := $(shell git describe --match release\* --abbrev=6 HEAD 2>/dev/null || echo "${ORGVERSION}-$(shell git describe --match release\* --abbrev=6 --always HEAD)")
|
||||
GITSTATUS := $(shell git status -uno --porcelain)
|
||||
else
|
||||
-include mk/version.mk
|
||||
|
|
|
@ -6,3 +6,5 @@ SCHEDULED: <2024-01-17 Wed 10:00-12:30>
|
|||
SCHEDULED: <2024-01-17 Wed 13:00-15:00>
|
||||
* TODO four
|
||||
SCHEDULED: <2024-01-17 Wed 19:00>
|
||||
* TODO five
|
||||
<2024-01-17 Wed 19:00>--<2024-01-18 Thu 18:00>
|
||||
|
|
|
@ -39,6 +39,14 @@
|
|||
#+END_SRC"
|
||||
(should (equal "27" (org-babel-execute-src-block)))))
|
||||
|
||||
(ert-deftest ob-calc/float-var ()
|
||||
"Test of floating variable."
|
||||
(org-test-with-temp-text "\
|
||||
#+BEGIN_SRC calc :results silent :var x=2.0
|
||||
1/x
|
||||
#+END_SRC"
|
||||
(should (equal "0.5" (org-babel-execute-src-block)))))
|
||||
|
||||
(ert-deftest ob-calc/simple-program-symbolic ()
|
||||
"Test of simple symbolic algebra."
|
||||
(org-test-with-temp-text "\
|
||||
|
@ -59,7 +67,14 @@
|
|||
inv(a)
|
||||
#+END_SRC "
|
||||
(should (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]"
|
||||
(org-babel-execute-src-block)))))
|
||||
(let ((calc-float-format '(float 0)))
|
||||
;; ;; Make sure that older Calc buffers are not present.
|
||||
(save-current-buffer
|
||||
(when (ignore-errors (calc-select-buffer))
|
||||
(kill-buffer)))
|
||||
;; Now, let-bound `calc-float-format' will take
|
||||
;; effect.
|
||||
(org-babel-execute-src-block))))))
|
||||
|
||||
(ert-deftest ob-calc/matrix-algebra ()
|
||||
"Test of simple matrix algebra."
|
||||
|
|
|
@ -205,14 +205,14 @@ Here is one at the end of a line. {{{results(=2=)}}}
|
|||
|
||||
(ert-deftest ob-exp/exports-inline-code ()
|
||||
(should
|
||||
(equal "src_emacs-lisp[]{(+ 1 1)}"
|
||||
(equal "src_emacs-lisp[ :exports code]{(+ 1 1)}"
|
||||
(org-test-with-temp-text "src_emacs-lisp[:exports code]{(+ 1 1)}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")
|
||||
(org-export-use-babel t))
|
||||
(org-babel-exp-process-buffer))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "src_emacs-lisp[]{(+ 1 1)}"
|
||||
(equal "src_emacs-lisp[ :exports code]{(+ 1 1)}"
|
||||
(org-test-with-temp-text "src_emacs-lisp[ :exports code ]{(+ 1 1)}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")
|
||||
(org-export-use-babel t))
|
||||
|
@ -220,14 +220,14 @@ Here is one at the end of a line. {{{results(=2=)}}}
|
|||
(buffer-string))))
|
||||
;; Do not escape characters in inline source blocks.
|
||||
(should
|
||||
(equal "src_c[]{*a}"
|
||||
(equal "src_c[ :exports code]{*a}"
|
||||
(org-test-with-temp-text "src_c[ :exports code ]{*a}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")
|
||||
(org-export-use-babel t))
|
||||
(org-babel-exp-process-buffer))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "src_emacs-lisp[]{(+ 1 1)} {{{results(=2=)}}}"
|
||||
(equal "src_emacs-lisp[ :exports both]{(+ 1 1)} {{{results(=2=)}}}"
|
||||
(org-test-with-temp-text "src_emacs-lisp[:exports both]{(+ 1 1)}"
|
||||
(let ((org-babel-inline-result-wrap "=%s=")
|
||||
(org-export-use-babel t))
|
||||
|
@ -265,7 +265,7 @@ Here is one at the end of a line. {{{results(=2=)}}}
|
|||
(regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line.
|
||||
Here is one at the end of a line. src_sh[]{echo 2}
|
||||
src_sh[]{echo 3} Here is one at the beginning of a line.
|
||||
Here is one that is also evaluated: src_sh[]{echo 4} {{{results(=4=)}}}")
|
||||
Here is one that is also evaluated: src_sh[ :exports both]{echo 4} {{{results(=4=)}}}")
|
||||
nil t)
|
||||
(org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
|
||||
(org-narrow-to-subtree)
|
||||
|
@ -301,7 +301,7 @@ be evaluated."
|
|||
(ert-deftest ob-exp/exports-inline-code-double-eval-exports-both ()
|
||||
(let ((org-export-use-babel t))
|
||||
(should
|
||||
(string-match (concat "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)} "
|
||||
(string-match (concat "\\`src_emacs-lisp\\(?:\\[.+?]\\)?{(\\+ 1 1)} "
|
||||
"{{{results(src_emacs-lisp\\[ :exports code\\]{2})}}}$")
|
||||
(org-test-with-temp-text
|
||||
(concat "src_emacs-lisp[:exports both :results code "
|
||||
|
@ -403,7 +403,7 @@ be evaluated."
|
|||
: 2
|
||||
|
||||
#+NAME: src1
|
||||
#+begin_src emacs-lisp
|
||||
#+begin_src emacs-lisp :exports both
|
||||
\(+ 1 1)
|
||||
#+end_src"
|
||||
(org-test-with-temp-text
|
||||
|
@ -430,7 +430,7 @@ be evaluated."
|
|||
"Test exporting a source block with a flag."
|
||||
(should
|
||||
(string-match
|
||||
"\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
|
||||
"\\`#\\+BEGIN_SRC emacs-lisp :flags -some-flag$"
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
|
||||
(org-babel-exp-process-buffer)
|
||||
|
@ -570,7 +570,7 @@ src_emacs-lisp{(+ 1 1)}"
|
|||
(ert-deftest ob-export/body-with-coderef ()
|
||||
"Test exporting a code block with coderefs."
|
||||
(should
|
||||
(equal "#+begin_src emacs-lisp\n0 (ref:foo)\n#+end_src"
|
||||
(equal "#+begin_src emacs-lisp :exports code\n0 (ref:foo)\n#+end_src"
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC emacs-lisp :exports code\n0 (ref:foo)\n#+END_SRC"
|
||||
(let ((org-export-use-babel t)
|
||||
|
@ -579,7 +579,7 @@ src_emacs-lisp{(+ 1 1)}"
|
|||
(buffer-string))))
|
||||
(should
|
||||
(equal
|
||||
"#+begin_src emacs-lisp -l \"r:%s\"\n1 r:foo\n#+end_src"
|
||||
"#+begin_src emacs-lisp -l \"r:%s\" -lisp :exports code\n1 r:foo\n#+end_src"
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC emacs-lisp -l \"r:%s\" -lisp :exports code\n1 r:foo\n#+END_SRC"
|
||||
(let ((org-export-use-babel t))
|
||||
|
|
|
@ -77,9 +77,9 @@ return x[1]
|
|||
|
||||
|
||||
(ert-deftest test-ob-lua/colnames-yes-header-argument-pp ()
|
||||
"Test table passing with `colnames' header and pp option."
|
||||
"Test table passing with `colnames' header and `pp' option."
|
||||
(should
|
||||
(equal "a = 12\nb = 13\n"
|
||||
(equal "a = 12\nb = 13"
|
||||
(org-test-with-temp-text
|
||||
"#+name: eg
|
||||
| col | val |
|
||||
|
@ -99,7 +99,7 @@ return x
|
|||
(ert-deftest test-ob-lua/colnames-nil-header-argument ()
|
||||
"Test table with `colnames' set to `nil'."
|
||||
(should
|
||||
(equal "1 = a\n2 = b\n"
|
||||
(equal "1 = a\n2 = b"
|
||||
(org-test-with-temp-text
|
||||
"#+name: eg
|
||||
| col |
|
||||
|
@ -119,7 +119,7 @@ return x
|
|||
(ert-deftest test-ob-lua/colnames-no-header-argument ()
|
||||
"Test table passing without `colnames'."
|
||||
(should
|
||||
(equal "1 = col\n2 = a\n3 = b\n"
|
||||
(equal "1 = col\n2 = a\n3 = b"
|
||||
(org-test-with-temp-text
|
||||
"#+name: eg
|
||||
| col |
|
||||
|
@ -136,6 +136,46 @@ return x
|
|||
(org-babel-next-src-block)
|
||||
(org-babel-execute-src-block)))))
|
||||
|
||||
(ert-deftest test-ob-lua/types ()
|
||||
"Test returning different types."
|
||||
(should
|
||||
(equal "nil"
|
||||
(org-test-with-temp-text "src_lua{return nil}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal "true"
|
||||
(org-test-with-temp-text "src_lua{return true}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal "false"
|
||||
(org-test-with-temp-text "src_lua{return false}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal 1
|
||||
(org-test-with-temp-text "src_lua{return 1}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal "hello world"
|
||||
(org-test-with-temp-text "src_lua{return 'hello world'}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal 0
|
||||
(string-match "table: 0x[0-9A-F]+"
|
||||
(org-test-with-temp-text "src_lua{return {}}"
|
||||
(org-babel-execute-src-block))))))
|
||||
|
||||
(ert-deftest test-ob-lua/multiple-values ()
|
||||
"Test returning multiple values."
|
||||
(should
|
||||
(equal "1, 2, 3"
|
||||
(org-test-with-temp-text "src_lua{return 1, 2, 3}"
|
||||
(org-babel-execute-src-block))))
|
||||
(should
|
||||
(equal "1|2|3"
|
||||
(let ((org-babel-lua-multiple-values-separator "|"))
|
||||
(org-test-with-temp-text "src_lua{return 1, 2, 3}"
|
||||
(org-babel-execute-src-block))))))
|
||||
|
||||
(provide 'test-ob-lua)
|
||||
|
||||
;;; test-ob-lua.el ends here
|
||||
|
|
|
@ -183,6 +183,7 @@ that will return all elements of the array as a single string."
|
|||
echo ${array}
|
||||
<point>
|
||||
#+end_src"
|
||||
(skip-unless (executable-find "bash"))
|
||||
(should (equal "one" (org-trim (org-babel-execute-src-block))))))
|
||||
|
||||
(ert-deftest test-ob-shell/generic-uses-no-assoc-arrays-simple-map ()
|
||||
|
@ -229,6 +230,10 @@ echo ${table}
|
|||
Bash will see a table that contains the first column as the
|
||||
'index' of the associative array, and the second column as the
|
||||
value. "
|
||||
(skip-unless
|
||||
;; Old GPLv2 BASH in macOSX does not support associative arrays.
|
||||
(if-let ((bash (executable-find "bash")))
|
||||
(eq 0 (process-file bash nil nil nil "-c" "declare -A assoc_array"))))
|
||||
(org-test-with-temp-text
|
||||
"#+NAME: sample_mapping_table
|
||||
| first | one |
|
||||
|
@ -248,6 +253,10 @@ echo ${table[second]}
|
|||
|
||||
Bash will see an associative array that contains each row as a single
|
||||
string. Bash cannot handle lists in associative arrays."
|
||||
(skip-unless
|
||||
;; Old GPLv2 BASH in macOSX does not support associative arrays.
|
||||
(if-let ((bash (executable-find "bash")))
|
||||
(eq 0 (process-file bash nil nil nil "-c" "declare -A assoc_array"))))
|
||||
(org-test-with-temp-text
|
||||
"#+NAME: sample_big_table
|
||||
| bread | 2 | kg |
|
||||
|
|
|
@ -191,20 +191,20 @@ echo 1
|
|||
* Main
|
||||
#+header: :tangle \"test-ob-tangle.el\" :comments noweb :noweb yes
|
||||
#+begin_src emacs-lisp
|
||||
1
|
||||
<<inner>>
|
||||
'(1
|
||||
<<inner>>)
|
||||
#+end_src"
|
||||
(unwind-protect
|
||||
(let ((org-babel-tangle-use-relative-file-links t))
|
||||
(org-babel-tangle)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents "test-ob-tangle.el")
|
||||
(buffer-string)
|
||||
(goto-char (point-min))
|
||||
(and
|
||||
(search-forward (concat ";; [[file:" (file-name-nondirectory file) "::inner") nil t)
|
||||
(search-forward ";; inner ends here" nil t))))
|
||||
(delete-file "test-ob-tangle.el")))))
|
||||
(unwind-protect
|
||||
(let ((org-babel-tangle-use-relative-file-links t))
|
||||
(org-babel-tangle)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents "test-ob-tangle.el")
|
||||
(buffer-string)
|
||||
(goto-char (point-min))
|
||||
(and
|
||||
(search-forward (concat ";; [[file:" (file-name-nondirectory file) "::inner") nil t)
|
||||
(search-forward ";; inner ends here\n" nil t))))
|
||||
(delete-file "test-ob-tangle.el")))))
|
||||
|
||||
(ert-deftest ob-tangle/comment-noweb-absolute ()
|
||||
"Test :comments noweb tangling with absolute file path."
|
||||
|
|
|
@ -2545,6 +2545,70 @@ abc
|
|||
(lambda (&rest _) (error "No warnings should occur"))))
|
||||
(org-babel-import-elisp-from-file (buffer-file-name))))))
|
||||
|
||||
(ert-deftest test-ob/org-babel-read ()
|
||||
"Test `org-babel-read' specifications."
|
||||
(dolist (inhibit '(t nil))
|
||||
;; A number
|
||||
(should (equal 1 (org-babel-read "1" inhibit)))
|
||||
(should (equal -1 (org-babel-read "-1" inhibit)))
|
||||
(should (equal 1.2 (org-babel-read "1.2" inhibit)))
|
||||
;; Allow whitespace
|
||||
(should (equal 1 (org-babel-read " 1 " inhibit)))
|
||||
(should (equal 1 (org-babel-read " 1\n" inhibit)))
|
||||
;; Not a number
|
||||
(should-not (equal 1 (org-babel-read "1foo" inhibit)))
|
||||
;; Empty string
|
||||
(should (equal "" (org-babel-read "" inhibit)))
|
||||
(should (equal " " (org-babel-read " " inhibit)))
|
||||
;; Elisp function call
|
||||
(should
|
||||
(equal (if inhibit
|
||||
;; Verbatim string, with spaces
|
||||
"(+ 1 2) "
|
||||
;; Result of evaluation
|
||||
3)
|
||||
(org-babel-read "(+ 1 2) " inhibit)))
|
||||
;; Elisp function call must start from (
|
||||
(should-not (equal 3 (org-babel-read " (+ 1 2)" nil)))
|
||||
(should
|
||||
(equal (if inhibit
|
||||
"'(1 2)"
|
||||
;; Result of evaluation
|
||||
'(1 2))
|
||||
(org-babel-read "'(1 2)" inhibit)))
|
||||
;; `(...)
|
||||
(should
|
||||
(equal (if inhibit
|
||||
"`(1 ,(+ 1 2))"
|
||||
;; Result of evaluation
|
||||
'(1 3))
|
||||
(org-babel-read "`(1 ,(+ 1 2))" inhibit)))
|
||||
;; [...]
|
||||
(should
|
||||
(equal (if inhibit
|
||||
"[1 2 (foo)]"
|
||||
;; Result of evaluation
|
||||
[1 2 (foo)])
|
||||
(org-babel-read "[1 2 (foo)]" inhibit)))
|
||||
;; Special case: *this* literal is evaluated
|
||||
(defvar *this* nil)
|
||||
(let ((*this* 100))
|
||||
(should
|
||||
(equal
|
||||
(if inhibit "*this*" 100)
|
||||
(org-babel-read "*this*" inhibit))))
|
||||
;; Special case: data inside quotes
|
||||
(should (equal "foo" (org-babel-read " \"foo\" " inhibit)))
|
||||
(should (equal "foo" (org-babel-read " \"foo\"\n" inhibit)))
|
||||
(should (equal "foo with\" inside" (org-babel-read " \"foo with\\\" inside\" " inhibit)))
|
||||
(should (equal "abc\nsdf" (org-babel-read "\"abc\nsdf\"" inhibit)))
|
||||
(should (equal "foo" (org-babel-read "\"foo\"" inhibit)))
|
||||
(should (equal "\"foo\"(\"bar\"" (org-babel-read "\"foo\"(\"bar\"" inhibit)))
|
||||
;; Unpaired quotes
|
||||
(should (equal "\"foo\"\"bar\"" (org-babel-read "\"foo\"\"bar\"" inhibit)))
|
||||
;; Recover from `read' parsing errors.
|
||||
(org-babel-read "\"Quoted closing quote:\\\"" inhibit)))
|
||||
|
||||
(ert-deftest test-ob/demarcate-block-split-duplication ()
|
||||
"Test duplication of language, body, switches, and headers in splitting."
|
||||
(let ((caption "#+caption: caption.")
|
||||
|
|
|
@ -61,6 +61,7 @@ See https://github.com/yantar92/org/issues/4."
|
|||
(org-test-with-temp-text "* Org link test
|
||||
[[https://example.com][A link to a site]]"
|
||||
(dotimes (_ 2)
|
||||
(font-lock-ensure)
|
||||
(goto-char 1)
|
||||
(re-search-forward "\\[")
|
||||
(should-not (org-xor org-link-descriptive (org-invisible-p)))
|
||||
|
|
|
@ -168,6 +168,14 @@
|
|||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(should (search-forward "agenda-file2:19:00-20:00 Scheduled: TODO four")))
|
||||
;; `org-agenda-default-appointment-duration'
|
||||
;; should not affect date range in timestamps.
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(should-not (re-search-forward "agenda-file2:19:00-20:00.+TODO five" nil t)))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(should (search-forward "agenda-file2:19:00...... (1/2): TODO five")))
|
||||
;; Bug https://list.orgmode.org/orgmode/20211119135325.7f3f85a9@hsu-hh.de/
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
|
@ -598,7 +606,7 @@ DEADLINE: " (cdr timestamp))))
|
|||
(dolist (org-agenda-skip-scheduled-repeats-after-deadline '(nil t))
|
||||
(org-test-at-time "2024-01-01 8:00"
|
||||
(org-test-with-temp-text-in-file "
|
||||
* TODO Do me every day before Jan, 12th (included)
|
||||
* TODO Do me every day until Jan, 5th (inclusive)
|
||||
SCHEDULED: <2024-01-03 Wed +1d> DEADLINE: <2024-01-05 Fri>
|
||||
"
|
||||
(let ((org-agenda-span 'week)
|
||||
|
@ -614,15 +622,15 @@ SCHEDULED: <2024-01-03 Wed +1d> DEADLINE: <2024-01-05 Fri>
|
|||
(string-match-p
|
||||
"Week-agenda (W01):
|
||||
Monday 1 January 2024 W01
|
||||
[^:]+:In 4 d.: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:In 4 d.: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Tuesday 2 January 2024
|
||||
Wednesday 3 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Thursday 4 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Friday 5 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Deadline: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
[^:]+:Deadline: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Saturday 6 January 2024
|
||||
Sunday 7 January 2024"
|
||||
(buffer-string)))
|
||||
|
@ -631,19 +639,19 @@ Sunday 7 January 2024"
|
|||
(string-match-p
|
||||
"Week-agenda (W01):
|
||||
Monday 1 January 2024 W01
|
||||
[^:]+:In 4 d.: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:In 4 d.: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Tuesday 2 January 2024
|
||||
Wednesday 3 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Thursday 4 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Friday 5 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Deadline: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
[^:]+:Deadline: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Saturday 6 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)
|
||||
Sunday 7 January 2024
|
||||
[^:]+:Scheduled: TODO Do me every day before Jan, 12th (included)"
|
||||
[^:]+:Scheduled: TODO Do me every day until Jan, 5th (inclusive)"
|
||||
(buffer-string))))))
|
||||
(org-test-agenda--kill-all-agendas))))
|
||||
|
||||
|
@ -690,43 +698,65 @@ Sunday 7 January 2024
|
|||
(ert-deftest test-org-agenda/skip-deadline-prewarning-if-scheduled ()
|
||||
"Test `org-agenda-skip-deadline-prewarning-if-scheduled'."
|
||||
(org-test-at-time
|
||||
"2024-01-15"
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled t))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
"2024-01-15"
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled t))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 10))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))
|
||||
;; Custom prewarning cookie "-3d", so there should be no warning anyway.
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 10))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat -3d> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 3))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled nil))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-16 Tue>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-15 Mon>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))))
|
||||
|
||||
(ert-deftest test-org-agenda/diary-timestamp ()
|
||||
"Test diary timestamp handling."
|
||||
(org-test-at-time
|
||||
"2024-01-15"
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\n<%%(diary-date 01 15 2024)>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 10))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(should (search-forward "foo" nil t)))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\n<%%(diary-date 02 15 2024)>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))
|
||||
;; Custom prewarning cookie "-3d", so there should be no warning anyway.
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 10))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat -3d> SCHEDULED: <2024-01-19 Fri>"
|
||||
(should-not (search-forward "foo" nil t)))
|
||||
;; Test time and time ranges in diary timestamps.
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\n<%%(diary-date 01 15 2024) 12:00>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 3))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(should (search-forward "12:00" nil t)))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\n<%%(diary-date 01 15 2024) 12:00-14:00>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled nil))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-19 Fri>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-16 Tue>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should-not (search-forward "In " nil t))))
|
||||
(let ((org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled))
|
||||
(org-test-agenda-with-agenda
|
||||
"* TODO foo\nDEADLINE: <2024-01-20 Sat> SCHEDULED: <2024-01-15 Mon>"
|
||||
(org-agenda-list nil nil 1)
|
||||
(should (search-forward "In " nil t))))))
|
||||
(should (search-forward "12:00-14:00" nil t)))))
|
||||
|
||||
|
||||
;; agenda redo
|
||||
|
|
|
@ -244,6 +244,30 @@
|
|||
:immediate-finish t))))
|
||||
(org-capture nil "t")
|
||||
(buffer-string))))
|
||||
;; Do not raise an error on templates that do not start with a heading.
|
||||
(should
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Test" entry (file ,file) "Foo"
|
||||
:immediate-finish t))))
|
||||
(org-capture nil "t"))))
|
||||
(should
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Test" entry (file ,file) "*bold*"
|
||||
:immediate-finish t))))
|
||||
(org-capture nil "t"))))
|
||||
;; Raise an error on templates with a lower level heading after a
|
||||
;; higher level one.
|
||||
(should-error
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Test" entry (file ,file) "** X\n* Y"
|
||||
:immediate-finish t))))
|
||||
(org-capture nil "t"))))
|
||||
;; With a 0 prefix argument, ignore surrounding lists.
|
||||
(should
|
||||
(equal "Foo\n* X\nBar\n"
|
||||
|
@ -589,6 +613,16 @@
|
|||
"| 2 |" :immediate-finish t))))
|
||||
(org-capture nil "t"))
|
||||
(buffer-string))))
|
||||
;; Prepend | when the template does not start with it
|
||||
(should
|
||||
(equal "| 1 |\n| 2 |\n"
|
||||
(org-test-with-temp-text-in-file "| 1 |\n"
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Table" table-line (file ,file)
|
||||
"2 |" :immediate-finish t))))
|
||||
(org-capture nil "t")
|
||||
(buffer-string)))))
|
||||
;; When `:prepend' is nil, add the row at the end of the table.
|
||||
(should
|
||||
(equal "| a |\n| x |\n"
|
||||
|
|
|
@ -118,7 +118,7 @@ the buffer."
|
|||
(org-clock-timestamps-change 'up 1)
|
||||
(buffer-string))))))
|
||||
|
||||
(ert-deftest test-org-clok/org-clock-update-time-maybe ()
|
||||
(ert-deftest test-org-clock/org-clock-update-time-maybe ()
|
||||
"Test `org-clock-update-time-maybe' specifications."
|
||||
(should
|
||||
(equal
|
||||
|
|
|
@ -1398,6 +1398,13 @@
|
|||
|
||||
;;; Dynamic block
|
||||
|
||||
(defun test-org-colview/dblock-formatter (ipos table params)
|
||||
"User-defined columnview dblock formatting function."
|
||||
(goto-char ipos)
|
||||
(insert-before-markers "Hello columnview!" "\n")
|
||||
(insert-before-markers (format "table has %d rows" (length table)) "\n")
|
||||
(insert-before-markers (format "there are %d parameters" (/ (length params) 2))))
|
||||
|
||||
(ert-deftest test-org-colview/dblock ()
|
||||
"Test the column view table."
|
||||
(should
|
||||
|
@ -1703,6 +1710,31 @@ SCHEDULED: <2020-05-11 Mon> DEADLINE: <2020-05-14 Thu>
|
|||
(let ((org-columns-default-format
|
||||
"%ITEM %DEADLINE(d) %SCHEDULED(s) %TIMESTAMP(t)"))
|
||||
(org-update-dblock))
|
||||
(buffer-substring-no-properties (point) (point-max)))))
|
||||
;; custom formatting function
|
||||
(should
|
||||
(equal
|
||||
"#+BEGIN: columnview :formatter test-org-colview/dblock-formatter
|
||||
Hello columnview!
|
||||
table has 3 rows
|
||||
there are 4 parameters
|
||||
#+END:"
|
||||
(org-test-with-temp-text
|
||||
"* H\n<point>#+BEGIN: columnview :formatter test-org-colview/dblock-formatter\n#+END:"
|
||||
(let ((org-columns-default-format "%ITEM"))
|
||||
(org-update-dblock))
|
||||
(buffer-substring-no-properties (point) (point-max)))))
|
||||
;; test headline linkification
|
||||
(should
|
||||
(equal
|
||||
"#+BEGIN: columnview :link t
|
||||
| ITEM |
|
||||
|------|
|
||||
| [[*H][H]] |
|
||||
#+END:"
|
||||
(org-test-with-temp-text
|
||||
"* H\n<point>#+BEGIN: columnview :link t\n#+END:"
|
||||
(let ((org-columns-default-format "%ITEM")) (org-update-dblock))
|
||||
(buffer-substring-no-properties (point) (point-max))))))
|
||||
|
||||
(provide 'test-org-colview)
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
;;; test-org-ctags.el --- tests for org-ctags.el -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2024 Max Nikulin
|
||||
;; Authors: Max Nikulin
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Alternative implementation for `test-org-ctags/mock-command'
|
||||
;; is required for cmd.exe.
|
||||
(unless (string-equal "-c" shell-command-switch)
|
||||
(signal 'missing-test-dependency "POSIX shell"))
|
||||
|
||||
(require 'org-ctags)
|
||||
|
||||
;;;; Helpers:
|
||||
|
||||
(defun test-org-ctags/mock-command (temp-file command-name)
|
||||
"Define shell function COMMAND-NAME wrining arguments to TEMP-FILE."
|
||||
;; Failure exit code is used to prevent further `org-ctags' actions.
|
||||
(format "%s() { printf '%%s\\n' %s \"$@\" >%s 2>&1 ; false ; } ; %s"
|
||||
command-name command-name
|
||||
(shell-quote-argument temp-file)
|
||||
command-name))
|
||||
|
||||
(defun test-org-ctags/get-args (temp-file base magic)
|
||||
"Read list of strings from TEMP-FILE.
|
||||
|
||||
If TEMP-FILE does not start from MAGIC then return
|
||||
its content as a string. Otherwise strip first line
|
||||
and trailing newline, replace BASE with \"TMPDIR\" string,
|
||||
return list of lines."
|
||||
(let* ((case-fold-search nil)
|
||||
(content
|
||||
(and
|
||||
(file-exists-p temp-file)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents temp-file)
|
||||
(goto-char (point-min))
|
||||
(when (looking-at magic)
|
||||
(while (search-forward base nil 'noerror)
|
||||
(replace-match "TMPDIR" 'fixedcase 'literal)))
|
||||
(goto-char (point-max))
|
||||
(when (and (bolp) (> (point) 1))
|
||||
(delete-char -1))
|
||||
(buffer-string)))))
|
||||
(if (and content (string-prefix-p magic content))
|
||||
(cdr (split-string content "\n"))
|
||||
content)))
|
||||
|
||||
(defmacro test-org-ctags/with-fake-ctags
|
||||
(temp-dir subdir &rest body)
|
||||
"Run BODY with `org-ctags-path-to-ctags' set to a test function.
|
||||
|
||||
Create a buffer backed by a file in the TEMP-DIR/SUBDIR directory."
|
||||
(declare (indent 2))
|
||||
(let ((buffer (gensym "buffer"))
|
||||
(base (gensym "base"))
|
||||
(dir (gensym "dir"))
|
||||
(temp-file (gensym "temp-file")))
|
||||
`(let* ((,base ,temp-dir)
|
||||
(,dir (concat ,base "/" ,subdir))
|
||||
(,temp-file (concat ,dir "/ctags.txt"))
|
||||
(org-ctags-path-to-ctags
|
||||
(test-org-ctags/mock-command ,temp-file "ctags_mock"))
|
||||
,buffer)
|
||||
(make-directory ,dir)
|
||||
(unwind-protect
|
||||
;; `org-ctags' commands call `buffer-file-name'.
|
||||
(with-current-buffer
|
||||
(setq ,buffer (find-file-noselect ,temp-file))
|
||||
(insert "Should be overwritten by org-ctags mock script")
|
||||
(save-buffer)
|
||||
,@body
|
||||
(test-org-ctags/get-args ,temp-file ,base "ctags_mock\n"))
|
||||
(kill-buffer ,buffer)
|
||||
(delete-file ,temp-file)
|
||||
(delete-directory ,dir)))))
|
||||
|
||||
;;;; Comparator to have informative failures:
|
||||
|
||||
(defun test-org-ctags/list-elements (lst &optional indicies)
|
||||
"Select INDICIES elements from LST list.
|
||||
|
||||
INDICIES should be sorted in growing order."
|
||||
(if (not (and indicies (listp lst)))
|
||||
lst
|
||||
(let (selected
|
||||
(prev 0))
|
||||
(dolist (i indicies (nreverse selected))
|
||||
(setq lst (nthcdr (- i prev) lst))
|
||||
(setq prev i)
|
||||
(push (car lst) selected)))))
|
||||
|
||||
(defun test-org-ctags/list-elements-equal-p
|
||||
(expect actual indicies &rest _comments)
|
||||
"Call `equal' for lists EXPECT and INDICIES elements from ACTUAL.
|
||||
|
||||
_COMMENTS should appear in failure message."
|
||||
(equal expect
|
||||
(test-org-ctags/list-elements actual indicies)))
|
||||
|
||||
(defun test-org-ctags/list-elements-equal-explain
|
||||
(expect actual indicies &rest _comments)
|
||||
"`ert-eplainer' for `test-org-ctags/list-elements-equal-p'."
|
||||
(if (listp actual)
|
||||
(list
|
||||
'selected-elements
|
||||
(test-org-ctags/list-elements actual indicies))
|
||||
"Shell command failed"))
|
||||
|
||||
(put 'test-org-ctags/list-elements-equal-p
|
||||
'ert-explainer
|
||||
'test-org-ctags/list-elements-equal-explain)
|
||||
|
||||
;;;; Tests:
|
||||
|
||||
(ert-deftest test-org-ctags/create-tags-escape ()
|
||||
"Test that `org-ctags-create-tags' escapes shell arguments."
|
||||
(let ((temp-dir (make-temp-file "test-org-ctags-" 'dir)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
(list (format "--regex-orgmode=%s" org-ctags-tag-regexp))
|
||||
(test-org-ctags/with-fake-ctags temp-dir "regexp"
|
||||
(org-ctags-create-tags))
|
||||
'(2)
|
||||
"Regexp should be escaped."))
|
||||
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
'("TMPDIR/regular/ctags.txt")
|
||||
(test-org-ctags/with-fake-ctags temp-dir "regular"
|
||||
(org-ctags-create-tags (concat temp-dir "/regular")))
|
||||
'(7)
|
||||
"Wildcard should be expanded."
|
||||
"Directory passed as an argument."))
|
||||
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
'("TMPDIR/space char/TAGS" "TMPDIR/space char/ctags.txt")
|
||||
(test-org-ctags/with-fake-ctags temp-dir "space char"
|
||||
(org-ctags-create-tags (concat temp-dir "/space char")))
|
||||
'(4 7)
|
||||
"Space characters should not split arguments."
|
||||
"Directory passed as an argument."))
|
||||
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
'("TMPDIR/apostrophe' sep '/TAGS" "TMPDIR/apostrophe' sep '/ctags.txt")
|
||||
(test-org-ctags/with-fake-ctags temp-dir "apostrophe' sep '"
|
||||
(org-ctags-create-tags))
|
||||
'(4 7)
|
||||
"Apostrophes should be regular characters."
|
||||
"Path is derived from `default-directory'."))
|
||||
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
'("TMPDIR/def-dir.$HOME/TAGS" "TMPDIR/def-dir.$HOME/ctags.txt")
|
||||
(test-org-ctags/with-fake-ctags temp-dir "def-dir.$HOME"
|
||||
(org-ctags-create-tags))
|
||||
'(4 7)
|
||||
"$VARIABLES should not be expanded in directory names."
|
||||
"Path is derived from `default-directory'."))
|
||||
|
||||
(should
|
||||
(test-org-ctags/list-elements-equal-p
|
||||
'("TMPDIR/arg.$HOME/TAGS" "TMPDIR/arg.$HOME/ctags.txt")
|
||||
(test-org-ctags/with-fake-ctags temp-dir "arg.$HOME"
|
||||
(org-ctags-create-tags (concat temp-dir "/arg.$HOME")))
|
||||
'(4 7)
|
||||
"$VARIABLES should not be expanded in directory names."
|
||||
"Directory passed as an argument")))
|
||||
(delete-directory temp-dir))))
|
||||
|
||||
(provide 'test-org-ctags)
|
||||
;;; test-org.el ends here
|
|
@ -3989,8 +3989,31 @@ DEADLINE: <2012-03-29 thu.> SCHEDULED: <2012-03-29 thu.> CLOSED: [2012-03-29 thu
|
|||
(org-test-parse-and-interpret
|
||||
"<2012-03-29 thu. 16:40-16:41>")))
|
||||
;; Diary.
|
||||
(should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>")
|
||||
"<%%diary-float t 4 2>\n"))
|
||||
(should (equal (org-test-parse-and-interpret "<%%(diary-float t 4 2)>")
|
||||
"<%%(diary-float t 4 2)>\n"))
|
||||
;; Diary with time.
|
||||
(should (equal (org-test-parse-and-interpret "<%%(diary-float t 4 2) 12:00>")
|
||||
"<%%(diary-float t 4 2) 12:00>\n"))
|
||||
(should (equal (org-test-parse-and-interpret "<%%(diary-cyclic 1 1 1 2020) 12:00-14:00>")
|
||||
"<%%(diary-cyclic 1 1 1 2020) 12:00-14:00>\n"))
|
||||
(org-test-with-temp-text "<%%(diary-float t 4 2) 12:00>"
|
||||
(let ((ts (org-element-context)))
|
||||
(should (org-element-type-p ts 'timestamp))
|
||||
(should (eq 'diary (org-element-property :type ts)))
|
||||
(should (eq nil (org-element-property :range-type ts)))
|
||||
(should (equal 12 (org-element-property :hour-start ts)))
|
||||
(should (equal 0 (org-element-property :minute-start ts)))
|
||||
(should-not (org-element-property :hour-end ts))
|
||||
(should-not (org-element-property :minute-end ts))))
|
||||
(org-test-with-temp-text "<%%(diary-float t 4 2) 12:00-14:01>"
|
||||
(let ((ts (org-element-context)))
|
||||
(should (org-element-type-p ts 'timestamp))
|
||||
(should (eq 'diary (org-element-property :type ts)))
|
||||
(should (eq 'timerange (org-element-property :range-type ts)))
|
||||
(should (equal 12 (org-element-property :hour-start ts)))
|
||||
(should (equal 0 (org-element-property :minute-start ts)))
|
||||
(should (equal 14 (org-element-property :hour-end ts)))
|
||||
(should (equal 1 (org-element-property :minute-end ts)))))
|
||||
;; Timestamp with repeater interval, repeater deadline, with delay, with combinations.
|
||||
(should
|
||||
(string-match "<2012-03-29 .* \\+1y>"
|
||||
|
@ -4983,6 +5006,18 @@ Text
|
|||
|
||||
|
||||
;;; Test Cache.
|
||||
(ert-deftest test-org-element/cache-map ()
|
||||
"Test `org-element-cache-map'."
|
||||
(org-test-with-temp-text "* headline\n:DRAWER:\nparagraph\n:END:\n* headline 2"
|
||||
(should
|
||||
(equal
|
||||
'(org-data headline section drawer paragraph headline)
|
||||
(org-element-cache-map #'car :granularity 'element))))
|
||||
(should
|
||||
(equal
|
||||
'(org-data headline section drawer paragraph)
|
||||
(org-test-with-temp-text "* headline\n:DRAWER:\nparagraph\n:END:"
|
||||
(org-element-cache-map #'car :granularity 'element)))))
|
||||
|
||||
(ert-deftest test-org-element/cache ()
|
||||
"Test basic expectations and common pitfalls for cache."
|
||||
|
|
|
@ -22,6 +22,21 @@
|
|||
|
||||
;;; Macros
|
||||
|
||||
(ert-deftest test-org-macro/initialize-templates ()
|
||||
"Test `org-macro-initialize-templates'."
|
||||
;; No code is executed during loading of Org mode files."
|
||||
(should
|
||||
(org-test-with-temp-text
|
||||
"#+MACRO: title (eval (eval-and-compile (error \"CVE-2024-30202\")))"
|
||||
(progn
|
||||
(org-macro-initialize-templates)
|
||||
t)))
|
||||
(org-test-with-temp-text
|
||||
"#+MACRO: title (eval (eval-and-compile (error \"CVE-2024-30202\")))"
|
||||
(progn
|
||||
(org-mode)
|
||||
t)))
|
||||
|
||||
(ert-deftest test-org/macro-replace-all ()
|
||||
"Test `org-macro-replace-all' specifications."
|
||||
;; Standard test.
|
||||
|
|
|
@ -938,7 +938,7 @@ See also URL `https://orgmode.org/worg/org-tutorials/org-lookups.html'."
|
|||
;; For Lisp formula
|
||||
(should (equal "\"0\"" (org-table-make-reference "0" nil nil t)))
|
||||
(should (equal "\"z\"" (org-table-make-reference "z" nil nil t)))
|
||||
(should (equal "" (org-table-make-reference "" nil nil t)))
|
||||
(should (equal "\"\"" (org-table-make-reference "" nil nil t)))
|
||||
(should (equal "\"0\" \"1\"" (org-table-make-reference '("0" "1") nil nil t)))
|
||||
(should (equal "\"z\" \"1\"" (org-table-make-reference '("z" "1") nil nil t)))
|
||||
(should (equal "\"1\"" (org-table-make-reference '("" "1") nil nil t)))
|
||||
|
@ -965,7 +965,7 @@ See also URL `https://orgmode.org/worg/org-tutorials/org-lookups.html'."
|
|||
;; For Lisp formula
|
||||
(should (equal "0" (org-table-make-reference "0" nil t t)))
|
||||
(should (equal "0" (org-table-make-reference "z" nil t t)))
|
||||
(should (equal "" (org-table-make-reference "" nil t t)))
|
||||
(should (equal "0" (org-table-make-reference "" nil t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("0" "1") nil t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("z" "1") nil t t)))
|
||||
(should (equal "1" (org-table-make-reference '("" "1") nil t t)))
|
||||
|
|
|
@ -3630,6 +3630,20 @@ Foo Bar
|
|||
(org-open-at-point))
|
||||
nil)))))
|
||||
|
||||
|
||||
;;; Thing at point
|
||||
|
||||
(ert-deftest test-org/thing-at-point/url ()
|
||||
"Test that `thing-at-point' returns the URL at point."
|
||||
(org-test-with-temp-text
|
||||
"[[https://www.gnu.org/software/emacs/][GNU Emacs]]"
|
||||
(when (boundp 'thing-at-point-provider-alist)
|
||||
(should (string= (thing-at-point 'url)
|
||||
"https://www.gnu.org/software/emacs/")))
|
||||
(when (boundp 'bounds-of-thing-at-point-provider-alist)
|
||||
(should (equal (bounds-of-thing-at-point 'url)
|
||||
'(1 . 51))))))
|
||||
|
||||
|
||||
;;; Node Properties
|
||||
|
||||
|
@ -4072,7 +4086,17 @@ text"
|
|||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(org-ctrl-c-ctrl-c))
|
||||
(should (org-fold-folded-p (point) 'outline))))
|
||||
(should (org-fold-folded-p (point) 'outline)))
|
||||
;; Quit column view.
|
||||
(org-test-with-temp-text
|
||||
"* Heading<point>
|
||||
text"
|
||||
(org-columns)
|
||||
(should org-columns-overlays)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(org-ctrl-c-ctrl-c))
|
||||
(should-not org-columns-overlays)))
|
||||
|
||||
|
||||
;;; Navigation
|
||||
|
@ -8896,7 +8920,22 @@ CLOSED: %s
|
|||
(let ((org-todo-keywords '((sequence "TODO" "DONE"))))
|
||||
(org-test-with-temp-text "* TODO H\n<2012-03-29 Thu +2y>"
|
||||
(org-todo '-)
|
||||
(buffer-string))))))
|
||||
(buffer-string)))))
|
||||
;; C-u forces logging note.
|
||||
;; However, logging falls back to "time" when `org-inhibit-logging'
|
||||
;; is 'note.
|
||||
(dolist (org-inhibit-logging '(nil t note))
|
||||
(let ((org-todo-keywords '((sequence "TODO" "DONE"))))
|
||||
(org-test-with-temp-text "* TODO H\n"
|
||||
(unwind-protect
|
||||
(progn
|
||||
(org-todo '(4))
|
||||
(should (string-match-p "DONE" (buffer-string)))
|
||||
(should (member #'org-add-log-note post-command-hook))
|
||||
(if (eq org-inhibit-logging 'note)
|
||||
(should (eq org-log-note-how 'time))
|
||||
(should (eq org-log-note-how 'note))))
|
||||
(remove-hook 'post-command-hook #'org-add-log-note))))))
|
||||
|
||||
|
||||
;;; Timestamps API
|
||||
|
@ -9356,6 +9395,18 @@ CLOSED: %s
|
|||
(org-test-with-temp-text "* H1\n<point>Paragraph\n* H2"
|
||||
(org-paste-subtree nil "* Text")
|
||||
(buffer-string))))
|
||||
;; With prefix argument, move to the end of subtree.
|
||||
(should
|
||||
(equal "* H1\nParagraph\n** H1.1\n* Text\n* H2"
|
||||
(org-test-with-temp-text "* H1\n<point>Paragraph\n** H1.1\n* H2"
|
||||
(org-paste-subtree '(4) "* Text")
|
||||
(buffer-string))))
|
||||
;; With double prefix argument, move to first sibling
|
||||
(should
|
||||
(equal "* H1\nParagraph\n** Text\n** H1.1\n* H2"
|
||||
(org-test-with-temp-text "* H1\n<point>Paragraph\n** H1.1\n* H2"
|
||||
(org-paste-subtree '(16) "* Text")
|
||||
(buffer-string))))
|
||||
;; If point is between two headings, use the deepest level.
|
||||
(should
|
||||
(equal "* H1\n\n* Text\n* H2"
|
||||
|
@ -9372,6 +9423,30 @@ CLOSED: %s
|
|||
(org-test-with-temp-text "* H1\n<point>\n** H2"
|
||||
(org-paste-subtree nil "* Text")
|
||||
(buffer-string))))
|
||||
;; When point is on heading at bol, insert before
|
||||
(should
|
||||
(equal "* Text\n* H1\n** H2"
|
||||
(org-test-with-temp-text "<point>* H1\n** H2"
|
||||
(org-paste-subtree nil "*** Text")
|
||||
(buffer-string))))
|
||||
;; With prefix argument, ignore that we are at bol
|
||||
(should
|
||||
(equal "* H1\n** H2\n* Text\n"
|
||||
(org-test-with-temp-text "<point>* H1\n** H2"
|
||||
(org-paste-subtree '(4) "*** Text")
|
||||
(buffer-string))))
|
||||
;; When point is on heading but not at bol, use smallest level among
|
||||
;; current heading and next, inserting before the next heading.
|
||||
(should
|
||||
(equal "* H1\ncontents\n** Text\n** H2"
|
||||
(org-test-with-temp-text "* H1<point>\ncontents\n** H2"
|
||||
(org-paste-subtree nil "*** Text")
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "*** H1\ncontents\n*** Text\n* H2"
|
||||
(org-test-with-temp-text "*** H1<point>\ncontents\n* H2"
|
||||
(org-paste-subtree nil "* Text")
|
||||
(buffer-string))))
|
||||
;; When on an empty heading, after the stars, deduce the new level
|
||||
;; from the number of stars.
|
||||
(should
|
||||
|
|
|
@ -39,5 +39,67 @@
|
|||
(goto-char (point-min))
|
||||
(should (search-forward "#### Footnotes"))))))
|
||||
|
||||
(ert-deftest ox-md/headline-style ()
|
||||
"Test `org-md-headline-style' being honored."
|
||||
(dolist (org-md-headline-style '(atx setext mixed))
|
||||
(let ((export-buffer "*Test MD Export*")
|
||||
(org-export-show-temporary-export-buffer nil))
|
||||
(org-test-with-temp-text "#+options: toc:nil h:10
|
||||
* level 1
|
||||
** level 2
|
||||
*** level 3
|
||||
**** level 4
|
||||
***** level 5
|
||||
****** level 6
|
||||
******* level 7
|
||||
"
|
||||
(org-export-to-buffer 'md export-buffer)
|
||||
(with-current-buffer export-buffer
|
||||
(goto-char (point-min))
|
||||
(pcase org-md-headline-style
|
||||
(`atx
|
||||
(should (search-forward "# level 1"))
|
||||
(should (search-forward "## level 2"))
|
||||
(should (search-forward "### level 3"))
|
||||
(should (search-forward "#### level 4"))
|
||||
(should (search-forward "##### level 5"))
|
||||
(should (search-forward "###### level 6"))
|
||||
(should (search-forward "1. level 7")))
|
||||
(`setext
|
||||
(should (search-forward "level 1\n======="))
|
||||
(should (search-forward "level 2\n------"))
|
||||
(should (search-forward "1. level 3"))
|
||||
(should (search-forward "1. level 4"))
|
||||
(should (search-forward "1. level 5"))
|
||||
(should (search-forward "1. level 6"))
|
||||
(should (search-forward "1. level 7")))
|
||||
(`mixed
|
||||
(should (search-forward "level 1\n======="))
|
||||
(should (search-forward "level 2\n------"))
|
||||
(should (search-forward "### level 3"))
|
||||
(should (search-forward "#### level 4"))
|
||||
(should (search-forward "##### level 5"))
|
||||
(should (search-forward "###### level 6"))
|
||||
(should (search-forward "1. level 7")))))))))
|
||||
|
||||
(ert-deftest ox-md/item ()
|
||||
"Test `org-md-item'."
|
||||
;; Align items at column 4.
|
||||
;; Columns >=100 not aligned.
|
||||
(org-test-with-temp-text
|
||||
(mapconcat
|
||||
#'identity
|
||||
(cl-loop for n from 1 to 105
|
||||
collect (format "%d. item" n))
|
||||
"\n")
|
||||
(let ((export-buffer "*Test MD Export*")
|
||||
(org-export-show-temporary-export-buffer nil))
|
||||
(org-export-to-buffer 'md export-buffer)
|
||||
(with-current-buffer export-buffer
|
||||
(goto-char (point-min))
|
||||
(should (search-forward "1. item"))
|
||||
(should (search-forward "10. item"))
|
||||
(should (search-forward "101. item"))))))
|
||||
|
||||
(provide 'test-ox-md)
|
||||
;;; test-ox-md.el ends here
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue