Nicolas Goaziou
772f7acb65
macro: Fix modification-time macro
...
* lisp/org-macro.el (org-macro-initialize-templates): Make second
argument optional for modification-time macro.
2021-04-19 01:11:37 +02:00
Stefan Monnier
8e68eac0bd
macro: Do not generate macros with (&optional &rest _) signature
...
* lisp/org-macro.el (org-macro--makeargs): Fix Emacs-26 burping
because of a bug when functions are declared with 0 optional arguments
like (&optional &rest x).
2021-04-17 11:45:40 +02:00
Stefan Monnier
8abdbbee39
macro: Improve speed for `eval' macros
...
* lisp/org-macro.el (org-macro--makeargs): New function.
(org-macro--set-templates): New function.
(org-macro--set-template): Remove function.
(org-macro-initialize-templates): Add optional argument to
signature. Add macro definitions as functions.
(org-macro-expand): Allow functions as macro definitions.
(org-macro--counter-increment): Handle nil argument.
* lisp/ox.el (org-export-as): Apply signature change for
`org-initialize-templates'.
The main difference with the previous behaviour is that missing
arguments are now treated as nil instead of the empty string.
See <http://lists.gnu.org/r/emacs-orgmode/2021-04/msg00219.html >.
2021-04-16 16:37:22 +02:00
Kyle Meyer
99eafe3787
Update copyright year to 2021
2021-01-01 14:59:01 -05:00
Nicolas Goaziou
3e44ddbe78
macro: Small refactoring.
...
* lisp/org-macro.el (org-macro--collect-macros): Use
`org-collect-keywords'.
2020-04-26 22:57:47 +02:00
Nicolas Goaziou
7e38f69178
Merge branch 'maint'
2020-03-11 21:53:25 +01:00
Nicolas Goaziou
685b2c4410
org-macro: Fix last commit
...
* lisp/org-macro.el (org-macro--set-template): Do not override value
with an empty one.
This is a followup to 965cdbfd4b
.
2020-03-11 21:52:19 +01:00
Nicolas Goaziou
965cdbfd4b
org-macro: Fix {{{author}}} expansion without AUTHOR keyword
...
* lisp/org-macro.el (org-macro--set-template): Allow setting a nil
value, which becomes an empty template.
* testing/lisp/test-org-macro.el (test-org-macro/author):
(test-org-macro/email):
(test-org-macro/title): New tests.
Reported-by: "Dauer, Michael" <michael.dauer@smartpm.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-03/msg00094.html >
2020-03-11 16:24:26 +01:00
Nicolas Goaziou
4cf8ffdba6
org-macro: Fix {{{author}}} expansion without AUTHOR keyword
...
* lisp/org-macro.el (org-macro--set-template): Allow setting a nil
value, which becomes an empty template.
* testing/lisp/test-org-macro.el (test-org-macro/author):
(test-org-macro/email):
(test-org-macro/title): New tests.
Reported-by: "Dauer, Michael" <michael.dauer@smartpm.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-03/msg00094.html >
2020-03-11 16:21:49 +01:00
Bastien
6a1f6ee1f8
Tiny formatting fixes
...
* lisp/ox.el (org-export-table-dimensions):
* lisp/ox-texinfo.el (org-texinfo-template):
* lisp/ox-md.el (org-md-link):
* lisp/ox-icalendar.el (org-icalendar-use-UTC-date-time-p):
* lisp/ox-ascii.el (org-ascii-fixed-width):
* lisp/org.el (org-context):
* lisp/org-table.el (org-table-eval-formula)
(org-table-export):
* lisp/org-refile.el:
* lisp/org-plot.el (org-plot/gnuplot-to-grid-data):
* lisp/org-num.el (org-num):
* lisp/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org-macro.el (org-macro):
* lisp/org-lint.el (org-lint):
* lisp/org-keys.el (org-keys):
* lisp/org-duration.el:
* lisp/org-clock.el (org-clock-get-last-clock-out-time)
(org-clock-update-mode-line, org-find-open-clocks):
* lisp/org-agenda.el (org-diary)
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)
(org-agenda-highlight-todo, org-cmp-alpha)
(org-agenda-filter-by-category):
* lisp/ol.el (org-link-expand-abbrev, ol):
* lisp/ol-docview.el (ol-docview):
* lisp/ol-bibtex.el (org-execute-file-search-in-bibtex)
(org-bibtex, org-bibtex-read):
* lisp/ol-bbdb.el (org-bbdb-anniversary-description):
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org):
* lisp/ob-table.el (org-babel-table-truncate-at-newline):
* lisp/ob-stan.el:
* lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar):
* lisp/ob-sql.el:
* lisp/ob-shen.el:
* lisp/ob-shell.el (org-babel-prep-session:shell)
(org-babel-prep-session:shell):
* lisp/ob-sed.el (org-babel-execute:sed)
(org-babel-execute:sed):
* lisp/ob-screen.el:
* lisp/ob-sass.el:
* lisp/ob-ruby.el (org-babel-prep-session:ruby)
(org-babel-prep-session:ruby):
* lisp/ob-ref.el (org-babel-ref-resolve, ob-ref):
* lisp/ob-python.el (org-babel-prep-session:python)
(org-babel-prep-session:python):
* lisp/ob-plantuml.el:
* lisp/ob-picolisp.el:
* lisp/ob-perl.el:
* lisp/ob-org.el:
* lisp/ob-octave.el (org-babel-prep-session:octave)
(org-babel-prep-session:octave)
(org-babel-octave-evaluate-session):
* lisp/ob-ocaml.el:
* lisp/ob-mscgen.el (org-babel-execute:mscgen)
(org-babel-execute:mscgen):
* lisp/ob-maxima.el:
(ob-maxima):
* lisp/ob-matlab.el:
* lisp/ob-makefile.el:
* lisp/ob-lua.el (org-babel-prep-session:lua)
(org-babel-prep-session:lua):
* lisp/ob-lisp.el:
* lisp/ob-ledger.el:
* lisp/ob-latex.el (org-babel-expand-body:latex)
(org-babel-expand-body:latex, ob-latex):
* lisp/ob-js.el:
* lisp/ob-java.el:
* lisp/ob-io.el (org-babel-prep-session:io)
(org-babel-prep-session:io):
* lisp/ob-hledger.el:
* lisp/ob-haskell.el:
* lisp/ob-groovy.el (org-babel-groovy-wrapper-method)
(org-babel-groovy-evaluate):
* lisp/ob-gnuplot.el:
* lisp/ob-fortran.el (org-babel-expand-body:fortran)
(org-babel-expand-body:fortran):
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-exp.el (ob-exp):
* lisp/ob-eval.el:
* lisp/ob-emacs-lisp.el:
* lisp/ob-ebnf.el:
* lisp/ob-dot.el:
* lisp/ob-ditaa.el:
* lisp/ob-css.el:
* lisp/ob-core.el (org-babel-put-rownames):
* lisp/ob-coq.el:
* lisp/ob-comint.el:
* lisp/ob-calc.el:
* lisp/ob-awk.el:
* lisp/ob-asymptote.el:
* lisp/ob-abc.el:
* lisp/ob-R.el (org-babel-prep-session:R): Formatting fixes.
2020-02-18 22:57:37 +01:00
Kyle Meyer
ff5fc050d3
Update copyright year to 2020
2020-01-01 13:38:46 -05:00
Nicolas Goaziou
9bbae3ce8f
Merge branch 'maint'
2019-04-29 20:49:09 +02:00
Nicolas Goaziou
727c3f442b
org-macro: Exit early when looking for keywords
...
* lisp/org-macro.el (org-macro--find-keyword-value): Change signature.
* testing/lisp/test-org-macro.el (test-org-macro/keyword): Remove
a test.
2019-04-29 20:48:00 +02:00
Nicolas Goaziou
14132a356a
Collect buffer-specific built-in macros in setup files
...
* lisp/org-macro.el (org-macro--set-template): New function.
(org-macro--collect-macros): Also collect "author", "email", "title"
and "date" macros.
(org-macro-initialize-templates): Do not collect previous macros here,
when it is too late.
(org-macro--find-date): New function.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Remove
test, since we cannot guarantee anymore that user-defined macros can
take precedence over built-in ones.
Reported-by: emsenn <emsenn@emsenn.net>
<http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00234.html >
2019-04-29 20:35:23 +02:00
Nicolas Goaziou
7e58160367
Fix "File mode specification error"
...
This reverts "org-element: Do not require 'org", which does not seem
trivial at the moment.
Reported-by: Amin Bandali <bandali@gnu.org>
<http://lists.gnu.org/r/emacs-orgmode/2019-03/msg00117.html >
2019-03-12 10:43:25 +01:00
Paul Eggert
d64c9a996b
Backport commit 662bee7d7 from Emacs
...
* lisp/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org-attach.el (org-attach-commit):
* lisp/org-macro.el (org-macro-initialize-templates):
* lisp/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/ox-html.el (org-html-format-spec):
* lisp/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* lisp/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
file-attributes cleanup
662bee7d70ccd3903e123b08c7ec9108a1a2ce0b
Paul Eggert
Sun Sep 23 18:32:59 2018 -0700
2019-01-13 12:43:04 -05:00
Bastien
f584d37a67
Update copyright year
2019-01-01 11:50:56 +01:00
Nicolas Goaziou
f5c2659bb8
Use `org-strip-quote' when possible
...
* lisp/org-macs.el (org-unbracket-string):
(org-strip-quotes): Allow nil values.
* lisp/org-lint.el (org-lint-wrong-include-link-parameter):
* lisp/org-macro.el (org-macro--collect-macros):
* lisp/org.el (org--setup-collect-keywords):
(org-edit-special):
* lisp/ox.el (org-export--get-inbuffer-options):
(org-export--list-bound-variables):
(org-export-expand-include-keyword): Use `org-strip-quote' instead of
`org-unbracket-string' whenever possible.
2018-11-10 08:58:31 +01:00
Nicolas Goaziou
3be2260806
Silence byte-compiler
...
* lisp/ob-emacs-lisp.el:
* lisp/org-macro.el: Silence byte-compiler.
2018-10-01 21:33:49 +02:00
Nicolas Goaziou
65ebb128bc
org-macro: Fix "results" macro
...
* lisp/org-macro.el (org-macro-initialize-templates): Do not
initialize the special "results" macro.
(org-macro-replace-all): Do not raise an error if "results" macro has
no associated template yet.
* lisp/ox.el (org-export-as): Update code comments.
* testing/lisp/test-ox.el (test-org-export/expand-macro): Add test.
2018-07-07 12:53:13 +02:00
Nicolas Goaziou
623cc46259
org-macro: Small refactoring
...
* lisp/org-macro.el (org-macro--get-property): New function.
(org-macro-initialize-templates): Use new function.
2018-07-07 12:37:24 +02:00
Nicolas Goaziou
84d87d990e
org-macro: Fix a docstring
...
* lisp/org-macro.el (org-macro-initialize-templates): Add missing
macros to docstring.
Reported-by: "Berry, Charles" <ccberry@ucsd.edu>
<http://lists.gnu.org/r/emacs-orgmode/2018-07/msg00032.html >
2018-07-07 12:10:48 +02:00
Nicolas Goaziou
bc92f734cf
org-macro: Remove unnecessary `declare-function'
2018-04-29 12:26:59 +02:00
Nicolas Goaziou
d33e6eae51
org-macro: Refactoring
...
* lisp/org-macro.el (org-macro-initialize-templates): Refactor function.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Remove
duplicate tests. Add new test.
2018-03-23 23:40:56 +01:00
Nicolas Goaziou
28977b719c
Merge branch 'maint'
2018-03-23 23:32:00 +01:00
Nicolas Goaziou
143a87e45c
org-macro: Fix infloop when re-defining built-in macros
...
* lisp/org-macro.el (org-macro-initialize-templates): User-defined
macros have higher precedence than built-in macros.
Reported-by: Eric S Fraga <esflists@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00413.html >
2018-03-23 23:30:06 +01:00
Kyle Meyer
d94f7024bc
Merge branch 'maint'
2018-01-07 00:28:35 -05:00
Kyle Meyer
3e1641ef0a
Update copyright years
2018-01-07 00:27:54 -05:00
Nicolas Goaziou
3ac619c8ac
org-macro: Placeholders in (eval ...) macros are always strings
...
* lisp/org-macro.el (org-macro-initialize-templates): Update
templates.
(org-macro-expand): Ensure placeholders in "eval" macros are strings.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Update
tests.
2017-12-17 09:40:56 +01:00
Nicolas Goaziou
b6df86a303
org-macro: Silence byte-compiler
2017-11-22 23:35:50 +01:00
Nicolas Goaziou
51234f9555
org-macro: Implement "keyword" macro
...
* lisp/org-macro.el (org-macro-initialize-templates): Implement
"keyword" macro.
* doc/org.texi (Macro replacement): Document new macro.
* testing/lisp/test-org-macro.el (test-org-macro/keyword): New test.
2017-11-21 23:38:24 +01:00
Nicolas Goaziou
5f5d82ed51
Remove second pass for macro expansion
...
* lisp/org-macro.el (org-macro-initialize-templates): Initialize all
macros, including {{{title}}} and al.
(org-macro-replace-all): Change signature.
(org-macro--find-keyword-value): New function.
* lisp/ox.el (org-export-as): Remove second macro expansion
2017-11-21 22:27:42 +01:00
Paul Eggert
ff0dcf52a5
Backport commit bc511a64f from Emacs
...
Prefer HTTPS to FTP and HTTP in documentation
bc511a64f6da9ab51acc7c8865e80c4a4cb655c2
Paul Eggert
Wed Sep 13 15:54:37 2017 -0700
2017-09-17 00:28:38 -04:00
Nicolas Goaziou
526b3d4b98
Merge branch 'maint'
2017-08-21 21:27:06 +02:00
Nicolas Goaziou
6980b02b6f
Revert "org-macro: Expand macros only within narrowed part of buffer"
...
This reverts commit 82db669de6
.
2017-08-21 21:21:30 +02:00
Kaushal Modi
d48cfdf68b
Add hold 'action' to the "n" macro and ws-trim all "n" macro args
...
* lisp/org-macro.el (org-macro--counter-increment): Rename the
optional arg RESET to ACTION, as now that action can mean setting,
resetting or even holding the specified counter. ACTION set to
"-" will hold the previous value of the counter. White-space is
now trimmed from the NAME arg too.
* doc/org.texi (Macro replacement): Document the new hold action.
* testing/lisp/test-org-macro.el (test-org-macro/n): Add new tests for
the hold action.
2017-06-17 23:46:24 -04:00
Nicolas Goaziou
dac9ae16ea
org-macro: Silence byte-compiler
2017-06-14 10:01:26 +02:00
Kaushal Modi
1e92f5ed39
Allow org-file-contents to fetch file contents from a URL
...
* lisp/org.el (org--file-cache): New variable.
(org-reset-file-cache):
(org-file-url-p): New function.
(org-mode-restart): Use new function.
* lisp/org.el (org-file-contents): Allow the FILE argument to be a
URL. If the URL contents are already cached, return the cache
contents, else download the file and return contents of that. The
file is automatically cached each time it is downloaded. Add a new
optional argument NOCACHE. If this is non-nil, the URL is always
downloaded afresh. Use `org--file-cache' and `org-file-url-p'.
* lisp/org.el (org-edit-special): Do not allow editing the "file" if a
URL is specified for the "#+SETUPFILE".
* lisp/ox.el (org-export--list-bound-variables)
(org-export--prepare-file-contents):
* lisp/org-macro.el (org-macro--collect-macros) : Adapt to the
possibility that the input to `org-file-contents' can be a URL too.
* doc/org.texi (Export settings, In-buffer settings)
(The very busy C-c C-c key): Mention that #+SETUPFILE keyword can now
take a URL as a value, and that C-c C-c on the #+SETUPFILE line will
clear the org file cache.
* testing/lisp/test-org.el (test-org/org-file-contents-url)
(test-org/org-file-contents-file): Add tests for org-file-contents.
* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options): Add
test for reading setupfile specified via a URL.
2017-06-13 11:41:58 -04:00
Nicolas Goaziou
28bb7777b4
Merge branch 'maint'
2017-06-09 21:23:17 +02:00
Nicolas Goaziou
4bdf11a967
org-macro: Silence byte-compiler
2017-06-09 21:22:53 +02:00
Nicolas Goaziou
657ed58eac
org-macro: Fix incomplete docstring
...
* lisp/org-macro.el (org-macro--counter-increment): Fix incomplete
docstring. Small refactoring.
2017-06-09 10:22:51 +02:00
Nicolas Goaziou
8e8094b919
Merge branch 'maint'
2017-06-08 15:04:55 +02:00
Nicolas Goaziou
3cf6345b40
org-macro: Fix macro expansion in commented trees
...
* lisp/org-macro.el (org-macro-replace-all): Prevent macro expansion
in commented trees.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Add
tests.
* testing/lisp/test-ox.el (test-org-export/expand-macro): Remove
tests.
2017-06-08 14:59:34 +02:00
Nicolas Goaziou
57bf6bbbde
Merge branch 'maint'
2017-06-05 18:47:25 +02:00
Nicolas Goaziou
82db669de6
org-macro: Expand macros only within narrowed part of buffer
...
* lisp/org-macro.el (org-macro-replace-all): Expand macros only within
narrowed part of buffer.
* testing/lisp/test-org-macro.el (test-org/macro-replace-all): Update
test.
Expanding macros outside in the whole buffer could make sense, e.g.,
if a macro expands to some Babel code, which, in turn, is evaluated
prior to export. However, by principle of least surprise, it is
better to limit expansion to current accessible part of the buffer.
2017-06-05 18:08:42 +02:00
Nicolas Goaziou
ad89390219
org-macro: Implement the "n" macro
...
* lisp/org-macro.el (org-macro--counter-table): New variable.
(org-macro--counter-initialize):
(org-macro--counter-increment): New functions.
(org-macro-initialize-templates): Use new functions.
* doc/org.texi (Macro replacement): Document new macro.
* testing/lisp/test-org-macro.el (test-org-macro/n):
(test-org-macro/property): New tests.
2017-05-25 12:25:13 +02:00
Kyle Meyer
713f785017
Update copyright years
2017-01-05 20:19:37 -05:00
Aaron Ecay
6e3ff4acc5
Deprecate org-remove-(angle-brackets,double-quotes)
...
* lisp/org.el (org-remove-angle-brackets, org-remove-double-quotes):
Deprecate.
* lisp/org-gnus.el (org-gnus-store-link):
* lisp/org-lint.el (org-lint-non-existent-setupfile-parameter):
(org-lint-wrong-include-link-parameter):
* lisp/org-macro.el (org-macro--collect-macros):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org.el (org--setup-collect-keywords):
(org-insert-link):
(org-translate-link-from-planner):
(org-offer-links-in-entry):
* lisp/ox-publish.el (org-publish-cache-file-needs-publishing):
* lisp/ox.el (org-export--get-inbuffer-options):
(org-export--list-bound-variables):
(org-export-expand-include-keyword): Replace with `org-unbracket-string'.
2016-09-03 02:22:11 +01:00
Nicolas Goaziou
72461eaeaf
Use string-match-p' instead of
org-string-match-p'
...
* contrib/lisp/org-contacts.el (org-contacts-filter):
(org-contacts-complete-group):
(org-contacts-complete-tags-props):
* contrib/lisp/org-wl.el (org-wl-open):
* contrib/lisp/ox-bibtex.el (org-bibtex-merge-contiguous-citations):
* lisp/ob-core.el (org-babel-demarcate-block):
* lisp/ob-processing.el (org-babel-processing-view-sketch):
* lisp/ob-stan.el (org-babel-execute:stan):
* lisp/org-agenda.el (org-agenda-get-category-icon):
* lisp/org-clock.el (org-clock-into-drawer):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-lint.el (org-lint-orphaned-affiliated-keywords):
(org-lint-invalid-babel-call-block):
(org-lint-colon-in-name):
* lisp/org-list.el (org-list-item-body-column):
* lisp/org-macro.el (org-macro-replace-all):
* lisp/org-plot.el (org-plot/gnuplot-script):
* lisp/org-table.el (org-table-export):
(org-table-align):
(org-table-get-range):
(org-table-recalculate):
(org-table-expand-lhs-ranges):
(org-table-formula-substitute-names):
(org-table-show-reference):
(orgtbl-to-texinfo):
(org-table-remote-reference-indirection):
* lisp/org.el (org-make-link-string):
(org--open-elisp-link):
(org-open-at-point):
(org-store-log-note):
(org-cached-entry-get):
(org--valid-property-p):
(org-entry-properties):
(org-buffer-property-keys):
(org-insert-drawer):
(org-display-inline-images):
(org-in-commented-heading-p):
* lisp/ox-ascii.el (org-ascii-keyword):
* lisp/ox-beamer.el (org-beamer--format-frame):
* lisp/ox-html.el (org-html-keyword):
* lisp/ox-latex.el (org-latex--label):
(org-latex-headline):
(org-latex-item):
(org-latex-keyword):
(org-latex--inline-image):
(org-latex-src-block):
* lisp/ox-odt.el (org-odt-styles-dir):
(org-odt-keyword):
(org-odt--translate-latex-fragments):
* lisp/ox-texinfo.el (org-texinfo-template):
(org-texinfo-keyword):
(org-texinfo-src-block):
* lisp/ox.el (org-export-inline-image-p):
(org-export-file-uri):
* testing/lisp/test-org-table.el (test-org-table/to-generic):
(test-org-table/to-latex):
(test-org-table/to-html):
(test-org-table/named-field):
(test-org-table/named-column):
(test-org-table/tab-indent):
(test-org-table/first-rc):
(test-org-table/last-rc): Use `string-match-p' instead of
`org-string-match-p'.
2016-07-25 15:21:12 +02:00
Nicolas Goaziou
770711153d
org-macro: Use cl-lib
2016-05-26 16:16:31 +02:00