View file File name : org-macro.elc Content :;ELC ;;; Compiled ;;; in Emacs version 27.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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 (#$ . 502)) (make-variable-buffer-local 'org-macro-templates) #@223 Set template for the macro NAME. VALUE is the template of the macro. The new value override the previous one, unless VALUE is nil. TEMPLATES is the list of templates. Return the updated list. (fn NAME VALUE TEMPLATES) (defalias 'org-macro--set-template #[771 "\203 \300\"\211\203 \211\241\210\202 BB\262\210\207" [assoc] 6 (#$ . 897)]) #@325 Collect macro definitions in current buffer and setup files. Return an alist containing all macro templates found. FILES is a list of setup files names read so far, used to avoid circular dependencies. TEMPLATES is the alist collected so far. The two arguments are used in recursive calls. (fn &optional FILES TEMPLATES) (defalias 'org-macro--collect-macros #[512 "\302\303\212\304!\203 \305!q\210\212\214~\210\211\206 `b\210\306\307\310\302#\203\245 \311 \312!\313=\203\241 \314\315\"\314\316\"\317\232\203V \320\321\"\203\240 \322\303\"\323\324\225\"\325#\262\266\202\240 \326!\327!\211\203d \202g \330!\211\235\204\236 \331\332!r\211q\210\333\324\334\335\336!\337\"\340$\216\204\211 \341!\342 \210\343\344\"c\210\345\nB \"\262*\210\266\210\210\202 +\210\346\347\350!B\351\347\352!B\353\347\354\302\"B\355\356 BF\211\211\203\332 \211@\211@A\211\325\n#\262\266A\266\202\202\275 \266)\207" [case-fold-search default-directory t 1 markerp marker-buffer re-search-forward "^[ ]*#\\+\\(MACRO\\|SETUPFILE\\):" nil org-element-at-point org-element-type keyword org-element-property :value :key "MACRO" string-match "^\\(\\S-+\\)[ ]*" match-string substring 0 org-macro--set-template org-strip-quotes org-file-url-p expand-file-name generate-new-buffer " *temp*" make-byte-code "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 file-name-directory org-mode org-file-contents noerror org-macro--collect-macros "author" org-macro--find-keyword-value "AUTHOR" "email" "EMAIL" "title" "TITLE" "date" org-macro--find-date] 15 (#$ . 1255)]) #@340 Collect macro templates defined in current buffer. 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". (defalias 'org-macro-initialize-templates #[0 "\301\302!\210\303 \210\304 \305\306 !\211\2050 \307!\2050 \310\311!B\312\313\314\315!\315\316!\3178\262!#BD\262\244\320\321\322\323F\244\211\207" [org-macro-templates require org-element org-macro--counter-initialize org-macro--collect-macros buffer-file-name buffer-base-buffer file-exists-p "input-file" file-name-nondirectory "modification-time" format "(eval\n(format-time-string $1\n (or (and (org-string-nw-p $2)\n (org-macro--vc-modified-time %s))\n '%s)))" prin1-to-string file-attributes 5 ("n" . "(eval (org-macro--counter-increment $1 $2))") ("keyword" . "(eval (org-macro--find-keyword-value $1))") ("time" . "(eval (format-time-string $1))") ("property" . "(eval (org-macro--get-property $1 $2))")] 11 (#$ . 2863)]) #@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 "\301\302\303\"\304#A\211\205O \305\306\304\307#)\266\203\310\311\312\313\314\315\316\n\"\317\"\320\321%\306\322%\203E \323\3241? \325!0\202B \210\326 !\262\327\330\206L \331\"\266\202\207" [inhibit-changing-match-data assoc-string org-element-property :key t "\\`(eval\\>" nil string-match replace-regexp-in-string "\\$[0-9]+" make-byte-code 257 "\302\303\304\"!S\305\306\300\"8\206 \307\301\203 \310\311\"\202 \211\207" vconcat vector [string-to-number substring 1 org-element-property :args #1="" format "%S"] 5 "\n\n(fn M)" literal eval (error) read debug format "%s" #1#] 13 (#$ . 4063)]) #@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\333 \310 \311\312\313\314\315!\316\"\317$\216\320 )\262\204 \310 \311\312\313\314\315!\321\"\317$\216\322 )\262\323!\211\324=\203L \202| \211\325=\203[ \326\327\"\235\204t \211\330=\205| \326\327\"\304\307\331#)\266\203\205| \212\312\224b\210\332 )\211\203\326 \326\327\"\333 \"\326\334\"\211\326\335\"E\211\235\203\244 \336\337\"\210\202\324 \203\305 \211B\262\326\340\"b\210\341\304x\210`|\210\212c\210)\202\324 \342\232\204\324 \336\343\326\327\"\"\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-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 org-in-commented-heading-p [set-match-data evaporate] org-element-context org-element-type macro keyword org-element-property :key node-property string-match org-element-macro-parser org-macro-expand :begin :args error "Circular macro expansion: %s" :end " " "results" "Undefined Org macro: %s; aborting"] 16 (#$ . 5002)]) #@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\262A\266\202\202 \314\315\"\262\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 substring 1] 12 (#$ . 6574)]) #@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 "