;ELC   
;;; Compiled
;;; in Emacs version 28.2
;;; with all optimizations.



(byte-code "\300\301!\210\300\302!\210\300\303!\207" [require cl-lib org-macs org-compat] 2)
#@295 Alist containing all macro templates in current buffer.
Associations are in the shape of (NAME . TEMPLATE) where NAME
stands for macro's name and template for its replacement value,
both as strings.  This is an internal variable.  Do not set it
directly, use instead:

  #+MACRO: name template
(defvar org-macro-templates nil (#$ . 178))
(make-variable-buffer-local 'org-macro-templates)
#@64 Compute the formal arglist to use for TEMPLATE.

(fn TEMPLATE)
(defalias 'org-macro--makeargs #[257 "\300\211\301\302#\203 \300\225\262\303\304\305\"!]\262\202 \306\305W\203$ \207\300V\203; \307\310\311\"!B\262S\262\202$ \312B\207" [0 string-match "\\$\\([0-9]+\\)" string-to-number match-string 1 (&rest _) intern format "$%d" &optional] 8 (#$ . 572)])
#@175 Set template for the macro NAME.
VALUE is the template of the macro.  The new value override the
previous one, unless VALUE is nil.  Return the updated list.

(fn TEMPLATES)
(defalias 'org-macro--set-templates #[257 "\301\211\203s \211@\211\242\243\211\302\";\203J \303\301\304\305#)\266\203\203J \306!\30717 \310!A@0\202= \210\311\312\"\313\314\315E!\304\"\262\266\203Z \211\203Z \211\241\266\202l \211\204j \206d \316BB\262\266A\266\202\202 \210\207" [inhibit-changing-match-data nil assoc "\\`(eval\\>" t string-match org-macro--makeargs (error) read user-error "Invalid definition for macro %S" eval macroexpand-all lambda ""] 15 (#$ . 950)])
#@116 Collect macro definitions in current buffer and setup files.
Return an alist containing all macro templates found.
(defalias 'org-macro--collect-macros #[0 "\300\301\302\303\"B\304\301\305!B\306\301\307\303\"B\310\311 BF\312\313!\211:\203b \211\242\211:\203a \211\242\211\314\232\203` \243\243\211\204^ \211\203] \211@\315\316\"\203V \317\320\"\321\225\322OB\nB\262\n\266A\266\202\2026 \210\266\210\210\210\207" ["author" org-macro--find-keyword-value "AUTHOR" t "email" "EMAIL" "title" "TITLE" "date" org-macro--find-date org-collect-keywords ("MACRO") "MACRO" string-match "^\\(\\S-+\\)[ 	]*" match-string 1 0 nil] 12 (#$ . 1634)])
#@416 Collect macro templates defined in current buffer.

DEFAULT is a list of globally available templates.

Templates are stored in buffer-local variable `org-macro-templates'.

In addition to buffer-defined macros, the function installs the
following ones: "n", "author", "email", "keyword",
"time", "property", and, if the buffer is associated to
a file, "input-file" and "modification-time".

(fn &optional DEFAULT)
(defalias 'org-macro-initialize-templates #[256 "\301\302!\210\303 \210\304\305\306 \"!\307\310 !\211\2053 \311!\2053 \312\313!B\314\315!\3168\262\317\320#\262BD\262\244\321\244\211\207" [org-macro-templates require org-element org-macro--counter-initialize org-macro--set-templates append org-macro--collect-macros buffer-file-name buffer-base-buffer file-exists-p "input-file" file-name-nondirectory "modification-time" file-attributes 5 make-closure #[641 "\302\303!\203 \304\300!\206 \301\"\207" [V0 V1 format-time-string org-string-nw-p org-macro--vc-modified-time] 7 "\n\n(fn ARG1 &optional ARG2 &rest _)"] (("keyword" lambda (arg1 &rest _) (org-macro--find-keyword-value arg1 t)) ("n" lambda (&optional arg1 arg2 &rest _) (org-macro--counter-increment arg1 arg2)) ("property" lambda (arg1 &optional arg2 &rest _) (org-macro--get-property arg1 arg2)) ("time" lambda (arg1 &rest _) (format-time-string arg1)))] 10 (#$ . 2287)])
#@285 Return expanded MACRO, as a string.
MACRO is an object, obtained, for example, with
`org-element-context'.  TEMPLATES is an alist of templates used
for expansion.  See `org-macro-templates' for a buffer-local
default value.  Return nil if no template was found.

(fn MACRO TEMPLATES)
(defalias 'org-macro-expand #[514 "\300\301\302\"\303#A\211\2053 \304!\203 \305\301\306\"\"\202) \307\310\311\312\"\313\314%\315\316\2060 \317\"\262\207" [assoc-string org-element-property :key t functionp apply :args replace-regexp-in-string "\\$[0-9]+" make-closure #[257 "\301\302\303O!S\304\305\300\"8\206 \306\207" [V0 string-to-number 1 nil org-element-property :args #1=""] 5 "\n\n(fn M)"] nil literal format "%s" #1#] 9 (#$ . 3657)])
#@414 Replace all macros in current buffer by their expansion.

TEMPLATES is an alist of templates used for expansion.  See
`org-macro-templates' for a buffer-local default value.

Optional argument KEYWORDS, when non-nil is a list of keywords,
as strings, where macro expansion is allowed.

Return an error if a macro in the buffer cannot be associated to
a definition in TEMPLATES.

(fn TEMPLATES &optional KEYWORDS)
(defalias 'org-macro-replace-all #[513 "\212\214~\210eb\210\301\302\303!\"\304\305\306\304\307#\205\320 \310 \311\312\"\216\313 )\262\204 \310 \311\314\"\216\315 )\262\316!\211\317=\203> \202n \211\320=\203M \321\322\"\235\204f \211\323=\205n \321\322\"\304\307\324#)\266\203\205n \212\325\224b\210\326 )\211\203\313 \321\322\"\327	\"\321\330\"\211\321\331\"E\211\235\203\227 \332\333\"\266\202 \203\272 \211B\262\321\334\"b\210\335\304x\210`|\210\212c\210)\266\202 \336\232\204\311 \332\337\321\322\"\"\210\266\266\202 \266\202*\207" [inhibit-changing-match-data format "\\`EXPORT_%s\\+?\\'" regexp-opt nil re-search-forward "{{{[-A-Za-z0-9_]" t match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] org-in-commented-heading-p #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] org-element-context org-element-type macro keyword org-element-property :key node-property string-match 0 org-element-macro-parser org-macro-expand :begin :args error "Circular macro expansion: %s" :end " 	" "results" "Undefined Org macro: %s; aborting"] 16 (#$ . 4404)])
#@219 Build macro's arguments string from ARGS.
ARGS are strings.  Return value is a string with arguments
properly escaped and separated with commas.  This is the opposite
of `org-macro-extract-arguments'.

(fn &rest ARGS)
(defalias 'org-macro-escape-arguments #[128 "\300\301!\211\2033 \211@\302\303\304\305\300\232?\205$ \306\307\"\205$ \310\311\"P\312\313%Q\262A\266\202\202 \314\312O\207" ["" reverse "," replace-regexp-in-string "\\(\\\\*\\)," #[257 "\300\301\302\303\"G_T\304\"\305P\207" [make-string 2 match-string 1 92 ","] 6 "\n\n(fn M)"] string-match "\\\\+\\'" match-string 0 nil t 1] 12 (#$ . 5954)])
#@209 Extract macro arguments from string S.
S is a string containing comma separated values properly escaped.
Return a list of arguments, as strings.  This is the opposite of
`org-macro-escape-arguments'.

(fn S)
(defalias 'org-macro-extract-arguments #[257 "\300\301\302\303\304\305%\306\"\207" [split-string replace-regexp-in-string "\\(\\\\*\\)," #[257 "\300\301\"G\302\303\245\304\"\305\303\"\306U\203 \307\202 \310P\207" [match-string 1 make-string 2 92 mod 0 " " ","] 6 "\n\n(fn STR)"] nil t " "] 8 (#$ . 6583)])
#@167 Find PROPERTY's value at LOCATION.
PROPERTY is a string.  LOCATION is a search string, as expected
by `org-link-search', or the empty string.

(fn PROPERTY LOCATION)
(defalias 'org-macro--get-property #[514 "\212\301!\203 \3021 \303\304\305\303#)0\210\202 \306\307\"\266\310\305\311#)\207" [org-link-search-must-match-exact-headline org-string-nw-p (error) t org-link-search nil error "Macro property failed: cannot find location %s" org-entry-get selective] 6 (#$ . 7110)])
#@281 Find value for keyword NAME in current buffer.
Return value associated to the keywords named after NAME, as
a string, or nil.  When optional argument COLLECT is non-nil,
concatenate values, separated with a space, from various keywords
in the buffer.

(fn NAME &optional COLLECT)
(defalias 'org-macro--find-keyword-value #[513 "\212\301\302!\203\f \303\302!q\210\212\214~\210\302b\210\304\305\306!\"\307\310\3112j \312\310\307#\203O \313 \314!\315=\203K \316\317\"\204D \320\311\"\266\202! \321Q\262\210\210\202! \211\205i \211\310\322\203^ \323\202_ \324\325\322\326\325##\266\2020)\266\203+\207" [case-fold-search markerp 1 marker-buffer format "^[ 	]*#\\+%s:" regexp-quote t nil :exit re-search-forward org-element-at-point org-element-type keyword org-element-property :value throw " " replace-regexp-in-string "\\`\\([ 	]*\n\\)+" "\\`[ 	\n]+" "" "[ 	\n]+\\'"] 14 (#$ . 7601)])
#@66 Find value for DATE in current buffer.
Return value as a string.
(defalias 'org-macro--find-date #[0 "\300\301!\302\303\304!\"\211:\203( \211A\204( \305@!\306=\203( \307\310\307\311\312@!\"#\207\207" [org-macro--find-keyword-value "DATE" org-element-parse-secondary-string org-element-restriction keyword org-element-type timestamp format "(eval (if (org-string-nw-p $1) %s %S))" "(org-timestamp-format '%S $1)" org-element-copy] 8 (#$ . 8506)])
#@13 

(fn FILE)
(defalias 'org-macro--vc-modified-time #[257 "\301 \302\303\"\216\304!\205N \305\306!\307\310C\302\311\"\216C\312\304!\313\310\211\314&\266rq\210\315\302\316\"!\210)\317!\211\203G \320\321\310\307$\204: \210)\211\242)\266\203)\207" [case-fold-search current-window-configuration make-closure #[0 "\301\300!\207" [V0 set-window-configuration] 2] vc-backend get-buffer-create " *org-vc*" t nil #[0 "\301\300!\207" [V0 kill-buffer] 2] vc-call-backend print-log 1 vc-exec-after #[0 "eb\210\301\302\303\304#\205  \305`\306 {!\307\310\"\205 \300\311\312\"\240\262\207" [V0 re-search-forward "Date:?[ 	]*" nil t parse-time-string line-end-position cl-some identity apply encode-time] 5] get-buffer-process accept-process-output 0.5] 14 (#$ . 8963)])
#@47 Hash table containing counter value per name.
(defvar org-macro--counter-table nil (#$ . 9744))
#@40 Initialize `org-macro--counter-table'.
(defalias 'org-macro--counter-initialize #[0 "\301\302\303\"\211\207" [org-macro--counter-table make-hash-table :test equal] 3 (#$ . 9846)])
#@361 Increment counter NAME.
NAME is a string identifying the counter.

When non-nil, optional argument ACTION is a string.

If the string is "-", keep the NAME counter at its current
value, i.e. do not increment.

If the string represents an integer, set the counter to this number.

Any other non-empty string resets the counter to 1.

(fn NAME &optional ACTION)
(defalias 'org-macro--counter-increment #[513 ";\203 \302\303\203 \304\202 \305\306\303\307\306##\266\202\202 \306\310!\205; \302\303\2030 \304\2021 \305\306\303\307\306##\266\202\311\310!\204L \312\313#T\202q \314\230\203Z \312\315#\202q \316\302\317\320#)\266\203\203p \321!\202q \315#\207" [org-macro--counter-table inhibit-changing-match-data nil replace-regexp-in-string "\\`\\([ 	]*\n\\)+" "\\`[ 	\n]+" "" "[ 	\n]+\\'" org-string-nw-p puthash gethash 0 "-" 1 "\\`[0-9]+\\'" t string-match string-to-number] 13 (#$ . 10034)])
(provide 'org-macro)
